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