@@ -2,9 +2,13 @@ include config.mk
22include Makefile.vars
33
44MAKEF =$(MAKE ) -f Makefile.in
5- ALL_SRCDIRS =. base ssl event util cpputil evpp protocol http http/client http/server
5+ ALL_SRCDIRS =. base ssl event event/kcp util cpputil evpp protocol http http/client http/server
6+ CORE_SRCDIRS =. base ssl event
7+ ifeq ($(WITH_KCP ) , yes)
8+ CORE_SRCDIRS += event/kcp
9+ endif
610
7- LIBHV_SRCDIRS = . base ssl event util
11+ LIBHV_SRCDIRS = $( CORE_SRCDIRS ) util
812LIBHV_HEADERS = hv.h hconfig.h hexport.h
913LIBHV_HEADERS += $(BASE_HEADERS ) $(SSL_HEADERS ) $(EVENT_HEADERS ) $(UTIL_HEADERS )
1014
@@ -75,96 +79,97 @@ hmain_test: prepare
7579$(MAKEF ) TARGET=$@ SRCDIRS=" . base cpputil" SRCS=" examples/hmain_test.cpp"
7680
7781htimer_test : prepare
78- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/htimer_test.c"
82+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/htimer_test.c"
7983
8084hloop_test : prepare
81- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/hloop_test.c"
85+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/hloop_test.c"
8286
8387tcp_echo_server : prepare
84- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/tcp_echo_server.c"
88+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/tcp_echo_server.c"
8589
8690tcp_chat_server : prepare
87- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/tcp_chat_server.c"
91+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/tcp_chat_server.c"
8892
8993tcp_proxy_server : prepare
90- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/tcp_proxy_server.c"
94+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/tcp_proxy_server.c"
9195
9296udp_echo_server : prepare
93- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/udp_echo_server.c"
97+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/udp_echo_server.c"
9498
9599udp_proxy_server : prepare
96- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/udp_proxy_server.c"
100+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/udp_proxy_server.c"
97101
98102multi-acceptor-processes : prepare
99- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/multi-thread/multi-acceptor-processes.c"
103+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/multi-thread/multi-acceptor-processes.c"
100104
101105multi-acceptor-threads : prepare
102- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/multi-thread/multi-acceptor-threads.c"
106+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/multi-thread/multi-acceptor-threads.c"
103107
104108one-acceptor-multi-workers : prepare
105- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/multi-thread/one-acceptor-multi-workers.c"
109+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/multi-thread/one-acceptor-multi-workers.c"
106110
107111nc : prepare
108- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/nc.c"
112+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/nc.c"
109113
110114nmap : prepare
111- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event cpputil examples/nmap" DEFINES=" PRINT_DEBUG"
115+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) cpputil examples/nmap" DEFINES=" PRINT_DEBUG"
112116
113117wrk : prepare
114- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event util cpputil evpp http" SRCS=" examples/wrk.cpp"
118+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) util cpputil evpp http" SRCS=" examples/wrk.cpp"
115119
116120httpd : prepare
117121$(RM ) examples/httpd/* .o
118- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event util cpputil evpp http http/client http/server examples/httpd"
122+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) util cpputil evpp http http/client http/server examples/httpd"
119123
120124consul : prepare
121- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event util cpputil evpp http http/client examples/consul" DEFINES=" PRINT_DEBUG"
125+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) util cpputil evpp http http/client examples/consul" DEFINES=" PRINT_DEBUG"
122126
123127curl : prepare
124- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event util cpputil evpp http http/client" SRCS=" examples/curl.cpp"
125- # $(MAKEF) TARGET=$@ SRCDIRS=". base ssl event util cpputil evpp http http/client" SRCS="examples/curl.cpp" WITH_CURL=yes
128+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) util cpputil evpp http http/client" SRCS=" examples/curl.cpp"
129+ # $(MAKEF) TARGET=$@ SRCDIRS="$(CORE_SRCDIRS) util cpputil evpp http http/client" SRCS="examples/curl.cpp" WITH_CURL=yes
126130
127131wget : prepare
128- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event util cpputil evpp http http/client" SRCS=" examples/wget.cpp"
132+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) util cpputil evpp http http/client" SRCS=" examples/wget.cpp"
129133
130134http_server_test : prepare
131- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event util cpputil evpp http http/server" SRCS=" examples/http_server_test.cpp"
135+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) util cpputil evpp http http/server" SRCS=" examples/http_server_test.cpp"
132136
133137http_client_test : prepare
134- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event util cpputil evpp http http/client" SRCS=" examples/http_client_test.cpp"
138+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) util cpputil evpp http http/client" SRCS=" examples/http_client_test.cpp"
135139
136140websocket_server_test : prepare
137- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event util cpputil evpp http http/server" SRCS=" examples/websocket_server_test.cpp"
141+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) util cpputil evpp http http/server" SRCS=" examples/websocket_server_test.cpp"
138142
139143websocket_client_test : prepare
140- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event util cpputil evpp http http/client" SRCS=" examples/websocket_client_test.cpp"
144+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) util cpputil evpp http http/client" SRCS=" examples/websocket_client_test.cpp"
141145
142146jsonrpc : jsonrpc_client jsonrpc_server
143147
144148jsonrpc_client : prepare
145- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/jsonrpc/jsonrpc_client.c examples/jsonrpc/jsonrpc.c examples/jsonrpc/cJSON.c"
149+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/jsonrpc/jsonrpc_client.c examples/jsonrpc/jsonrpc.c examples/jsonrpc/cJSON.c"
146150
147151jsonrpc_server : prepare
148152$(RM ) examples/jsonrpc/* .o
149- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event " SRCS=" examples/jsonrpc/jsonrpc_server.c examples/jsonrpc/jsonrpc.c examples/jsonrpc/cJSON.c"
153+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) " SRCS=" examples/jsonrpc/jsonrpc_server.c examples/jsonrpc/jsonrpc.c examples/jsonrpc/cJSON.c"
150154
151155protorpc : protorpc_client protorpc_server
152156
153157protorpc_protoc :
154158bash examples/protorpc/proto/protoc.sh
155159
156160protorpc_client : prepare protorpc_protoc
157- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event cpputil evpp examples/protorpc/generated" \
161+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) cpputil evpp examples/protorpc/generated" \
158162SRCS=" examples/protorpc/protorpc_client.cpp examples/protorpc/protorpc.c" \
159163LIBS=" protobuf"
160164
161165protorpc_server : prepare protorpc_protoc
162166$(RM ) examples/protorpc/* .o
163- $(MAKEF ) TARGET=$@ SRCDIRS=" . base ssl event cpputil evpp examples/protorpc/generated" \
167+ $(MAKEF ) TARGET=$@ SRCDIRS=" $( CORE_SRCDIRS ) cpputil evpp examples/protorpc/generated" \
164168SRCS=" examples/protorpc/protorpc_server.cpp examples/protorpc/protorpc.c" \
165169LIBS=" protobuf"
166170
167171unittest : prepare
172+ $(CC ) -g -Wall -O0 -std=c99 -I. -Ibase -o bin/rbtree_test unittest/rbtree_test.c base/rbtree.c
168173$(CC ) -g -Wall -O0 -std=c99 -I. -Ibase -o bin/mkdir_p unittest/mkdir_test.c base/hbase.c
169174$(CC ) -g -Wall -O0 -std=c99 -I. -Ibase -o bin/rmdir_p unittest/rmdir_test.c base/hbase.c
170175$(CC ) -g -Wall -O0 -std=c99 -I. -Ibase -o bin/date unittest/date_test.c base/htime.c
0 commit comments