]> git.stg.codes - stg.git/blob - projects/sgauthstress/Makefile
Fix projects and plugins building system to support new libs
[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 = crypto \
12           common \
13           dotconfpp \
14           locker
15
16 STGLIBS_INCS = $(addprefix -I ../../stglibs/,$(addsuffix .lib/include,$(STGLIBS)))
17 STGLIBS_LIBS = $(addprefix -L ../../stglibs/,$(addsuffix .lib,$(STGLIBS)))
18
19 LIBS += $(LIB_THREAD) $(addprefix -lstg,$(STGLIBS))
20
21 ifeq ($(OS),linux)
22 LIBS += -ldl
23 else
24 LIBS += -lintl \
25         -lc
26 endif
27
28 SEARCH_DIRS = -I ../../include
29
30 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
31
32 CXXFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
33 CFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
34 LDFLAGS += -Wl,-E $(STGLIBS_LIBS)
35
36 .PHONY: all clean distclean libs plugins
37 all: libs plugins $(PROG) ../../Makefile.conf
38
39 libs:
40         $(MAKE) -C $(DIR_LIBSRC)
41
42 plugins: libs 
43         $(MAKE) -C $(DIR_PLUGINS)
44
45 $(PROG): $(OBJS)
46         $(CXX) $^ $(LDFLAGS) $(LIBS) -o $(PROG)
47
48 clean:
49         rm -f deps $(PROG) *.o *.*~
50         $(MAKE) -C $(DIR_LIBSRC) clean
51         $(MAKE) -C $(DIR_PLUGINS) clean
52
53 distclean: clean
54         rm -f ../../Makefile.conf
55
56 ifneq ($(MAKECMDGOALS),distclean)
57 ifneq ($(MAKECMDGOALS),clean)
58 ifneq ($(MAKECMDGOALS),uninstall)
59 -include deps
60 endif
61 endif
62 endif
63
64 deps:   $(SRCS) ../../Makefile.conf
65         $(MAKE) -C $(DIR_LIBSRC)
66         @>deps ;\
67         for file in $(SRCS); do\
68           echo "`$(CC) $(CXXFLAGS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\
69           echo -e '\t$$(CC) -c $$< $(CXXFLAGS)' >> deps ;\
70         done