]> git.stg.codes - stg.git/blob - projects/sgauthstress/Makefile
Ticket 37. In the TariffChangeIsAllowed() function return "" added and
[stg.git] / projects / sgauthstress / Makefile
1 include ../../Makefile.conf
2
3 PROG = sgauthstress
4
5 SRCS = main.cpp \
6        settings.cpp \
7        store_loader.cpp \
8        user.cpp \
9        proto.cpp
10
11 STGLIBS = dotconfpp \
12           crypto \
13           common
14
15 STGLIBS_INCS = $(addprefix -I ../../stglibs/,$(addsuffix .lib/include,$(STGLIBS)))
16 STGLIBS_LIBS = $(addprefix -L ../../stglibs/,$(addsuffix .lib,$(STGLIBS)))
17
18 LIBS += $(addprefix -lstg,$(STGLIBS)) $(LIB_THREAD) $(LIBICONV)
19
20 ifeq ($(OS),linux)
21 LIBS += -ldl
22 else
23 LIBS += -lintl \
24         -lc
25 endif
26
27 SEARCH_DIRS = -I ../../include
28
29 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
30
31 CXXFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
32 CFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
33 LDFLAGS += -Wl,-E $(STGLIBS_LIBS)
34
35 .PHONY: all clean distclean libs plugins
36 all: libs plugins $(PROG) ../../Makefile.conf
37
38 libs:
39         $(MAKE) -C $(DIR_LIBSRC)
40
41 plugins: libs
42         $(MAKE) -C $(DIR_PLUGINS)
43
44 $(PROG): $(OBJS)
45         $(CXX) $^ $(LDFLAGS) $(LIBS) -o $(PROG)
46
47 clean:
48         rm -f deps $(PROG) *.o *.*~
49         $(MAKE) -C $(DIR_LIBSRC) clean
50         $(MAKE) -C $(DIR_PLUGINS) clean
51
52 distclean: clean
53         rm -f ../../Makefile.conf
54
55 ifneq ($(MAKECMDGOALS),distclean)
56 ifneq ($(MAKECMDGOALS),clean)
57 ifneq ($(MAKECMDGOALS),uninstall)
58 -include deps
59 endif
60 endif
61 endif
62
63 deps:   $(SRCS) ../../Makefile.conf
64         $(MAKE) -C $(DIR_LIBSRC)
65         @>deps ;\
66         for file in $(SRCS); do\
67           echo "$$file" | grep ".c$$" > /dev/null;\
68           if [ $$? -eq 0 ];\
69           then\
70             echo "`$(CC) $(CFLAGS) -MM $$file` Makefile" >> deps ;\
71             printf '%b\n' '\t$$(CC) $(CFLAGS) -c $$<' >> deps ;\
72           else\
73             echo "`$(CXX) $(CXXFLAGS) -MM $$file` Makefile" >> deps ;\
74             printf '%b\n' '\t$$(CXX) $(CXXFLAGS) -c $$<' >> deps ;\
75           fi;\
76         done