forked from sniperHW/distri.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (57 loc) · 1.88 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
PLAT =
CFLAGS = -O2 -g -Wall -fno-strict-aliasing
LDFLAGS = -lpthread -lrt -lm -lssl -lcrypto
INCLUDE = -IKendyNet/include -Ideps -Ideps/lua-5.3.0/src
DEFINE =
BIN = distrilua
LIB = KendyNet/libkendynet.a deps/hiredis/libhiredis.a deps/http-parser/libhttp_parser.a deps/lua-5.3.0/src/liblua.a
DEPENDENCY = KendyNet/libkendynet.a deps/hiredis/libhiredis.a deps/http-parser/libhttp_parser.a deps/lua-5.3.0/src/liblua.a cjson.so
MAKE =
source = src/luasocket.c\
src/luapacket.c\
src/luaredis.c\
src/luahttp.c\
src/lualog.c\
src/base64/base64.c\
src/base64/lua_base64.c\
src/timeutil.c\
src/listener.c\
src/top.c \
src/luaminheap.c\
src/distri.c
# Platform-specific overrides
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
ifeq ($(uname_S),Linux)
LDFLAGS += -ldl
DEFINE += -D_LINUX
PLAT += linux
source += src/Hook.c src/debug.c
LIB += deps/jemalloc/lib/libjemalloc.a
DEPENDENCY += deps/jemalloc/lib/libjemalloc.a
MAKE += make
endif
ifeq ($(uname_S),FreeBSD)
LDFLAGS += -lexecinfo
DEFINE += -D_BSD
PLAT += bsd
MAKE += gmake
endif
all: $(DEPENDENCY) $(source)
$(CC) $(CFLAGS) -o $(BIN) $(source) $(LIB) $(INCLUDE) $(LDFLAGS) $(DEFINE) -rdynamic
rpcserver:examples/rpc/rpcserver.c examples/rpc/toname.c
$(CC) $(CFLAGS) -o rpcserver examples/rpc/rpcserver.c examples/rpc/toname.c $(LIB) $(INCLUDE) $(LDFLAGS) $(DEFINE) -rdynamic
KendyNet/libkendynet.a:
cd KendyNet;$(MAKE) release
deps/jemalloc/lib/libjemalloc.a:
cd deps/jemalloc;./configure;make
deps/hiredis/libhiredis.a:
cd deps/hiredis/;make
deps/http-parser/libhttp_parser.a:
cd deps/http-parser/;make package
deps/lua-5.3.0/src/liblua.a:
cd deps/lua-5.3.0/;make $(PLAT)
cjson.so:
cd deps/lua-cjson-2.1.0;make
mv deps/lua-cjson-2.1.0/cjson.so ./
top:src/testtop.c src/top.c
$(CC) $(CFLAGS) -o top src/testtop.c src/top.c $(LIB) $(INCLUDE) $(LDFLAGS) $(DEFINE) -rdynamic