]> git.stg.codes - stg.git/blob - tests/Makefile
Rearranged some headers in sgconfig.
[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/locker.lib/include \
7        -I ../stglibs/scriptexecuter.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           ../projects/stargazer/tariff_impl.cpp \
24           ../projects/stargazer/user_impl.cpp \
25           ../projects/stargazer/user_property.cpp \
26           ../stglibs/conffiles.lib/conffiles.cpp \
27           ../stglibs/common.lib/common.cpp \
28           ../stglibs/logger.lib/logger.cpp \
29           ../stglibs/scriptexecuter.lib/scriptexecuter.cpp
30
31 .PHONY: all clean
32
33 all: $(PROG)
34
35 $(PROG): $(addsuffix .o,$(basename $(SOURCES)))
36         $(CXX) $(LDFLAGS) $^ $(LIBS) -o $@
37
38 clean:
39         rm -f $(addsuffix .o,$(basename $(SOURCES))) $(addsuffix .d,$(SOURCES)) $(PROG)
40
41 ifneq ($(MAKECMDGOALS),distclean)
42 ifneq ($(MAKECMDGOALS),clean)
43 -include $(addsuffix .d,$(SOURCES))
44 endif
45 endif
46
47 %.cpp.d: %.cpp
48         @$(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
49         sed 's,\($*\).o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
50         rm -f $@.$$$$
51
52 %.c.d: %.c
53         @$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
54         sed 's,\($*\).o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
55         rm -f $@.$$$$