diff --git a/src/Makefile b/src/Makefile index 61a5176..dcb1090 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,30 +1,31 @@ -TARGETS = zht_c_binding.exe zht_benchmark.exe zht_server.exe +TARGETS = zht_c_binding zht_benchmark zht_server CC = gcc CCFLAGS = -g -LIBFLAGS = -lstdc++ -lrt -lpthread -lm -lc -lprotobuf -lprotobuf-c - +LIBFLAGS = -lstdc++ -lrt -lpthread -lm -lc -lprotobuf +server: zht_server all: $(TARGETS) -zht_c_binding.exe: c_zhtclient_main.o c_zhtclient.o c_zhtclientStd.o cpp_zhtclient.o meta.pb-c.o lru_cache.o meta.pb.o net_util.o novoht.o zht_util.o - $(CC) $(CCFLAGS) -o $@ $^ $(LIBFLAGS) +zht_c_binding: c_zhtclient_main.o c_zhtclient.o c_zhtclientStd.o cpp_zhtclient.o meta.pb-c.o lru_cache.o meta.pb.o net_util.o novoht.o zht_util.o + $(CC) $(CCFLAGS) -o $@ $^ $(LIBFLAGS) -lprotobuf-c -zht_benchmark.exe: benchmark_client.o cpp_zhtclient.o meta.pb-c.o lru_cache.o meta.pb.o net_util.o novoht.o zht_util.o +zht_benchmark: benchmark_client.o cpp_zhtclient.o meta.pb-c.o lru_cache.o meta.pb.o net_util.o novoht.o zht_util.o $(CC) $(CCFLAGS) -o $@ $^ $(LIBFLAGS) -zht_server.exe: server_general.o meta.pb-c.o lru_cache.o meta.pb.o net_util.o novoht.o zht_util.o +zht_server: server_general.o lru_cache.o meta.pb.o net_util.o novoht.o zht_util.o $(CC) $(CCFLAGS) -o $@ $^ $(LIBFLAGS) -%.o: %.c +%.o: %.cpp $(CC) $(CCFLAGS) -c $< $^ $(LIBFLAGS) + c_zhtclient_main.o: c_zhtclient_main.c @@ -49,6 +50,6 @@ zht_util.o: zht_util.cpp clean: rm *.o - rm *.exe + rm $(TARGETS) rm *.gch* - rm *.bin* \ No newline at end of file + rm *.bin* diff --git a/src/net_util.cpp b/src/net_util.cpp index 7673d3c..f29f526 100644 --- a/src/net_util.cpp +++ b/src/net_util.cpp @@ -22,6 +22,8 @@ #include "net_util.h" #include "zht_util.h" +#include + #define SOCKET_ERROR -1 class BdRecvBase; diff --git a/src/novoht.cpp b/src/novoht.cpp index 58ebdf9..5a9323d 100644 --- a/src/novoht.cpp +++ b/src/novoht.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ #include +#include #include #include #include diff --git a/src/zht_util.cpp b/src/zht_util.cpp index 46b7a4c..fb9c83c 100644 --- a/src/zht_util.cpp +++ b/src/zht_util.cpp @@ -26,6 +26,8 @@ # include #include "net_util.h" #include "zht_util.h" + +#include //struct timeval tp; using namespace std;