|
|
@@ -2,17 +2,20 @@ include config.mk
|
|
|
include Makefile.vars
|
|
|
|
|
|
MAKEF=$(MAKE) -f Makefile.in
|
|
|
-ALL_SRCDIRS=. base utils event evpp protocol http http/client http/server consul
|
|
|
+ALL_SRCDIRS=. base util event protocol cpputil evpp http http/client http/server consul
|
|
|
|
|
|
-LIBHV_SRCDIRS = . base utils event evpp
|
|
|
+LIBHV_SRCDIRS = . base util event
|
|
|
LIBHV_HEADERS = hv.h hconfig.h hexport.h
|
|
|
-LIBHV_HEADERS += $(BASE_HEADERS) $(UTILS_HEADERS) $(EVENT_HEADERS) $(EVPP_HEADERS)
|
|
|
+LIBHV_HEADERS += $(BASE_HEADERS) $(UTIL_HEADERS) $(EVENT_HEADERS)
|
|
|
|
|
|
ifeq ($(WITH_PROTOCOL), yes)
|
|
|
LIBHV_HEADERS += $(PROTOCOL_HEADERS)
|
|
|
LIBHV_SRCDIRS += protocol
|
|
|
endif
|
|
|
|
|
|
+ifeq ($(WITH_EVPP), yes)
|
|
|
+LIBHV_HEADERS += $(CPPUTIL_HEADERS) $(EVPP_HEADERS)
|
|
|
+LIBHV_SRCDIRS += cpputil evpp
|
|
|
ifeq ($(WITH_HTTP), yes)
|
|
|
LIBHV_HEADERS += $(HTTP_HEADERS)
|
|
|
LIBHV_SRCDIRS += http
|
|
|
@@ -29,6 +32,7 @@ LIBHV_SRCDIRS += consul
|
|
|
endif
|
|
|
endif
|
|
|
endif
|
|
|
+endif
|
|
|
|
|
|
default: all
|
|
|
all: libhv examples
|
|
|
@@ -46,7 +50,7 @@ examples: hmain_test htimer_test hloop_test \
|
|
|
|
|
|
clean:
|
|
|
$(MAKEF) clean SRCDIRS="$(ALL_SRCDIRS)"
|
|
|
- $(RM) examples/*.o
|
|
|
+ $(RM) examples/*.o examples/httpd/*.o examples/nmap/*.o
|
|
|
$(RM) include/hv
|
|
|
|
|
|
prepare:
|
|
|
@@ -64,7 +68,7 @@ install:
|
|
|
$(CP) lib/libhv.* $(INSTALL_LIBDIR)
|
|
|
|
|
|
hmain_test: prepare
|
|
|
- $(MAKEF) TARGET=$@ SRCDIRS=". base utils" SRCS="examples/hmain_test.cpp"
|
|
|
+ $(MAKEF) TARGET=$@ SRCDIRS=". base cpputil" SRCS="examples/hmain_test.cpp"
|
|
|
|
|
|
htimer_test: prepare
|
|
|
$(MAKEF) TARGET=$@ SRCDIRS=". base event" SRCS="examples/htimer_test.c"
|
|
|
@@ -91,38 +95,32 @@ nc: prepare
|
|
|
$(MAKEF) TARGET=$@ SRCDIRS=". base event" SRCS="examples/nc.c"
|
|
|
|
|
|
nmap: prepare
|
|
|
-ifeq ($(OS), Windows)
|
|
|
- # for nmap on Windows platform, recommand EVENT_POLL, not EVENT_IOCP
|
|
|
- $(MAKEF) TARGET=$@ SRCDIRS=". base event" SRCS="examples/nmap.cpp" DEFINES="PRINT_DEBUG EVENT_POLL"
|
|
|
-else
|
|
|
- $(MAKEF) TARGET=$@ SRCDIRS=". base event" SRCS="examples/nmap.cpp" DEFINES="PRINT_DEBUG"
|
|
|
-endif
|
|
|
+ $(MAKEF) TARGET=$@ SRCDIRS=". base event cpputil examples/nmap" SRCS="examples/nmap/nmap_test.cpp" DEFINES="PRINT_DEBUG"
|
|
|
|
|
|
httpd: prepare
|
|
|
- $(RM) examples/httpd/*.o
|
|
|
- $(MAKEF) TARGET=$@ SRCDIRS=". base utils event evpp http http/server examples/httpd"
|
|
|
+ $(MAKEF) TARGET=$@ SRCDIRS=". base event util cpputil evpp http http/server examples/httpd"
|
|
|
|
|
|
curl: prepare
|
|
|
- $(MAKEF) TARGET=$@ SRCDIRS=". base utils event evpp http http/client" SRCS="examples/curl.cpp"
|
|
|
- # $(MAKEF) TARGET=$@ SRCDIRS=". base utils event http http/client" SRCS="examples/curl.cpp" WITH_CURL=yes DEFINES="CURL_STATICLIB"
|
|
|
+ $(MAKEF) TARGET=$@ SRCDIRS=". base event util cpputil evpp http http/client" SRCS="examples/curl.cpp"
|
|
|
+ # $(MAKEF) TARGET=$@ SRCDIRS=". base event util cpputil evpp http http/client" SRCS="examples/curl.cpp" WITH_CURL=yes
|
|
|
|
|
|
wget: prepare
|
|
|
- $(MAKEF) TARGET=$@ SRCDIRS=". base utils event evpp http http/client" SRCS="examples/wget.cpp"
|
|
|
+ $(MAKEF) TARGET=$@ SRCDIRS=". base event util cpputil evpp http http/client" SRCS="examples/wget.cpp"
|
|
|
|
|
|
http_server_test: prepare
|
|
|
- $(MAKEF) TARGET=$@ SRCDIRS=". base utils event evpp http http/server" SRCS="examples/http_server_test.cpp"
|
|
|
+ $(MAKEF) TARGET=$@ SRCDIRS=". base event util cpputil evpp http http/server" SRCS="examples/http_server_test.cpp"
|
|
|
|
|
|
http_client_test: prepare
|
|
|
- $(MAKEF) TARGET=$@ SRCDIRS=". base utils event evpp http http/client" SRCS="examples/http_client_test.cpp"
|
|
|
+ $(MAKEF) TARGET=$@ SRCDIRS=". base event util cpputil evpp http http/client" SRCS="examples/http_client_test.cpp"
|
|
|
|
|
|
websocket_server_test: prepare
|
|
|
- $(MAKEF) TARGET=$@ SRCDIRS=". base utils event evpp http http/server" SRCS="examples/websocket_server_test.cpp"
|
|
|
+ $(MAKEF) TARGET=$@ SRCDIRS=". base event util cpputil evpp http http/server" SRCS="examples/websocket_server_test.cpp"
|
|
|
|
|
|
websocket_client_test: prepare
|
|
|
- $(MAKEF) TARGET=$@ SRCDIRS=". base utils event evpp http http/client" SRCS="examples/websocket_client_test.cpp"
|
|
|
+ $(MAKEF) TARGET=$@ SRCDIRS=". base event util cpputil evpp http http/client" SRCS="examples/websocket_client_test.cpp"
|
|
|
|
|
|
consul_cli: prepare
|
|
|
- $(MAKEF) TARGET=$@ SRCDIRS=". base utils event evpp http http/client consul" SRCS="examples/consul_cli.cpp" DEFINES="PRINT_DEBUG"
|
|
|
+ $(MAKEF) TARGET=$@ SRCDIRS=". base event util cpputil evpp http http/client consul" SRCS="examples/consul_cli.cpp" DEFINES="PRINT_DEBUG"
|
|
|
|
|
|
unittest: prepare
|
|
|
$(CC) -g -Wall -O0 -std=c99 -I. -Ibase -o bin/mkdir_p unittest/mkdir_test.c base/hbase.c
|
|
|
@@ -134,26 +132,26 @@ unittest: prepare
|
|
|
$(CC) -g -Wall -O0 -std=c99 -I. -Ibase -o bin/hmutex_test unittest/hmutex_test.c base/htime.c -pthread
|
|
|
$(CC) -g -Wall -O0 -std=c99 -I. -Ibase -o bin/connect_test unittest/connect_test.c base/hsocket.c base/htime.c
|
|
|
$(CC) -g -Wall -O0 -std=c99 -I. -Ibase -o bin/socketpair_test unittest/socketpair_test.c base/hsocket.c
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -o bin/defer_test unittest/defer_test.cpp
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -o bin/synchronized_test unittest/synchronized_test.cpp -pthread
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -o bin/hstring_test unittest/hstring_test.cpp base/hstring.cpp
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -o bin/threadpool_test unittest/threadpool_test.cpp -pthread
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -o bin/objectpool_test unittest/objectpool_test.cpp -pthread
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -o bin/ls unittest/listdir_test.cpp base/hdir.cpp
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -o bin/ifconfig unittest/ifconfig_test.cpp base/ifconfig.cpp
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Icpputil -o bin/hstring_test unittest/hstring_test.cpp cpputil/hstring.cpp
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Icpputil -o bin/ls unittest/listdir_test.cpp cpputil/hdir.cpp
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Icpputil -o bin/ifconfig unittest/ifconfig_test.cpp cpputil/ifconfig.cpp
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Icpputil -o bin/defer_test unittest/defer_test.cpp
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Icpputil -o bin/synchronized_test unittest/synchronized_test.cpp -pthread
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Icpputil -o bin/threadpool_test unittest/threadpool_test.cpp -pthread
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Icpputil -o bin/objectpool_test unittest/objectpool_test.cpp -pthread
|
|
|
$(CC) -g -Wall -O0 -std=c99 -I. -Ibase -Iprotocol -o bin/nslookup unittest/nslookup_test.c protocol/dns.c
|
|
|
$(CC) -g -Wall -O0 -std=c99 -I. -Ibase -Iprotocol -o bin/ping unittest/ping_test.c protocol/icmp.c base/hsocket.c base/htime.c -DPRINT_DEBUG
|
|
|
$(CC) -g -Wall -O0 -std=c99 -I. -Ibase -Iprotocol -o bin/ftp unittest/ftp_test.c protocol/ftp.c base/hsocket.c
|
|
|
- $(CC) -g -Wall -O0 -std=c99 -I. -Ibase -Iutils -Iprotocol -o bin/sendmail unittest/sendmail_test.c protocol/smtp.c base/hsocket.c utils/base64.c
|
|
|
+ $(CC) -g -Wall -O0 -std=c99 -I. -Ibase -Iprotocol -Iutil -o bin/sendmail unittest/sendmail_test.c protocol/smtp.c base/hsocket.c util/base64.c
|
|
|
|
|
|
evpp: prepare libhv
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Ievpp -o bin/EventLoop_test evpp/EventLoop_test.cpp -Llib -lhv -lpthread
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Ievpp -o bin/EventLoopThread_test evpp/EventLoopThread_test.cpp -Llib -lhv -lpthread
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Ievpp -o bin/EventLoopThreadPool_test evpp/EventLoopThreadPool_test.cpp -Llib -lhv -lpthread
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Ievpp -o bin/TcpServer_test evpp/TcpServer_test.cpp -Llib -lhv -lpthread
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Ievpp -o bin/TcpClient_test evpp/TcpClient_test.cpp -Llib -lhv -lpthread
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Ievpp -o bin/UdpServer_test evpp/UdpServer_test.cpp -Llib -lhv -lpthread
|
|
|
- $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Ievpp -o bin/UdpClient_test evpp/UdpClient_test.cpp -Llib -lhv -lpthread
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Icpputil -Ievpp -o bin/EventLoop_test evpp/EventLoop_test.cpp -Llib -lhv -lpthread
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Icpputil -Ievpp -o bin/EventLoopThread_test evpp/EventLoopThread_test.cpp -Llib -lhv -lpthread
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Icpputil -Ievpp -o bin/EventLoopThreadPool_test evpp/EventLoopThreadPool_test.cpp -Llib -lhv -lpthread
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Icpputil -Ievpp -o bin/TcpServer_test evpp/TcpServer_test.cpp -Llib -lhv -lpthread
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Icpputil -Ievpp -o bin/TcpClient_test evpp/TcpClient_test.cpp -Llib -lhv -lpthread
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Icpputil -Ievpp -o bin/UdpServer_test evpp/UdpServer_test.cpp -Llib -lhv -lpthread
|
|
|
+ $(CXX) -g -Wall -O0 -std=c++11 -I. -Ibase -Ievent -Icpputil -Ievpp -o bin/UdpClient_test evpp/UdpClient_test.cpp -Llib -lhv -lpthread
|
|
|
|
|
|
# UNIX only
|
|
|
webbench: prepare
|
|
|
@@ -169,4 +167,4 @@ echo-servers:
|
|
|
$(CXX) -g -Wall -std=c++11 -o bin/poco_echo echo-servers/poco_echo.cpp -lPocoNet -lPocoUtil -lPocoFoundation
|
|
|
# $(CXX) -g -Wall -std=c++11 -o bin/muduo_echo echo-servers/muduo_echo.cpp -lmuduo_net -lmuduo_base -lpthread
|
|
|
|
|
|
-.PHONY: clean prepare libhv install examples nc nmap httpd curl wget consul_cli unittest evpp webbench echo-servers
|
|
|
+.PHONY: clean prepare install libhv examples unittest evpp echo-servers
|