-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
66 lines (55 loc) · 1.59 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
OS=$(shell uname -s)
PLAT ?= none
LIBS := -lpthread -lm -dl
SHARED := -fPIC --shared
EXPORT := -Wl,-E
ifeq ($(OS), Darwin)
PLAT = macosx
SHARED := -fPIC -dynamiclib -Wl,-undefined,dynamic_lookup
EXPORT :=
endif
ifeq ($(OS), Linux)
PLAT=linux
LIBS += -lrt
endif
SKYNETDIR:=skynet
LUACLIB_DIR:=luaclib
LUAINC:=$(SKYNETDIR)/3rd/lua
CFLAGS = -g -O2 -Wall -I$(LUAINC)
LDFLAGS = $(LIBS)
all: engine go clibs lualibs
engine:
make -C $(SKYNETDIR) $(PLAT)
install $(SKYNETDIR)/3rd/lua/lua .
go:
make -C skynetgo LUAINC=`pwd`/$(LUAINC)
LUACLIBS=pb protobuf skiplist lfs
LUACLIB_TARGET=$(patsubst %, $(LUACLIB_DIR)/%.so, $(LUACLIBS))
lualibs:
install 3rd/tiny-ecs/tiny.lua lualib
clibs: $(LUACLIB_TARGET)
$(LUACLIB_DIR)/pb.so: 3rd/lua-protobuf/pb.c
$(CC) $(CFLAGS) $(SHARED) $^ -o $@ $(LDFLAGS)
install 3rd/lua-protobuf/protoc.lua public/proto
$(LUACLIB_DIR)/protobuf.so: 3rd/pbc/binding/lua53/pbc-lua53.c
$(MAKE) -C 3rd/pbc LUA_INCLUDE_DIR=$(LUAINC)
$(CC) $(CFLAGS) $(SHARED) -o $@ -I3rd/pbc -I$(LUAINC) -L3rd/pbc/build -lpbc
$(LUACLIB_DIR)/skiplist.so: 3rd/lua-zset/*.c
$(CC) $(CFLAGS) $(SHARED) -o $@ $^ -I$(LUAINC)
install 3rd/lua-zset/zset.lua lualib
$(LUACLIB_DIR)/lfs.so: 3rd/luafilesystem/src/lfs.c
MACOSX_DEPLOYMENT_TARGET=$(MACOSX_DEPLOYMENT_TARGET)
export MACOSX_DEPLOYMENT_TARGET
$(CC) $(CFLAGS) $(SHARED) -o $@ $^ -I$(LUAINC)
clean:
make -C 3rd/pbc clean
make -C $(SKYNETDIR) clean
rm -f $(LUACLIB_TARGET)
rm -f lualib/zset.lua
rm -f lualib/ecs.lua
cleanall: clean
make -C $(SKYNETDIR) cleanall
testzset:
lua -l env 3rd/lua-zset/test.lua
lua -l env 3rd/lua-zset/test_sl.lua
test: testzset