aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile36
1 files changed, 19 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 3f1f0e1..c5c41b1 100644
--- a/Makefile
+++ b/Makefile
@@ -17,39 +17,40 @@ MODULE = lanes
17 17
18N=1000 18N=1000
19 19
20_SO=.so 20_TARGET_DIR=src/lanes
21_TARGET_SO=src/lua51-lanes.so
22TIME=time 21TIME=time
23 22
24ifeq "$(findstring MINGW32,$(shell uname -s))" "MINGW32" 23ifeq "$(findstring MINGW32,$(shell uname -s))" "MINGW32"
25 # MinGW MSYS on XP 24 # MinGW MSYS on XP
26 # 25 #
27 LUA=lua.exe 26 _SO=dll
28 LUAC=luac.exe 27 _LUAEXT=.exe
29 _SO=.dll
30 _TARGET_SO=./lua51-lanes.dll
31 TIME=timeit.exe 28 TIME=timeit.exe
32else 29else
33 # Autodetect LUA & LUAC 30 _SO=so
34 # 31 _LUAEXT=
35 LUA=$(word 1,$(shell which lua5.1) $(shell which lua51) lua)
36 LUAC=$(word 1,$(shell which luac5.1) $(shell which luac51) luac)
37endif 32endif
38 33
39_PREFIX=LUA_CPATH="./src/?$(_SO)" LUA_PATH="./src/?.lua;./tests/?.lua" 34# Autodetect LUA
35#
36LUA=$(word 1,$(shell which lua5.1$(_LUAEXT)) $(shell which lua51$(_LUAEXT)) lua$(_LUAEXT))
37
38_TARGET_SO=$(_TARGET_DIR)/core.$(_SO)
39
40_PREFIX=LUA_CPATH="./src/?.$(_SO)" LUA_PATH="./src/?.lua;./tests/?.lua"
40 41
41#--- 42#---
42all: $(_TARGET_SO) 43all: $(_TARGET_SO)
43 44
44$(_TARGET_SO): src/*.lua src/*.c src/*.h 45$(_TARGET_SO): src/*.lua src/*.c src/*.h
45 cd src && $(MAKE) LUA=$(LUA) LUAC=$(LUAC) 46 cd src && $(MAKE) LUA=$(LUA)
46 47
47clean: 48clean:
48 cd src && $(MAKE) clean 49 cd src && $(MAKE) clean
49 50
50debug: 51debug:
51 $(MAKE) clean 52 $(MAKE) clean
52 cd src && $(MAKE) LUA=$(LUA) LUAC=$(LUAC) OPT_FLAGS="-O0 -g" 53 cd src && $(MAKE) LUA=$(LUA) OPT_FLAGS="-O0 -g"
53 @echo "" 54 @echo ""
54 @echo "** Now, try 'make repetitive' or something and if it crashes, 'gdb $(LUA) ...core file...'" 55 @echo "** Now, try 'make repetitive' or something and if it crashes, 'gdb $(LUA) ...core file...'"
55 @echo " Then 'bt' for a backtrace." 56 @echo " Then 'bt' for a backtrace."
@@ -65,7 +66,7 @@ gdb:
65#--- LuaRocks automated build --- 66#--- LuaRocks automated build ---
66# 67#
67rock: 68rock:
68 cd src && $(MAKE) LUAROCKS=1 CFLAGS="$(CFLAGS)" LIBFLAG="$(LIBFLAG)" LUA=$(LUA) LUAC=$(LUAC) 69 cd src && $(MAKE) LUAROCKS=1 CFLAGS="$(CFLAGS)" LIBFLAG="$(LIBFLAG)" LUA=$(LUA)
69 70
70 71
71#--- Testing --- 72#--- Testing ---
@@ -196,10 +197,11 @@ LUA_SHAREDIR=$(DESTDIR)/share/lua/5.1
196# 197#
197# AKa 17-Oct: changed to use 'install -m 644' and 'cp -p' 198# AKa 17-Oct: changed to use 'install -m 644' and 'cp -p'
198# 199#
199install: $(_TARGET_SO) src/lanes.lua 200install: $(_TARGET_SO) src/lanes.lua src/lanes-keeper.lua
200 mkdir -p $(LUA_LIBDIR) $(LUA_SHAREDIR) 201 mkdir -p $(LUA_LIBDIR) $(LUA_LIBDIR)/lanes $(LUA_SHAREDIR)
201 install -m 644 $(_TARGET_SO) $(LUA_LIBDIR) 202 install -m 644 $(_TARGET_SO) $(LUA_LIBDIR)/lanes
202 cp -p src/lanes.lua $(LUA_SHAREDIR) 203 cp -p src/lanes.lua $(LUA_SHAREDIR)
204 cp -p src/lanes-keeper.lua $(LUA_SHAREDIR)
203 205
204 206
205#--- Packaging --- 207#--- Packaging ---