-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (51 loc) · 1.98 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
CC = g++
FLAGS = -g -Wall -std=c++11
LDFLAGS = -static-libgcc -static-libstdc++ -pthread -lssl -lcrypto -ldl -lboost_system -lboost_regex
NGINX_DIR = src/nginx-configparser
CLASSES = src/*.cpp
TEST_FLAGS = -std=c++0x -isystem
GTEST_DIR = $(NGINX_DIR)/googletest/googletest
GMOCK_DIR = $(NGINX_DIR)/googletest/googlemock
TEST_ARGS = -pthread -lboost_system
TEST_CLASSES = src/connection_manager.cpp \
src/utils.cpp \
src/parsed_config.cpp \
src/basic_server_config.cpp \
src/request.cpp \
src/response.cpp \
src/echo_handler.cpp \
src/static_handler.cpp \
src/not_found_handler.cpp \
src/request_handler.cpp \
src/status_handler.cpp \
src/proxy_handler.cpp \
src/traffic_monitor.cpp
TEST_IO = tests/*.cpp $(TEST_CLASSES) $(NGINX_DIR)/config_parser.cc $(GTEST_DIR)/src/gtest_main.cc build/libgtest.a -o bin/$@
all: webserver
test: unit-test integration-test
unit-test: gunit webserver
$(CC) $(TEST_FLAGS) $(GTEST_DIR)/include -isystem $(GMOCK_DIR)/include $(TEST_IO) $(TEST_ARGS) $(FLAGS) $(LDFLAGS)
./bin/$@
gunit:
$(CC) $(TEST_FLAGS) $(GTEST_DIR)/include -I${GTEST_DIR} -isystem $(GMOCK_DIR)/include -I${GMOCK_DIR} -c $(GTEST_DIR)/src/gtest-all.cc $(TEST_ARGS)
$(CC) $(TEST_FLAGS) $(GTEST_DIR)/include -I${GTEST_DIR} -isystem $(GMOCK_DIR)/include -I${GMOCK_DIR} -c $(GMOCK_DIR)/src/gmock-all.cc $(TEST_ARGS)
ar -rv build/libgtest.a gtest-all.o gmock-all.o
rm gtest-all.o
rm gmock-all.o
unit-test-coverage: TEST_ARGS += -fprofile-arcs -ftest-coverage
unit-test-coverage: unit-test
gcov -o . -r $(TEST_CLASSES)
integration-test: webserver
python tests/integration_tests.py
integration-test-2-reqs: webserver
python tests/integration_tests.py
integration-test-4-reqs: webserver
python tests/multiple_requests_integration_test.py
integration-proxy-test: webserver
python tests/integration_proxy_tests.py
webserver: $(CLASSES) $(NGINX_DIR)/config_parser.cc
$(CC) -o bin/$@ $^ $(FLAGS) $(LDFLAGS)
clean:
rm -rf *.o *.a *.gcov *.gcda *.gcno
rm -rf build/*
rm -rf bin/*