summarylogtreecommitdiffstats
path: root/Makefile.patch
blob: ed91d6f8026c93a1dad461bb36d998258bc5a833 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- Makefile.dist	2016-07-18 15:28:52.000000000 +0200
+++ Makefile	2017-05-27 17:06:44.630971965 +0200
@@ -5,8 +5,9 @@
 
 # try some automatic discovery
 OS = $(shell uname -s)
-LUAVERSION = $(shell lua -e "print(string.match(_VERSION, '%d+%.%d+'))")
-LUA_BINDIR = $(shell dirname `which lua`)
+LUA = lua5.1
+LUAVERSION = $(shell $(LUA) -e "print(string.match(_VERSION, '%d+%.%d+'))")
+LUA_BINDIR = $(shell dirname `which $(LUA)`)
 LUAROOT = $(shell dirname $(LUA_BINDIR))
 
 # Defaults
@@ -15,9 +16,12 @@
 
 CC = gcc
 CFLAGS = -fPIC -Wall $(DEBUG)
+ifeq ($(LUA),lua)
 LUA_INCDIR = $(LUAROOT)/include
+else
+LUA_INCDIR = $(LUAROOT)/include/lua$(LUAVERSION)
+endif
 LUA_LIBDIR = $(LUAROOT)/lib
-LUA = lua
 
 # OS specialities
 ifeq ($(OS),Darwin)
@@ -47,7 +51,7 @@
 	cp $(TARGET) $(INST_LIBDIR)
 
 test: all
-	cd samples && LUA_CPATH=../\?.so lua lptytest.lua
+	cd samples && LUA_CPATH=../\?.so $(LUA) lptytest.lua
 
 clean:
 	find . -name "*~" -exec rm {} \;