-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (65 loc) · 1.93 KB
/
Makefile
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
LUV_TAG=$(shell git describe --tags)
ifdef WITHOUT_AMALG
CMAKE_OPTIONS+= -DWITH_AMALG=OFF
endif
BUILD_MODULE ?= ON
BUILD_SHARED_LIBS ?= OFF
BUILD_STATIC_LIBS ?= OFF
WITH_SHARED_LIBUV ?= OFF
WITH_LUA_ENGINE ?= LuaJIT
LUA_BUILD_TYPE ?= Static
LUA_COMPAT53_DIR ?= deps/lua-compat-5.3
BUILD_DIR ?= build
# options: Release, Debug, RelWithDebInfo, MinSizeRel
BUILD_TYPE ?= RelWithDebInfo
ifeq ($(WITH_LUA_ENGINE), LuaJIT)
LUABIN=$(BUILD_DIR)/luajit
else
LUABIN=$(BUILD_DIR)/lua
endif
CMAKE_OPTIONS += \
-DBUILD_MODULE=$(BUILD_MODULE) \
-DBUILD_SHARED_LIBS=$(BUILD_SHARED_LIBS) \
-DBUILD_STATIC_LIBS=$(BUILD_STATIC_LIBS) \
-DWITH_SHARED_LIBUV=$(WITH_SHARED_LIBUV) \
-DWITH_LUA_ENGINE=$(WITH_LUA_ENGINE) \
-DLUA_BUILD_TYPE=$(LUA_BUILD_TYPE) \
-DLUA_COMPAT53_DIR=$(LUA_COMPAT53_DIR) \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
ifdef INSTALL_PREFIX
CMAKE_OPTIONS += -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX)
endif
ifeq ($(MAKE),mingw32-make)
CMAKE_OPTIONS += -G"MinGW Makefiles"
LUV_EXT ?= .dll
LUV_CP ?= cp -f
endif
LUV_EXT ?= .so
LUV_CP ?= ln -sf
all: luv
deps/libuv/include:
git submodule update --init deps/libuv
deps/luajit/src:
git submodule update --init deps/luajit
deps/lua-compat-5.3/c-api:
git submodule update --init deps/lua-compat-5.3
$(BUILD_DIR)/Makefile: deps/libuv/include deps/luajit/src deps/lua-compat-5.3/c-api
cmake -H. -B$(BUILD_DIR) ${CMAKE_OPTIONS}
luv: $(BUILD_DIR)/Makefile
cmake --build $(BUILD_DIR)
$(LUV_CP) $(BUILD_DIR)/luv$(LUV_EXT) luv$(LUV_EXT)
install: luv
$(MAKE) -C $(BUILD_DIR) install
clean:
rm -rf $(BUILD_DIR) luv$(LUV_EXT)
test: luv
${LUABIN} tests/run.lua
reset:
git submodule update --init --recursive && \
git clean -f -d && \
git checkout .
publish-luarocks:
github-release upload --user luvit --repo luv --tag ${LUV_TAG} \
--file luv-${LUV_TAG}.tar.gz --name luv-${LUV_TAG}.tar.gz
luarocks upload luv-${LUV_TAG}.rockspec --api-key=${LUAROCKS_TOKEN}
# vim: ts=8 sw=8 noet tw=79 fen fdm=marker