-
Notifications
You must be signed in to change notification settings - Fork 72
/
Makefile
91 lines (70 loc) · 2.35 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
85
86
87
88
89
90
91
CFLAGS = -g -I./include -I./deps/uv/include -I./deps/jansson/src
LDFLAGS = -L./deps/uv -L./deps/jansson/lib -L. -lm -luv -B static -ljansson -lpomelo -Bdynamic -framework CoreServices
TLDFLAGS = -L. -lm -lpomelo -Bdynamic -framework CoreServices
OBJDIR := out
OBJS += src/client.o
OBJS += src/network.o
OBJS += src/package.o
OBJS += src/pkg-handshake.o
OBJS += src/pkg-heartbeat.o
OBJS += src/map.o
OBJS += src/listener.o
OBJS += src/message.o
OBJS += src/msg-json.o
OBJS += src/msg-pb.o
OBJS += src/common.o
OBJS += src/pb-util.o
OBJS += src/pb-encode.o
OBJS += src/pb-decode.o
OBJS += src/transport.o
OBJS += src/thread.o
OBJS += src/protocol.o
#OBJS += jansson/*.o
OBJS := $(addprefix $(OBJDIR)/,$(OBJS))
all: libpomelo.a
$(OBJDIR)/src/%.o: src/%.c include/pomelo.h \
include/pomelo-protocol/package.h \
include/pomelo-private/map.h \
include/pomelo-private/listener.h \
include/pomelo-private/common.h \
include/pomelo-protobuf/pb.h \
include/pomelo-protobuf/pb-util.h\
include/pomelo-private/transport.h
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/jansson/*.o: deps/jansson/lib/libjansson.a
@mkdir -p $(OBJDIR)/jansson
@cd $(OBJDIR)/jansson; \
$(AR) x ../../deps/jansson/lib/libjansson.a
libpomelo.a: $(OBJS)
$(AR) rcs $@ $^
test: test/test.c libpomelo.a
$(CC) $(CFLAGS) $(LDFLAGS) -o test/test test/test.c
connect: test/connect.c libpomelo.a
$(CC) $(CFLAGS) $(LDFLAGS) -o test/connect test/connect.c
client-init: test/client-init.c libpomelo.a
$(CC) $(CFLAGS) $(LDFLAGS) -o test/client-init test/client-init.c
pkg: test/pkg.c libpomelo.a
$(CC) $(CFLAGS) $(LDFLAGS) -o test/pkg test/pkg.c
msg: test/msg.c libpomelo.a
$(CC) $(CFLAGS) $(LDFLAGS) -o test/msg test/msg.c
jtest: test/jtest.c
$(CC) $(CFLAGS) $(LDFLAGS) -o test/jtest test/jtest.c
thread: test/thread.c
$(CC) $(CFLAGS) $(LDFLAGS) -o test/thread test/thread.c
client: test/client.c
$(CC) $(CFLAGS) $(LDFLAGS) -o test/client test/client.c
reconn: test/reconn.c
$(CC) $(CFLAGS) $(LDFLAGS) -o test/reconn test/reconn.c
stop: test/stop.c
$(CC) $(CFLAGS) $(LDFLAGS) -o test/stop test/stop.c
map: test/map.c
$(CC) $(CFLAGS) $(LDFLAGS) -o test/map test/map.c
hashtest: test/hashtest.c
$(CC) $(CFLAGS) $(LDFLAGS) -o test/hashtest test/hashtest.c
run:
./test/connect
clean:
rm out -rf
rm libpomelo.a
.PONY: clean all run touch