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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
#
# Copyright (c) 2013 No Face Press, LLC
# Copyright (c) 2014-2017 the Civetweb developers
#
# License http://opensource.org/licenses/mit-license.php MIT License
#
ifndef WITH_LUA
$(error WITH_LUA is not defined)
endif
# Lua Default version is 502
WITH_LUA_VERSION ?= 502
LUA_VERSION_KNOWN = 0
# Select src and header according to the Lua version
ifeq ($(WITH_LUA_VERSION), 501)
$(info Lua: Using version 5.1.5)
LUA_DIR = src/third_party/lua-5.1.5/src
LUA_SHARED_LIB_FLAG = -llua5.1
LUA_CFLAGS = -DLUA_VERSION_MAKEFILE=501
LUA_VERSION_KNOWN = 1
endif
ifeq ($(WITH_LUA_VERSION), 502)
$(info Lua: Using version 5.2.4)
LUA_DIR = src/third_party/lua-5.2.4/src
LUA_SHARED_LIB_FLAG = -llua5.2
LUA_CFLAGS = -DLUA_VERSION_MAKEFILE=502
LUA_VERSION_KNOWN = 1
endif
ifeq ($(WITH_LUA_VERSION), 503)
$(info Lua: Using version 5.3.3)
LUA_DIR = src/third_party/lua-5.3.3/src
LUA_SHARED_LIB_FLAG = -llua5.3
LUA_CFLAGS = -DLUA_COMPAT_5_2 -DLUA_VERSION_MAKEFILE=503
LUA_VERSION_KNOWN = 1
endif
ifneq ($(LUA_VERSION_KNOWN), 1)
$(error Lua: Unknwon version - $(WITH_LUA_VERSION))
endif
# Add flags for all Lua versions
LUA_CFLAGS += -I$(LUA_DIR) -DLUA_COMPAT_ALL -DUSE_LUA
ifneq ($(TARGET_OS),WIN32)
LUA_CFLAGS += -DLUA_USE_POSIX -DLUA_USE_DLOPEN
endif
ifdef WITH_LUA_SHARED
LUA_SOURCE_FILES =
$(info Lua: using dynamic linking)
else
LUA_SOURCE_FILES = lapi.c \
lauxlib.c \
lbaselib.c \
lcode.c \
ldblib.c \
ldebug.c \
ldo.c \
ldump.c \
lfunc.c \
lgc.c \
linit.c \
liolib.c \
llex.c \
lmathlib.c \
lmem.c \
loadlib.c \
lobject.c \
lopcodes.c \
loslib.c \
lparser.c \
lstate.c \
lstring.c \
lstrlib.c \
ltable.c \
ltablib.c \
ltm.c \
lundump.c \
lvm.c \
lzio.c
ifeq ($(WITH_LUA_VERSION), 502)
LUA_SOURCE_FILES += lbitlib.c \
lcorolib.c \
lctype.c
endif
ifeq ($(WITH_LUA_VERSION), 503)
LUA_SOURCE_FILES += lbitlib.c \
lcorolib.c \
lctype.c \
lutf8lib.c
endif
$(info Lua: using static library)
endif
LUA_SOURCES = $(addprefix $(LUA_DIR)/, $(LUA_SOURCE_FILES))
LUA_OBJECTS = $(LUA_SOURCES:.c=.o)
OBJECTS += $(LUA_OBJECTS)
CFLAGS += $(LUA_CFLAGS)
SOURCE_DIRS = $(LUA_DIR)
BUILD_DIRS += $(BUILD_DIR)/$(LUA_DIR)
ifneq ($(WITH_LUA_VERSION), 501)
SQLITE_DIR = src/third_party
SQLITE_SOURCE_FILES = sqlite3.c lsqlite3.c
SQLITE_SOURCES = $(addprefix $(SQLITE_DIR)/, $(SQLITE_SOURCE_FILES))
SQLITE_OBJECTS = $(SQLITE_SOURCES:.c=.o)
SQLITE_CFLAGS = -I$(SQLITE_DIR) -DTHREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS
OBJECTS += $(SQLITE_OBJECTS)
CFLAGS += $(SQLITE_CFLAGS)
CFLAGS += -DUSE_LUA_SQLITE3
#SOURCE_DIRS = $(SQLITE_DIR)
endif
LFS_DIR = src/third_party
LFS_SOURCE_FILES = lfs.c
LFS_SOURCES = $(addprefix $(LFS_DIR)/, $(LFS_SOURCE_FILES))
LFS_OBJECTS = $(LFS_SOURCES:.c=.o)
LFS_CFLAGS = -I$(LFS_DIR)
OBJECTS += $(LFS_OBJECTS)
CFLAGS += $(LFS_CFLAGS)
CFLAGS += -DUSE_LUA_FILE_SYSTEM
#SOURCE_DIRS = $(LFS_DIR)
ifneq ($(WITH_LUA_VERSION), 501)
LXML_DIR = src/third_party
LXML_SOURCE_FILES = LuaXML_lib.c
LXML_SOURCES = $(addprefix $(LXML_DIR)/, $(LXML_SOURCE_FILES))
LXML_OBJECTS = $(LXML_SOURCES:.c=.o)
LXML_CFLAGS = -I$(LXML_DIR)
OBJECTS += $(LXML_OBJECTS)
CFLAGS += $(LXML_CFLAGS)
CFLAGS += -DUSE_LUA_LUAXML
#SOURCE_DIRS = $(LXML_DIR)
endif
|