aboutsummaryrefslogtreecommitdiff
path: root/Shared.makefile
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Shared.makefile (renamed from Shared.mk)59
1 files changed, 30 insertions, 29 deletions
diff --git a/Shared.mk b/Shared.makefile
index f6941e1..492c05d 100644
--- a/Shared.mk
+++ b/Shared.makefile
@@ -1,21 +1,21 @@
1CC= g++ -std=c++20 1CC := g++ -std=c++20
2 2
3# LuaRocks gives 'LIBFLAG' from the outside 3# LuaRocks gives 'LIBFLAG' from the outside
4# 4#
5LIBFLAG=-shared 5LIBFLAG := -shared
6 6
7OPT_FLAGS=-O2 7OPT_FLAGS := -O2
8# -O0 -g 8# -O0 -g
9 9
10ifeq "$(findstring MINGW,$(shell uname -s))" "MINGW" 10ifeq "$(findstring MINGW,$(shell uname -s))" "MINGW"
11 # MinGW MSYS on Windows 11 # MinGW MSYS on Windows
12 # 12 #
13 _SO:=dll 13 _SO := dll
14 _LUAEXT:=.exe 14 _LUAEXT := .exe
15 TIME:=timeit.exe 15 TIME := timeit.exe
16else 16else
17 _SO:=so 17 _SO := so
18 _LUAEXT:= 18 _LUAEXT :=
19endif 19endif
20 20
21ifeq "$(LUAROCKS)" "" 21ifeq "$(LUAROCKS)" ""
@@ -29,42 +29,43 @@ ifeq "$(LUAROCKS)" ""
29 ifeq "$(LUA_DEV)" "" 29 ifeq "$(LUA_DEV)" ""
30 $(warning LUA_DEV not defined - try i.e. 'make LUA_DEV=/c/Program\ Files/Lua/5.1') 30 $(warning LUA_DEV not defined - try i.e. 'make LUA_DEV=/c/Program\ Files/Lua/5.1')
31 # this assumes Lua was built and installed from source and everything is located in default folders (/usr/local/include and /usr/local/bin) 31 # this assumes Lua was built and installed from source and everything is located in default folders (/usr/local/include and /usr/local/bin)
32 LUA_FLAGS:=-I "/usr/local/include" 32 LUA_FLAGS := -I "/usr/local/include"
33 LUA_LIBS:=$(word 1,$(shell which lua54.$(_SO) 2>/dev/null) $(shell which lua53.$(_SO) 2>/dev/null) $(shell which lua52.$(_SO) 2>/dev/null) $(shell which lua51$(_SO) 2>/dev/null)) 33 LUA_LIBS := $(word 1,$(shell which lua54.$(_SO) 2>/dev/null) $(shell which lua53.$(_SO) 2>/dev/null) $(shell which lua52.$(_SO) 2>/dev/null) $(shell which lua51$(_SO) 2>/dev/null))
34 $(info detected LUA_LIBS as $(LUA_LIBS))
34 else 35 else
35 LUA_FLAGS:=-I "$(LUA_DEV)/include" 36 LUA_FLAGS := -I "$(LUA_DEV)/include"
36 LUA_LIBS:="$(LUA_DEV)/lua5.1.dll" -lgcc 37 LUA_LIBS := "$(LUA_DEV)/lua5.1.dll" -lgcc
37 endif 38 endif
38 LIBFLAG=-shared -Wl,-Map,lanes.map 39 LIBFLAG := -shared -Wl,-Map,lanes.map
39 else 40 else
40 # Autodetect LUA_FLAGS and/or LUA_LIBS 41 # Autodetect LUA_FLAGS and/or LUA_LIBS
41 # 42 #
42 ifneq "$(shell which pkg-config)" "" 43 ifneq "$(shell which pkg-config)" ""
43 ifeq "$(shell pkg-config --exists luajit && echo 1)" "1" 44 ifeq "$(shell pkg-config --exists luajit && echo 1)" "1"
44 LUA_FLAGS:=$(shell pkg-config --cflags luajit) 45 LUA_FLAGS := $(shell pkg-config --cflags luajit)
45 LUA_LIBS:=$(shell pkg-config --libs luajit) 46 LUA_LIBS := $(shell pkg-config --libs luajit)
46 # 47 #
47 # Debian: -I/usr/include/luajit-2.0 48 # Debian: -I/usr/include/luajit-2.0
48 # -lluajit-5.1 49 # -lluajit-5.1
49 else 50 else
50 ifeq "$(shell pkg-config --exists lua5.1 && echo 1)" "1" 51 ifeq "$(shell pkg-config --exists lua5.1 && echo 1)" "1"
51 LUA_FLAGS:=$(shell pkg-config --cflags lua5.1) 52 LUA_FLAGS := $(shell pkg-config --cflags lua5.1)
52 LUA_LIBS:=$(shell pkg-config --libs lua5.1) 53 LUA_LIBS := $(shell pkg-config --libs lua5.1)
53 # 54 #
54 # Ubuntu: -I/usr/include/lua5.1 55 # Ubuntu: -I/usr/include/lua5.1
55 # -llua5.1 56 # -llua5.1
56 else 57 else
57 ifeq "$(shell pkg-config --exists lua && echo 1)" "1" 58 ifeq "$(shell pkg-config --exists lua && echo 1)" "1"
58 LUA_FLAGS:=$(shell pkg-config --cflags lua) 59 LUA_FLAGS := $(shell pkg-config --cflags lua)
59 LUA_LIBS:=$(shell pkg-config --libs lua) 60 LUA_LIBS := $(shell pkg-config --libs lua)
60 # 61 #
61 # OS X fink with pkg-config: 62 # OS X fink with pkg-config:
62 # -I/sw/include 63 # -I/sw/include
63 # -L/sw/lib -llua -lm 64 # -L/sw/lib -llua -lm
64 else 65 else
65 $(warning *** 'pkg-config' existed but did not know of 'lua[5.1]' - Good luck!) 66 $(warning *** 'pkg-config' existed but did not know of 'lua[5.1]' - Good luck!)
66 LUA_FLAGS:= 67 LUA_FLAGS :=
67 LUA_LIBS:=-llua 68 LUA_LIBS := -llua
68 endif 69 endif
69 endif 70 endif
70 endif 71 endif
@@ -73,12 +74,12 @@ ifeq "$(LUAROCKS)" ""
73 # 74 #
74 ifeq "$(shell uname -s)" "Darwin" 75 ifeq "$(shell uname -s)" "Darwin"
75 $(warning *** Assuming 'fink' at default path) 76 $(warning *** Assuming 'fink' at default path)
76 LUA_FLAGS:=-I/sw/include 77 LUA_FLAGS := -I/sw/include
77 LUA_LIBS:=-L/sw/lib -llua 78 LUA_LIBS := -L/sw/lib -llua
78 else 79 else
79 $(warning *** Assuming an arbitrary Lua installation; try installing 'pkg-config') 80 $(warning *** Assuming an arbitrary Lua installation; try installing 'pkg-config')
80 LUA_FLAGS:= 81 LUA_FLAGS :=
81 LUA_LIBS:=-llua 82 LUA_LIBS := -llua
82 endif 83 endif
83 endif 84 endif
84 endif 85 endif
@@ -87,12 +88,12 @@ ifeq "$(LUAROCKS)" ""
87 # Some machines need 'MACOSX_DEPLOYMENT_TARGET=10.3' for using '-undefined dynamic_lookup' 88 # Some machines need 'MACOSX_DEPLOYMENT_TARGET=10.3' for using '-undefined dynamic_lookup'
88 # (at least PowerPC running 10.4.11); does not harm the others 89 # (at least PowerPC running 10.4.11); does not harm the others
89 # 90 #
90 CC = MACOSX_DEPLOYMENT_TARGET=10.3 gcc 91 CC := MACOSX_DEPLOYMENT_TARGET=10.3 gcc
91 LIBFLAG = -bundle -undefined dynamic_lookup 92 LIBFLAG := -bundle -undefined dynamic_lookup
92 endif 93 endif
93 94
94 CFLAGS=-Wall -Werror $(OPT_FLAGS) $(LUA_FLAGS) 95 CFLAGS := -Wall -Werror $(OPT_FLAGS) $(LUA_FLAGS)
95 LIBS=$(LUA_LIBS) 96 LIBS :=
96endif 97endif
97 98
98#--- 99#---