diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-03-14 09:23:23 +0100 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-03-14 09:23:23 +0100 |
| commit | 536a64557c82c350fd73ea64c6d4dd1737896579 (patch) | |
| tree | d90e1f2ba846090be20242925182ee5208828e15 | |
| parent | c39cb92325ba7280dae175ec5a32a97d0668981e (diff) | |
| download | lanes-536a64557c82c350fd73ea64c6d4dd1737896579.tar.gz lanes-536a64557c82c350fd73ea64c6d4dd1737896579.tar.bz2 lanes-536a64557c82c350fd73ea64c6d4dd1737896579.zip | |
More makefile tweaks
| -rw-r--r-- | Makefile | 25 | ||||
| -rw-r--r-- | deep_userdata_example/DUE.makefile | 22 | ||||
| -rw-r--r-- | src/Lanes.makefile | 8 | ||||
| -rw-r--r-- | unit_tests/UnitTests.makefile | 14 |
4 files changed, 36 insertions, 33 deletions
| @@ -47,39 +47,40 @@ $(info _UNITTEST_TARGET: $(_UNITTEST_TARGET)) | |||
| 47 | _DUE_TARGET := deep_userdata_example/deep_userdata_example.$(_SO) | 47 | _DUE_TARGET := deep_userdata_example/deep_userdata_example.$(_SO) |
| 48 | $(info _DUE_TARGET: $(_DUE_TARGET)) | 48 | $(info _DUE_TARGET: $(_DUE_TARGET)) |
| 49 | 49 | ||
| 50 | _PREFIX := LUA_CPATH="./src/?.$(_SO)" LUA_PATH="./src/?.lua;./tests/?.lua" | 50 | # setup LUA_PATH and LUA_CPATH so that requiring lanes and deep_userdata_example work without having to install them |
| 51 | _PREFIX := LUA_CPATH="./src/?.$(_SO);./deep_userdata_example/?.$(_SO)" LUA_PATH="./src/?.lua;./tests/?.lua" | ||
| 51 | 52 | ||
| 52 | .PHONY: all unit_tests | 53 | .PHONY: all build_lanes build_unit_tests build_DUE |
| 53 | 54 | ||
| 54 | # only build lanes itself by default | 55 | # only build lanes itself by default |
| 55 | all: $(_LANES_TARGET) | 56 | all: build_lanes |
| 56 | |||
| 57 | # build the unit_tests and the side deep_userdata_example module | ||
| 58 | # also run the test that shows whether lanes is successfully loaded or not | ||
| 59 | unit_tests: $(_UNITTEST_TARGET) $(_DUE_TARGET) | ||
| 60 | cd deep_userdata_example && $(MAKE) -f DUE.makefile LUA_LIBDIR=$(LUA_LIBDIR) install | ||
| 61 | $(_UNITTEST_TARGET) "lanes.require 'lanes'" | ||
| 62 | 57 | ||
| 63 | #--- | 58 | #--- |
| 64 | 59 | ||
| 65 | $(_LANES_TARGET): src/*.lua src/*.cpp src/*.h src/*.hpp | 60 | build_lanes: |
| 66 | @echo ========================================================================================= | 61 | @echo ========================================================================================= |
| 67 | cd src && $(MAKE) -f Lanes.makefile LUA=$(LUA) | 62 | cd src && $(MAKE) -f Lanes.makefile LUA=$(LUA) |
| 68 | @echo ==================== $(_LANES_TARGET): DONE! | 63 | @echo ==================== $(_LANES_TARGET): DONE! |
| 69 | @echo | 64 | @echo |
| 70 | 65 | ||
| 71 | $(_UNITTEST_TARGET): $(_LANES_TARGET) | 66 | build_unit_tests: |
| 72 | @echo ========================================================================================= | 67 | @echo ========================================================================================= |
| 73 | cd unit_tests && $(MAKE) -f UnitTests.makefile | 68 | cd unit_tests && $(MAKE) -f UnitTests.makefile |
| 74 | @echo ==================== $(_UNITTEST_TARGET): DONE! | 69 | @echo ==================== $(_UNITTEST_TARGET): DONE! |
| 75 | @echo | 70 | @echo |
| 76 | 71 | ||
| 77 | $(_DUE_TARGET): | 72 | build_DUE: |
| 78 | @echo ========================================================================================= | 73 | @echo ========================================================================================= |
| 79 | cd deep_userdata_example && $(MAKE) -f DUE.makefile | 74 | cd deep_userdata_example && $(MAKE) -f DUE.makefile |
| 80 | @echo ==================== $(_DUE_TARGET): DONE! | 75 | @echo ==================== $(_DUE_TARGET): DONE! |
| 81 | @echo | 76 | @echo |
| 82 | 77 | ||
| 78 | # build the unit_tests and the side deep_userdata_example module | ||
| 79 | # also run a test that shows whether lanes is successfully loaded or not | ||
| 80 | run_unit_tests: build_lanes build_unit_tests build_DUE | ||
| 81 | @echo ========================================================================================= | ||
| 82 | $(_PREFIX) $(_UNITTEST_TARGET) "lanes.require 'lanes'" | ||
| 83 | |||
| 83 | clean: | 84 | clean: |
| 84 | cd src && $(MAKE) -f Lanes.makefile clean | 85 | cd src && $(MAKE) -f Lanes.makefile clean |
| 85 | cd unit_tests && $(MAKE) -f UnitTests.makefile clean | 86 | cd unit_tests && $(MAKE) -f UnitTests.makefile clean |
diff --git a/deep_userdata_example/DUE.makefile b/deep_userdata_example/DUE.makefile index 8fcc89e..b5c3a23 100644 --- a/deep_userdata_example/DUE.makefile +++ b/deep_userdata_example/DUE.makefile | |||
| @@ -4,33 +4,33 @@ | |||
| 4 | 4 | ||
| 5 | include ../Shared.makefile | 5 | include ../Shared.makefile |
| 6 | 6 | ||
| 7 | _MODULE=deep_userdata_example.$(_SO) | 7 | _TARGET := deep_userdata_example.$(_SO) |
| 8 | 8 | ||
| 9 | _SRC:=$(wildcard *.cpp) ../src/compat.cpp ../src/deep.cpp | 9 | _SRC := $(wildcard *.cpp) ../src/compat.cpp ../src/deep.cpp |
| 10 | 10 | ||
| 11 | _OBJ:=$(_SRC:.cpp=.o) | 11 | _OBJ := $(_SRC:.cpp=.o) |
| 12 | 12 | ||
| 13 | #--- | 13 | #--- |
| 14 | all: $(_MODULE) | 14 | all: $(_TARGET) |
| 15 | $(info CC: $(CC)) | 15 | $(info CC: $(CC)) |
| 16 | $(info _MODULE: $(_MODULE)) | 16 | $(info _TARGET: $(_TARGET)) |
| 17 | $(info _SRC: $(_SRC)) | 17 | $(info _SRC: $(_SRC)) |
| 18 | 18 | ||
| 19 | _pch.hpp.gch: ../src/_pch.hpp | 19 | _pch.hpp.gch: ../src/_pch.hpp |
| 20 | $(CC) -I "../.." $(CFLAGS) -x c++-header $< -o _pch.hpp.gch | 20 | $(CC) -I "../.." $(CFLAGS) -x c++-header $< -o _pch.hpp.gch |
| 21 | 21 | ||
| 22 | %.o: %.cpp _pch.hpp.gch DUE.makefile | 22 | %.o: %.cpp _pch.hpp.gch DUE.makefile |
| 23 | $(CC) -I "../.." $(CFLAGS) -c $< | 23 | $(CC) -I "../.." $(CFLAGS) -c $< -o $@ |
| 24 | 24 | ||
| 25 | # Note: Don't put $(LUA_LIBS) ahead of $^; MSYS will not like that (I think) | 25 | # Note: Don't put $(LUA_LIBS) ahead of $^; MSYS will not like that (I think) |
| 26 | # | 26 | # |
| 27 | $(_MODULE): $(_OBJ) | 27 | $(_TARGET): $(_OBJ) |
| 28 | $(CC) $(LIBFLAG) $^ $(LIBS) $(LUA_LIBS) -o $@ | 28 | $(CC) $(LIBFLAG) $^ $(LIBS) $(LUA_LIBS) -o $@ |
| 29 | 29 | ||
| 30 | install: | 30 | install: |
| 31 | install -m 644 $(_MODULE) $(LUA_LIBDIR)/ | 31 | install -m 644 $(_TARGET) $(LUA_LIBDIR)/ |
| 32 | 32 | ||
| 33 | clean: | 33 | clean: |
| 34 | -rm -rf $(_MODULE) *.o *.map *.gch | 34 | -rm -rf $(_TARGET) *.o *.map *.gch |
| 35 | 35 | ||
| 36 | .PHONY: all clean | 36 | .PHONY: all clean |
diff --git a/src/Lanes.makefile b/src/Lanes.makefile index d9127f7..9798848 100644 --- a/src/Lanes.makefile +++ b/src/Lanes.makefile | |||
| @@ -16,7 +16,9 @@ _OBJ := $(_SRC:.cpp=.o) | |||
| 16 | _MODULE_DIR = $(_MODULE) | 16 | _MODULE_DIR = $(_MODULE) |
| 17 | 17 | ||
| 18 | #--- | 18 | #--- |
| 19 | all: $(_MODULE)/core.$(_SO) | 19 | all: info $(_MODULE)/core.$(_SO) |
| 20 | |||
| 21 | info: | ||
| 20 | $(info CC: $(CC)) | 22 | $(info CC: $(CC)) |
| 21 | $(info _SRC: $(_SRC)) | 23 | $(info _SRC: $(_SRC)) |
| 22 | 24 | ||
| @@ -24,7 +26,7 @@ _pch.hpp.gch: _pch.hpp | |||
| 24 | $(CC) $(CFLAGS) -x c++-header _pch.hpp -o _pch.hpp.gch | 26 | $(CC) $(CFLAGS) -x c++-header _pch.hpp -o _pch.hpp.gch |
| 25 | 27 | ||
| 26 | %.o: %.cpp _pch.hpp.gch *.h *.hpp Lanes.makefile | 28 | %.o: %.cpp _pch.hpp.gch *.h *.hpp Lanes.makefile |
| 27 | $(CC) $(CFLAGS) -c $< | 29 | $(CC) $(CFLAGS) -c $< -o $@ |
| 28 | 30 | ||
| 29 | # Note: Don't put $(LUA_LIBS) ahead of $^; MSYS will not like that (I think) | 31 | # Note: Don't put $(LUA_LIBS) ahead of $^; MSYS will not like that (I think) |
| 30 | # | 32 | # |
| @@ -66,4 +68,4 @@ $(WIN32_LUA51)/include/lua.h: | |||
| 66 | @echo " [MINGW_GCC=...mingw32-gcc]" | 68 | @echo " [MINGW_GCC=...mingw32-gcc]" |
| 67 | @false | 69 | @false |
| 68 | 70 | ||
| 69 | .PHONY: all clean nslu2 win32 | 71 | .PHONY: all info clean nslu2 win32 |
diff --git a/unit_tests/UnitTests.makefile b/unit_tests/UnitTests.makefile index b3d1c58..a383516 100644 --- a/unit_tests/UnitTests.makefile +++ b/unit_tests/UnitTests.makefile | |||
| @@ -4,30 +4,30 @@ | |||
| 4 | 4 | ||
| 5 | include ../Shared.makefile | 5 | include ../Shared.makefile |
| 6 | 6 | ||
| 7 | _TARGET := UnitTests$(_LUAEXT) | ||
| 8 | |||
| 7 | _SRC := $(wildcard *.cpp) ../src/deep.cpp ../src/compat.cpp | 9 | _SRC := $(wildcard *.cpp) ../src/deep.cpp ../src/compat.cpp |
| 8 | 10 | ||
| 9 | _OBJ := $(_SRC:.cpp=.o) | 11 | _OBJ := $(_SRC:.cpp=.o) |
| 10 | 12 | ||
| 11 | |||
| 12 | _UNITTEST_TARGET := UnitTests$(_LUAEXT) | ||
| 13 | |||
| 14 | #--- | 13 | #--- |
| 15 | all: $(_UNITTEST_TARGET) | 14 | all: $(_TARGET) |
| 16 | $(info CC: $(CC)) | 15 | $(info CC: $(CC)) |
| 16 | $(info _TARGET: $(_TARGET)) | ||
| 17 | $(info _SRC: $(_SRC)) | 17 | $(info _SRC: $(_SRC)) |
| 18 | 18 | ||
| 19 | _pch.hpp.gch: _pch.hpp | 19 | _pch.hpp.gch: _pch.hpp |
| 20 | $(CC) -I "../.." $(CFLAGS) -x c++-header _pch.hpp -o _pch.hpp.gch | 20 | $(CC) -I "../.." $(CFLAGS) -x c++-header _pch.hpp -o _pch.hpp.gch |
| 21 | 21 | ||
| 22 | %.o: %.cpp _pch.hpp.gch *.h *.hpp UnitTests.makefile | 22 | %.o: %.cpp _pch.hpp.gch *.h *.hpp UnitTests.makefile |
| 23 | $(CC) -I "../.." $(CFLAGS) -c $< | 23 | $(CC) -I "../.." $(CFLAGS) -c $< -o $@ |
| 24 | 24 | ||
| 25 | # Note: Don't put $(LUA_LIBS) ahead of $^; MSYS will not like that (I think) | 25 | # Note: Don't put $(LUA_LIBS) ahead of $^; MSYS will not like that (I think) |
| 26 | # | 26 | # |
| 27 | $(_UNITTEST_TARGET): $(_OBJ) | 27 | $(_TARGET): $(_OBJ) |
| 28 | $(CC) $^ $(LIBS) $(LUA_LIBS) -o $@ | 28 | $(CC) $^ $(LIBS) $(LUA_LIBS) -o $@ |
| 29 | 29 | ||
| 30 | clean: | 30 | clean: |
| 31 | -rm -rf $(_UNITTEST_TARGET) *.o *.map *.gch | 31 | -rm -rf $(_TARGET) *.o *.map *.gch |
| 32 | 32 | ||
| 33 | .PHONY: all clean | 33 | .PHONY: all clean |
