diff options
Diffstat (limited to 'src/Makefile')
| -rw-r--r-- | src/Makefile | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/src/Makefile b/src/Makefile index 03f5558..a16acce 100644 --- a/src/Makefile +++ b/src/Makefile | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | # | 1 | # |
| 2 | # Lanes/src/Makefile | 2 | # Lanes/src/Makefile |
| 3 | # | 3 | # |
| 4 | # make [LUA=... LUAC=...] Manual build | 4 | # make [LUA=...] Manual build |
| 5 | # make LUAROCKS=1 CFLAGS=... LIBFLAG=... LUA=... LUAC=... LuaRocks automated build | 5 | # make LUAROCKS=1 CFLAGS=... LIBFLAG=... LUA=... LuaRocks automated build |
| 6 | # | 6 | # |
| 7 | 7 | ||
| 8 | MODULE=lanes | 8 | MODULE=lanes |
| @@ -19,11 +19,10 @@ OPT_FLAGS=-O2 | |||
| 19 | # -O0 -g | 19 | # -O0 -g |
| 20 | 20 | ||
| 21 | LUA=lua | 21 | LUA=lua |
| 22 | LUAC=luac | ||
| 23 | 22 | ||
| 24 | _SO=.so | 23 | _SO=so |
| 25 | ifeq "$(findstring MINGW32,$(shell uname -s))" "MINGW32" | 24 | ifeq "$(findstring MINGW32,$(shell uname -s))" "MINGW32" |
| 26 | _SO=.dll | 25 | _SO=dll |
| 27 | endif | 26 | endif |
| 28 | 27 | ||
| 29 | ifeq "$(LUAROCKS)" "" | 28 | ifeq "$(LUAROCKS)" "" |
| @@ -116,32 +115,21 @@ ifeq "$(shell uname -s)" "BSD" | |||
| 116 | LIBS += -lpthread | 115 | LIBS += -lpthread |
| 117 | endif | 116 | endif |
| 118 | 117 | ||
| 118 | MODULE_DIR=$(MODULE) | ||
| 119 | |||
| 119 | #--- | 120 | #--- |
| 120 | all: lua51-$(MODULE)$(_SO) | 121 | all: $(MODULE)/core.$(_SO) |
| 121 | 122 | ||
| 122 | %.o: %.c *.h Makefile | 123 | %.o: %.c *.h Makefile |
| 123 | 124 | ||
| 124 | # Note: Don't put $(LUA_LIBS) ahead of $^; MSYS will not like that (I think) | 125 | # Note: Don't put $(LUA_LIBS) ahead of $^; MSYS will not like that (I think) |
| 125 | # | 126 | # |
| 126 | lua51-$(MODULE)$(_SO): $(OBJ) | 127 | $(MODULE_DIR)/core.$(_SO): $(OBJ) |
| 128 | mkdir -p $(MODULE_DIR) | ||
| 127 | $(CC) $(LIBFLAG) $^ $(LIBS) $(LUA_LIBS) -o $@ | 129 | $(CC) $(LIBFLAG) $^ $(LIBS) $(LUA_LIBS) -o $@ |
| 128 | 130 | ||
| 129 | clean: | 131 | clean: |
| 130 | -rm -rf lua51-$(MODULE)$(_SO) *.lch *.o *.tmp *.map | 132 | -rm -rf $(MODULE)/core.$(_SO) *.o *.map |
| 131 | |||
| 132 | lanes.o: keeper.lch | ||
| 133 | |||
| 134 | # Note: 'luac -o -' could be used on systems other than Windows (where pipes | ||
| 135 | # are binary). We need to support MinGW as well, so a temporary file. | ||
| 136 | # | ||
| 137 | # mode 1: embed bytecode version | ||
| 138 | #%.lch: %.lua | ||
| 139 | # $(LUAC) -o $@.tmp $< | ||
| 140 | # $(LUA) ../tools/bin2c.lua $@.tmp -o $@ | ||
| 141 | # -rm $@.tmp | ||
| 142 | # mode 2: embed text version (LuaJIT2-compatible) | ||
| 143 | %.lch: %.lua | ||
| 144 | $(LUA) ../tools/bin2c.lua $< -o $@ | ||
| 145 | 133 | ||
| 146 | #--- | 134 | #--- |
| 147 | # NSLU2 "slug" Linux ARM | 135 | # NSLU2 "slug" Linux ARM |
| @@ -166,10 +154,9 @@ win32: $(WIN32_LUA51)/include/lua.h | |||
| 166 | $(MAKE) build CC=$(MINGW_GCC) \ | 154 | $(MAKE) build CC=$(MINGW_GCC) \ |
| 167 | LUA_FLAGS=-I$(WIN32_LUA51)/include \ | 155 | LUA_FLAGS=-I$(WIN32_LUA51)/include \ |
| 168 | LUA_LIBS="-L$(WIN32_LUA51) -llua51" \ | 156 | LUA_LIBS="-L$(WIN32_LUA51) -llua51" \ |
| 169 | _SO=.dll \ | 157 | _SO=dll \ |
| 170 | SO_FLAGS=-shared \ | 158 | SO_FLAGS=-shared \ |
| 171 | LUA=lua51 \ | 159 | LUA=lua51 |
| 172 | LUAC=luac51 | ||
| 173 | 160 | ||
| 174 | $(WIN32_LUA51)/include/lua.h: | 161 | $(WIN32_LUA51)/include/lua.h: |
| 175 | @echo "Usage: make win32 WIN32_LUA51=<path of extracted LuaBinaries dll8 and dev packages>" | 162 | @echo "Usage: make win32 WIN32_LUA51=<path of extracted LuaBinaries dll8 and dev packages>" |
