]> git.stg.codes - stg.git/blob - projects/traffcounter/Makefile
Make fee charging rules inclusive (2 includes 0 and 3 includes fee)
[stg.git] / projects / traffcounter / Makefile
1 include make.conf
2
3 CFLAGS += -g3 -W -Wall -pedantic
4 CFLAGS += $(DEFINES) -D_BSD_SOURCE
5
6 CXXFLAGS += $(CFLAGS)
7
8 SOURCES=logger.cpp lock.cpp traffcounter.cpp rules.cpp utils.cpp
9 RULES_TESTER_SOURCES=logger.cpp rules.cpp utils.cpp rules_tester.cpp
10 RULES_FINDER_TESTER_SOURCES=logger.cpp lock.cpp rules.cpp rules_finder.cpp utils.cpp rf_tester.cpp
11 TC_TESTER_SOURCES=logger.cpp rules.cpp rules_finder.cpp utils.cpp traffcounter.cpp lock.cpp tc_tester.cpp
12 LIBS=-lpthread
13 PROG=st_core
14
15 .PHONY: all tests clean
16
17 #all: $(PROG)
18 all: tests
19
20 $(PROG): $(subst .cpp,.o,$(SOURCES))
21         $(CXX) $^ $(LDFLAGS) $(LIBS) -o $@
22
23 tests: rules_tester rf_tester tc_tester
24
25 rules_tester: $(subst .cpp,.o,$(RULES_TESTER_SOURCES))
26         $(CXX) $^ $(LDFLAGS) -o $@
27
28 rf_tester: $(subst .cpp,.o,$(RULES_FINDER_TESTER_SOURCES))
29         $(CXX) $^ $(LDFLAGS) -o $@
30
31 tc_tester: $(subst .cpp,.o,$(TC_TESTER_SOURCES))
32         $(CXX) $^ $(LDFLAGS) $(LIBS) -o $@
33
34 clean:
35         rm -f $(PROG) *.o *d rules_tester rf_tester tc_tester gmon.out
36
37 ifneq ($(MAKECMDGOALS),distclean)
38 ifneq ($(MAKECMDGOALS),clean)
39 ifneq ($(MAKECMDGOALS),uninstall)
40 -include $(subst .cpp,.d,$(SOURCES))
41 endif
42 endif
43 endif
44
45 %.d: %.cpp
46         @$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
47             sed 's,\($*\).o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
48             rm -f $@.$$$$