From 24c8215fa05142cc2461efacc1187ef443450af9 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Thu, 13 Mar 2025 16:09:03 +0100 Subject: More work on Makefiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * renamed makefiles: - Shared.mk → Shared.makefile - src/Makefile → src/Lanes.makefile - unit_tests/Makefile → unit_tests/UnitTests.makefile - deep_userdata_example/Makefile → deep_userdata_example/DUE.makefile * Add a makefile for deep_userdata_example * added a target 'unit_tests' to build them (not running them yet) * plus some minor internal improvements --- src/Lanes.makefile | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile | 70 ------------------------------------------------------ 2 files changed, 69 insertions(+), 70 deletions(-) create mode 100644 src/Lanes.makefile delete mode 100644 src/Makefile (limited to 'src') diff --git a/src/Lanes.makefile b/src/Lanes.makefile new file mode 100644 index 0000000..d9127f7 --- /dev/null +++ b/src/Lanes.makefile @@ -0,0 +1,69 @@ +# +# Lanes/src/Lanes.makefile +# +# make Manual build +# make LUAROCKS=1 CFLAGS=... LIBFLAG=... LuaRocks automated build +# + +include ../Shared.makefile + +_MODULE=lanes + +_SRC := $(wildcard *.cpp) + +_OBJ := $(_SRC:.cpp=.o) + +_MODULE_DIR = $(_MODULE) + +#--- +all: $(_MODULE)/core.$(_SO) + $(info CC: $(CC)) + $(info _SRC: $(_SRC)) + +_pch.hpp.gch: _pch.hpp + $(CC) $(CFLAGS) -x c++-header _pch.hpp -o _pch.hpp.gch + +%.o: %.cpp _pch.hpp.gch *.h *.hpp Lanes.makefile + $(CC) $(CFLAGS) -c $< + +# Note: Don't put $(LUA_LIBS) ahead of $^; MSYS will not like that (I think) +# +$(_MODULE_DIR)/core.$(_SO): $(_OBJ) + mkdir -p $(_MODULE_DIR) + $(CC) $(LIBFLAG) $^ $(LIBS) $(LUA_LIBS) -o $@ + +clean: + -rm -rf $(_MODULE)/core.$(_SO) *.o *.map *.gch + +#--- +# NSLU2 "slug" Linux ARM +# +nslu2: + $(MAKE) all CFLAGS="$(CFLAGS) -I/opt/include -L/opt/lib -D_GNU_SOURCE -lpthread" + +#--- +# Cross compiling to Win32 (MinGW on OS X Intel) +# +# Point WIN32_LUA51 to an extraction of LuaBinaries dll8 and dev packages. +# +# Note: Only works on platforms with same endianess (i.e. not from PowerPC OS X, +# since 'luac' uses the host endianess) +# +# EXPERIMENTAL; NOT TESTED OF LATE. +# +MINGW_GCC = mingw32-gcc +# i686-pc-mingw32-gcc + +win32: $(WIN32_LUA51)/include/lua.h + $(MAKE) build CC=$(MINGW_GCC) \ + LUA_FLAGS=-I$(WIN32_LUA51)/include \ + LUA_LIBS="-L$(WIN32_LUA51) -llua51" \ + _SO=dll \ + SO_FLAGS=-shared + +$(WIN32_LUA51)/include/lua.h: + @echo "Usage: make win32 WIN32_LUA51=" + @echo " [MINGW_GCC=...mingw32-gcc]" + @false + +.PHONY: all clean nslu2 win32 diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 39b98e6..0000000 --- a/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# -# Lanes/src/Makefile -# -# make Manual build -# make LUAROCKS=1 CFLAGS=... LIBFLAG=... LuaRocks automated build -# - -include ../Shared.mk - -MODULE=lanes - -CC:= g++ -std=c++20 - -SRC:=$(wildcard *.cpp) - -OBJ:=$(SRC:.cpp=.o) - - -MODULE_DIR=$(MODULE) - -#--- -all: $(MODULE)/core.$(_SO) - -_pch.hpp.gch: _pch.hpp - $(CC) $(CFLAGS) -x c++-header _pch.hpp -o _pch.hpp.gch - -%.o: %.cpp _pch.hpp.gch *.h *.hpp Makefile - $(CC) $(CFLAGS) -c $< - -# Note: Don't put $(LUA_LIBS) ahead of $^; MSYS will not like that (I think) -# -$(MODULE_DIR)/core.$(_SO): $(OBJ) - mkdir -p $(MODULE_DIR) - $(CC) $(LIBFLAG) $^ $(LIBS) $(LUA_LIBS) -o $@ - -clean: - -rm -rf $(MODULE)/core.$(_SO) *.o *.map *.gch - -#--- -# NSLU2 "slug" Linux ARM -# -nslu2: - $(MAKE) all CFLAGS="$(CFLAGS) -I/opt/include -L/opt/lib -D_GNU_SOURCE -lpthread" - -#--- -# Cross compiling to Win32 (MinGW on OS X Intel) -# -# Point WIN32_LUA51 to an extraction of LuaBinaries dll8 and dev packages. -# -# Note: Only works on platforms with same endianess (i.e. not from PowerPC OS X, -# since 'luac' uses the host endianess) -# -# EXPERIMENTAL; NOT TESTED OF LATE. -# -MINGW_GCC=mingw32-gcc -# i686-pc-mingw32-gcc - -win32: $(WIN32_LUA51)/include/lua.h - $(MAKE) build CC=$(MINGW_GCC) \ - LUA_FLAGS=-I$(WIN32_LUA51)/include \ - LUA_LIBS="-L$(WIN32_LUA51) -llua51" \ - _SO=dll \ - SO_FLAGS=-shared - -$(WIN32_LUA51)/include/lua.h: - @echo "Usage: make win32 WIN32_LUA51=" - @echo " [MINGW_GCC=...mingw32-gcc]" - @false - -.PHONY: all clean nslu2 win32 -- cgit v1.2.3-55-g6feb