-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (59 loc) · 2.54 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
# Author: Corentin Debains
# Email: [email protected]
#
CXX=g++
CC=gcc
CPPFLAGS=-Xlinker -zmuldefs
CFLAGS=-Llib -L/usr/local/lib -Iinc
LFLAGS=-lzht
LFLAGS+=-lstdc++ -lrt -lpthread -lm -lc -lprotobuf -lprotobuf-c
PROTOBUF_HOME=/usr/local/include/google/protobuf #your Google Protobuf location here :) (Default is:/usr/local/include/google/protobuf) Additional NOTE: This may be useless if you added PROTOBUF to your LD_LIBRARY_PATH
#SOURCES=$(wildcard src/common/*.cpp)
#OBJECTS=$(SOURCES:.cpp=.o)
OBJECTS=obj/meta.pb.o obj/meta.pb-c.o obj/net_util.o obj/novoht.o obj/zht_util.o obj/lru_cache.o
CFLAGS+=-I$(PROTOBUF_HOME)
.PHONY: clean examples clients
all: library
make bin/server_zht
make examples
library: lib/libzht.a
#Note that the header files (.h) are required to be included by a client that would alread have the static library libzht
#Uncomment the next two copy if you removed the zht_util enormous dependencies or the zht_util dependency in cpp_zhtclient. For now, client have to import all the include folder when compiling.
#cp inc/cpp_zhtclient.h lib/cpp_zhtclient.h
#cp inc/c_zhtclient.h lib/c_zhtclient.h
bin/server_zht:
$(CXX) $(CFLAGS) src/server_general.cpp -o bin/server_zht $(LFLAGS)
examples:
$(CXX) $(CPPFLAGS) $(CFLAGS) examples/benchmark_client.cpp -o examples/benchmark_client $(LFLAGS)
$(CC) $(CFLAGS) examples/c_zhtclient_main.c -o examples/c_zhtclient_main $(LFLAGS)
$(CXX) $(CPPFLAGS) $(CFLAGS) examples/testProtocBuf.cpp -o examples/testProtocBuf $(LFLAGS)
lib/libzht.a: $(OBJECTS) clients
ar rus lib/libzht.a obj/*.o
obj:
mkdir -p obj
clients: src/cpp_zhtclient.cpp src/c_zhtclient.cpp
$(CXX) $(CPPFLAGS) $(CFLAGS) -c src/cpp_zhtclient.cpp -o obj/cpp_zhtclient.o
$(CXX) $(CPPFLAGS) $(CFLAGS) -c src/c_zhtclientStd.cpp -o obj/c_zhtclientStd.o
$(CXX) $(CPPFLAGS) $(CFLAGS) -c src/c_zhtclient.cpp -o obj/c_zhtclient.o
obj/%.o: src/common/%.cpp obj
$(CXX) $(CPPFLAGS) $(CFLAGS) -c src/common/$*.cpp -o obj/$*.o
obj/meta.pb-c.o: src/common/meta.pb-c.c
$(CC) $(CFLAGS) -c src/common/meta.pb-c.c -o obj/meta.pb-c.o
gProto: src/misc/meta.proto
rm src/common/*.pb.cpp inc/*.pb.h
protoc -I=src/misc/ --cpp_out=src/common src/misc/meta.proto
mv src/common/*.h inc/
rename 's/\.cc/.cpp/' src/common/*.cc
gProto-c: src/misc/meta.proto
rm src/common/*.pb-c.c inc/*.pb-c.h
protoc-c -I=src/misc/ --c_out=src/common src/misc/meta.proto
mv src/common/*.h inc/
clean:
rm -rf obj
mrproper: clean
rm -f lib/*.a
rm -f lib/*.h
rm -f bin/server_zht
rm examples/benchmark_client
rm examples/c_zhtclient_main
rm examples/testProtocBuf