aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 20 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index f5ac12e..df56dcd 100644
--- a/Makefile
+++ b/Makefile
@@ -33,22 +33,30 @@ endif
33 33
34# Autodetect LUA 34# Autodetect LUA
35# 35#
36LUA=$(word 1,$(shell which lua5.1$(_LUAEXT)) $(shell which lua51$(_LUAEXT)) $(shell which lua$(_LUAEXT)) $(shell which luajit$(_LUAEXT))) 36LUA:=$(word 1,$(shell which lua5.1$(_LUAEXT) 2>/dev/null) $(shell which lua51$(_LUAEXT) 2>/dev/null) $(shell which lua$(_LUAEXT) 2>/dev/null) $(shell which luajit$(_LUAEXT) 2>/dev/null))
37LUA_VERSION:=$(shell $(LUA) -e "print(string.sub(_VERSION,5,7))")
37 38
38_TARGET_SO=$(_TARGET_DIR)/core.$(_SO) 39$(info LUA is $(LUA))
40$(info LUA_VERSION is $(LUA_VERSION))
39 41
40_UNITTEST_TARGET=$(_TARGET_DIR)/UnitTests$(_LUAEXT) 42_TARGET_SO:=$(_TARGET_DIR)/core.$(_SO)
41 43
42_PREFIX=LUA_CPATH="./src/?.$(_SO)" LUA_PATH="./src/?.lua;./tests/?.lua" 44_UNITTEST_TARGET:=$(_TARGET_DIR)/UnitTests$(_LUAEXT)
45
46_PREFIX:=LUA_CPATH="./src/?.$(_SO)" LUA_PATH="./src/?.lua;./tests/?.lua"
43 47
44#--- 48#---
45all: $(_TARGET_SO) $(_UNITTEST_TARGET) 49all: $(_TARGET_SO) $(_UNITTEST_TARGET)
46 50
47$(_TARGET_SO): src/*.lua src/*.cpp src/*.h src/*.hpp 51$(_TARGET_SO): src/*.lua src/*.cpp src/*.h src/*.hpp
52 @echo =========================================================================================
48 cd src && $(MAKE) LUA=$(LUA) 53 cd src && $(MAKE) LUA=$(LUA)
54 @echo ========== $(_TARGET_SO): DONE!
49 55
50$(_UNITTEST_TARGET): $(_TARGET_SO) 56$(_UNITTEST_TARGET): $(_TARGET_SO)
57 @echo =========================================================================================
51 cd unit_tests && $(MAKE) 58 cd unit_tests && $(MAKE)
59 @echo ========== $(_UNITTEST_TARGET): DONE!
52 60
53clean: 61clean:
54 cd src && $(MAKE) clean 62 cd src && $(MAKE) clean
@@ -231,9 +239,9 @@ _perftest:
231# 239#
232# LUA_LIBDIR and LUA_SHAREDIR are used by the .rockspec (don't change the names!) 240# LUA_LIBDIR and LUA_SHAREDIR are used by the .rockspec (don't change the names!)
233# 241#
234DESTDIR=/usr/local 242DESTDIR:=/usr/local
235LUA_LIBDIR=$(DESTDIR)/lib/lua/5.1 243LUA_LIBDIR:=$(DESTDIR)/lib/lua/$(LUA_VERSION)
236LUA_SHAREDIR=$(DESTDIR)/share/lua/5.1 244LUA_SHAREDIR:=$(DESTDIR)/share/lua/$(LUA_VERSION)
237 245
238# 246#
239# AKa 17-Oct: changed to use 'install -m 644' and 'cp -p' 247# AKa 17-Oct: changed to use 'install -m 644' and 'cp -p'
@@ -243,6 +251,10 @@ install: $(_TARGET_SO) src/lanes.lua
243 install -m 644 $(_TARGET_SO) $(LUA_LIBDIR)/lanes 251 install -m 644 $(_TARGET_SO) $(LUA_LIBDIR)/lanes
244 cp -p src/lanes.lua $(LUA_SHAREDIR) 252 cp -p src/lanes.lua $(LUA_SHAREDIR)
245 253
254uninstall:
255 rm $(LUA_LIBDIR)/lanes/core.$(_SO)
256 rm $(LUA_SHAREDIR)/lanes.lua
257
246 258
247#--- Packaging --- 259#--- Packaging ---
248# 260#
@@ -286,5 +298,5 @@ run: $(_TARGET_SO)
286echo: 298echo:
287 @echo $(PROGRAMFILES:C=X) 299 @echo $(PROGRAMFILES:C=X)
288 300
289.PROXY: all clean test require debug _nodemo _notest 301.PHONY: all clean debug gdb rock test require install uninstall _nodemo _notest
290 302