Browse code

app_lua: Makefile - check cross compile for luajit

- a few updates for compile flags ordering

Daniel-Constantin Mierla authored on 24/01/2022 12:45:32
Showing 1 changed files
... ...
@@ -17,6 +17,7 @@ ifeq ($(LUAJIT),)
17 17
 			BUILDER = $(shell which pkg-config)
18 18
 		endif
19 19
 		ifeq ($(BUILDER),)
20
+			# no pkg-config - try finding by path
20 21
 			ifneq ($(shell ls $(LOCALBASE)/lib/liblua* | grep liblua5.1),)
21 22
 				LUALIB=lua5.1
22 23
 			else ifneq ($(shell ls $(LOCALBASE)/lib/liblua* | grep liblua5.2),)
... ...
@@ -26,7 +27,7 @@ ifeq ($(LUAJIT),)
26 27
 			else ifneq ($(shell ls $(LOCALBASE)/lib/liblua* | grep liblua5.4),)
27 28
 				LUALIB=lua5.4
28 29
 			endif
29
-			DEFS+= -I$(LOCALBASE)/include -DLUA_COMPAT_MODULE -I$(LOCALBASE)/include/$(LUALIB)
30
+			DEFS+= -DLUA_COMPAT_MODULE -I$(LOCALBASE)/include -I$(LOCALBASE)/include/$(LUALIB)
30 31
 			LIBS+= -L$(LOCALBASE)/lib -l$(LUALIB) -lm
31 32
 		else
32 33
 			ifneq ($(shell pkg-config --silence-errors --libs lua-5.1),)
... ...
@@ -52,6 +53,7 @@ ifeq ($(LUAJIT),)
52 53
 				DEFS+= $(shell pkg-config --cflags $(LUALIB))
53 54
 				LIBS = $(shell pkg-config --libs $(LUALIB))
54 55
 			else
56
+				# pkg-config with no lua library detected - try finding by path
55 57
 				LUALIB=lua
56 58
 				ifneq ($(shell ls $(LOCALBASE)/lib/liblua* | grep liblua5.1),)
57 59
 					LUALIB=lua5.1
... ...
@@ -62,7 +64,7 @@ ifeq ($(LUAJIT),)
62 64
 				else ifneq ($(shell ls $(LOCALBASE)/lib/liblua* | grep liblua5.4),)
63 65
 					LUALIB=lua5.4
64 66
 				endif
65
-				DEFS+= -I$(LOCALBASE)/include -DLUA_COMPAT_MODULE -I$(LOCALBASE)/include/$(LUALIB)
67
+				DEFS+= -DLUA_COMPAT_MODULE -I$(LOCALBASE)/include -I$(LOCALBASE)/include/$(LUALIB)
66 68
 				LIBS+= -L$(LOCALBASE)/lib -l$(LUALIB) -lm
67 69
 			endif
68 70
 		endif
... ...
@@ -71,8 +73,10 @@ ifeq ($(LUAJIT),)
71 73
 		LIBS = $(shell lua-config --libs)
72 74
 	endif
73 75
 else
74
-	# Build using LuaJIT
75
-	BUILDER = $(shell which pkg-config)
76
+	# build using LuaJIT
77
+	ifeq ($(CROSS_COMPILE),)
78
+		BUILDER = $(shell which pkg-config)
79
+	endif
76 80
 	ifeq ($(BUILDER),)
77 81
 		DEFS+= -I/usr/include/luajit-2.1
78 82
 		LIBS = -lluajit-5.1