]> git.stg.codes - stg.git/blob - tests/Makefile
Another way of splitting c- and cpp- files
[stg.git] / tests / Makefile
1 CFLAGS += -g3 -Wall -W -Wextra -DLINUX -I../include -I../projects/stargazer -I../stglibs/stgconffiles.lib -I. -DUSE_ABSTRACT_SETTINGS -DLINUX
2 CXXFLAGS = ${CFLAGS}
3 LIBS = -lpthread
4 PROG = tests
5
6 SOURCES = main.cpp \
7           test_raw_ip.cpp \
8           test_admin_conf.cpp \
9           test_tariff.cpp \
10           test_conffiles.cpp \
11           test_fee_charge_rules.cpp \
12           test_reconnect_on_tariff_change.cpp \
13           ../projects/stargazer/tariff_impl.cpp \
14           ../projects/stargazer/user_impl.cpp \
15           ../projects/stargazer/user_property.cpp \
16           ../stglibs/conffiles.lib/conffiles.cpp \
17           ../stglibs/common.lib/common.cpp \
18           ../stglibs/logger.lib/logger.cpp \
19           ../stglibs/scriptexecuter.lib/scriptexecuter.cpp
20
21 .PHONY: all includes clean
22
23 all: includes $(PROG)
24
25 includes:
26         make -C ../stglibs includes
27
28 $(PROG): $(subst .cpp,.o,$(SOURCES))
29         $(CXX) $(LDFLAGS) $^ $(LIBS) -o $@
30
31 clean:
32         rm -f *.o *.d $(PROG)
33
34 ifneq ($(MAKECMDGOALS),distclean)
35 ifneq ($(MAKECMDGOALS),clean)
36 -include $(subst .cpp,.d,$(SOURCES))
37 endif
38 endif
39
40 %.d: %.cpp
41         @$(CC) -MM $(CXXFLAGS) $< > $@.$$$$; \
42         sed 's,\($*\).o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
43         rm -f $@.$$$$