]> git.stg.codes - ssmd.git/blob - tests/Makefile
gssmd -> ssmd.
[ssmd.git] / tests / Makefile
1 DEFS = 
2 INCS = -I../include -I../3rdparty/snmp++/include
3 CXXFLAGS += -W -Wall -Wextra $(INCS) $(DEFS)
4 LIBS = -lpthread \
5        -lssl \
6        -lboost_system \
7        -lboost_program_options \
8        ../3rdparty/snmp++/libsnmp++.a
9
10 SOURCES1 = test_switch.cpp \
11            ../src/settings.cpp \
12            ../src/settingsfileparser.cpp \
13            ../src/logger.cpp \
14            ../src/subscriber.cpp \
15            ../src/switch.cpp \
16            ../src/acl.cpp \
17            ../src/snmptable.cpp
18
19 SOURCES2 = test_data_parser.cpp \
20            ../src/logger.cpp \
21            ../src/dataparser.cpp
22
23 .PHONY: all clean snmplib tests
24
25 all: tests
26
27 tests: test_switch test_data_parser
28
29 snmplib:
30         $(MAKE) all -C ../3rdparty
31
32 test_switch: $(subst .cpp,.o,$(SOURCES1)) snmplib
33         $(CXX) $(subst .cpp,.o,$(SOURCES1)) $(LIBS) -o $@
34
35 test_data_parser: $(subst .cpp,.o,$(SOURCES2))
36         $(CXX) $(subst .cpp,.o,$(SOURCES2)) $(LIBS) -o $@
37
38 clean: snmplib
39         rm -f *.o *.d test_switch test_data_parser
40
41 ifneq ($(MAKECMDGOALS),distclean)
42 ifneq ($(MAKECMDGOALS),clean)
43 -include $(subst .cpp,.d,$(SOURCES))
44 endif
45 endif
46
47 %.d: %.cpp
48         @$(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
49         sed 's,\($*\).o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
50         rm -f $@.$$$$