diff options
Diffstat (limited to 'src/Lanes.makefile')
-rw-r--r-- | src/Lanes.makefile | 69 |
1 files changed, 69 insertions, 0 deletions
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 @@ | |||
1 | # | ||
2 | # Lanes/src/Lanes.makefile | ||
3 | # | ||
4 | # make Manual build | ||
5 | # make LUAROCKS=1 CFLAGS=... LIBFLAG=... LuaRocks automated build | ||
6 | # | ||
7 | |||
8 | include ../Shared.makefile | ||
9 | |||
10 | _MODULE=lanes | ||
11 | |||
12 | _SRC := $(wildcard *.cpp) | ||
13 | |||
14 | _OBJ := $(_SRC:.cpp=.o) | ||
15 | |||
16 | _MODULE_DIR = $(_MODULE) | ||
17 | |||
18 | #--- | ||
19 | all: $(_MODULE)/core.$(_SO) | ||
20 | $(info CC: $(CC)) | ||
21 | $(info _SRC: $(_SRC)) | ||
22 | |||
23 | _pch.hpp.gch: _pch.hpp | ||
24 | $(CC) $(CFLAGS) -x c++-header _pch.hpp -o _pch.hpp.gch | ||
25 | |||
26 | %.o: %.cpp _pch.hpp.gch *.h *.hpp Lanes.makefile | ||
27 | $(CC) $(CFLAGS) -c $< | ||
28 | |||
29 | # Note: Don't put $(LUA_LIBS) ahead of $^; MSYS will not like that (I think) | ||
30 | # | ||
31 | $(_MODULE_DIR)/core.$(_SO): $(_OBJ) | ||
32 | mkdir -p $(_MODULE_DIR) | ||
33 | $(CC) $(LIBFLAG) $^ $(LIBS) $(LUA_LIBS) -o $@ | ||
34 | |||
35 | clean: | ||
36 | -rm -rf $(_MODULE)/core.$(_SO) *.o *.map *.gch | ||
37 | |||
38 | #--- | ||
39 | # NSLU2 "slug" Linux ARM | ||
40 | # | ||
41 | nslu2: | ||
42 | $(MAKE) all CFLAGS="$(CFLAGS) -I/opt/include -L/opt/lib -D_GNU_SOURCE -lpthread" | ||
43 | |||
44 | #--- | ||
45 | # Cross compiling to Win32 (MinGW on OS X Intel) | ||
46 | # | ||
47 | # Point WIN32_LUA51 to an extraction of LuaBinaries dll8 and dev packages. | ||
48 | # | ||
49 | # Note: Only works on platforms with same endianess (i.e. not from PowerPC OS X, | ||
50 | # since 'luac' uses the host endianess) | ||
51 | # | ||
52 | # EXPERIMENTAL; NOT TESTED OF LATE. | ||
53 | # | ||
54 | MINGW_GCC = mingw32-gcc | ||
55 | # i686-pc-mingw32-gcc | ||
56 | |||
57 | win32: $(WIN32_LUA51)/include/lua.h | ||
58 | $(MAKE) build CC=$(MINGW_GCC) \ | ||
59 | LUA_FLAGS=-I$(WIN32_LUA51)/include \ | ||
60 | LUA_LIBS="-L$(WIN32_LUA51) -llua51" \ | ||
61 | _SO=dll \ | ||
62 | SO_FLAGS=-shared | ||
63 | |||
64 | $(WIN32_LUA51)/include/lua.h: | ||
65 | @echo "Usage: make win32 WIN32_LUA51=<path of extracted LuaBinaries dll8 and dev packages>" | ||
66 | @echo " [MINGW_GCC=...mingw32-gcc]" | ||
67 | @false | ||
68 | |||
69 | .PHONY: all clean nslu2 win32 | ||