-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathMakefile
83 lines (57 loc) · 2.16 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
80
81
82
83
UNAME_S := $(shell uname -s)
CXX = g++-4.8
PROGS = ddosdetector
CLEANFILES = $(PROGS) *.o
LDFLAGS = -lboost_system -lboost_thread -llog4cpp -lboost_program_options -lcurl
CPPFLAGS = -std=c++11 -Wall #-O2
CPPFLAGS += -I ./sys -I ./proto
TESTS_LDFLAGS = -lgtest_main -lgtest $(LDFLAGS)
TESTS_CPPFILES = $(wildcard ./test/*.cpp)
TESTS_BIN = $(TESTS_CPPFILES:.cpp=)
TESTS_RUN = $(TESTS_CPPFILES:.cpp=.run)
all: $(PROGS)
ddosdetector: exceptions.o functions.o collector.o parser.o action.o influxdb.o controld.o baserule.o ip.o tcp.o udp.o icmp.o rules.o ddosdetector.o
$(CXX) $(CPPFLAGS) $^ -o $@ $(LDFLAGS)
exceptions.o: exceptions.cpp
$(CXX) $(CPPFLAGS) -c exceptions.cpp -o exceptions.o $(LDFLAGS)
collector.o: collector.cpp
$(CXX) $(CPPFLAGS) -c collector.cpp -o collector.o $(LDFLAGS)
rules.o: rules.cpp
$(CXX) $(CPPFLAGS) -c rules.cpp -o rules.o $(LDFLAGS)
parser.o: parser.cpp
$(CXX) $(CPPFLAGS) -c parser.cpp -o parser.o $(LDFLAGS)
controld.o: controld.cpp
$(CXX) $(CPPFLAGS) -c controld.cpp -o controld.o $(LDFLAGS)
functions.o: functions.cpp
$(CXX) $(CPPFLAGS) -c functions.cpp -o functions.o $(LDFLAGS)
action.o: action.cpp
$(CXX) $(CPPFLAGS) -c action.cpp -o action.o $(LDFLAGS)
influxdb.o: influxdb.cpp
$(CXX) $(CPPFLAGS) -c influxdb.cpp -o influxdb.o $(LDFLAGS)
tcp.o: proto/tcp.cpp
$(CXX) $(CPPFLAGS) -c proto/tcp.cpp -o tcp.o $(LDFLAGS)
udp.o: proto/udp.cpp
$(CXX) $(CPPFLAGS) -c proto/udp.cpp -o udp.o $(LDFLAGS)
icmp.o: proto/icmp.cpp
$(CXX) $(CPPFLAGS) -c proto/icmp.cpp -o icmp.o $(LDFLAGS)
ip.o: proto/ip.cpp
$(CXX) $(CPPFLAGS) -c proto/ip.cpp -o ip.o $(LDFLAGS)
baserule.o: proto/baserule.cpp
$(CXX) $(CPPFLAGS) -c proto/baserule.cpp -o baserule.o $(LDFLAGS)
clean:
-@rm -rf $(CLEANFILES)
# Testing
test: clean-test build-test run-test
check:
@./test/cppcheck/cppcheck -q -j12 --platform=unix64 -itest --std=c++11 --enable=all --inconclusive --suppressions-list=./test/cppcheck_suppress.cfg ./
build-test: $(TESTS_BIN)
@echo "====> Run tests <===="
%: %.cpp
$(CXX) $(CPPFLAGS) $^ -o $@ $(TESTS_LDFLAGS)
run-test: $(TESTS_RUN)
%.run: %
$^
clean-test:
@echo "====> Clean all test <===="
-@rm -rf $(TESTS_BIN)
@echo "====> Build tests <===="