]> git.stg.codes - stg.git/blob - tests/Makefile
Added functional test framework.
[stg.git] / tests / Makefile
1 INCS = -I . \
2        -I ../include \
3        -I ../stglibs/common.lib/include \
4        -I ../stglibs/conffiles.lib/include \
5        -I ../stglibs/logger.lib/include \
6        -I ../stglibs/scriptexecuter.lib/include \
7        -I ../stglibs/crypto.lib/include \
8        -I ../projects/stargazer
9 DEFS = -DLINUX \
10        -DUSE_ABSTRACT_SETTINGS
11 CFLAGS += -g3 -Wall -W -Wextra $(INCS) $(DEFS)
12 CXXFLAGS += $(CFLAGS)
13 LIBS = -lpthread
14 PROG = tests
15
16 SOURCES = main.cpp \
17           test_raw_ip.cpp \
18           test_admin_conf.cpp \
19           test_tariff.cpp \
20           test_conffiles.cpp \
21           test_fee_charge_rules.cpp \
22           test_reconnect_on_tariff_change.cpp \
23           test_crypto.cpp \
24           test_bfstream.cpp \
25           ../projects/stargazer/tariff_impl.cpp \
26           ../projects/stargazer/user_impl.cpp \
27           ../projects/stargazer/user_property.cpp \
28           ../stglibs/conffiles.lib/conffiles.cpp \
29           ../stglibs/common.lib/common.cpp \
30           ../stglibs/logger.lib/logger.cpp \
31           ../stglibs/scriptexecuter.lib/scriptexecuter.cpp \
32           ../stglibs/crypto.lib/bfstream.cpp \
33           ../stglibs/crypto.lib/blowfish.c
34
35 .PHONY: all clean
36
37 all: $(PROG)
38
39 $(PROG): $(addsuffix .o,$(basename $(SOURCES)))
40         $(CXX) $(LDFLAGS) $^ $(LIBS) -o $@
41
42 clean:
43         rm -f $(addsuffix .o,$(basename $(SOURCES))) $(addsuffix .d,$(SOURCES)) $(PROG)
44
45 ifneq ($(MAKECMDGOALS),distclean)
46 ifneq ($(MAKECMDGOALS),clean)
47 -include $(addsuffix .d,$(SOURCES))
48 endif
49 endif
50
51 %.cpp.d: %.cpp
52         @$(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
53         sed 's,\($*\).o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
54         rm -f $@.$$$$
55
56 %.c.d: %.c
57         @$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
58         sed 's,\($*\).o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
59         rm -f $@.$$$$