]> git.stg.codes - stg.git/blob - projects/sgauthstress/Makefile
A map of ip-to-user replaced with vector of pairs
[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 =  -lstgcrypto \
12            -lstgcommon \
13            -ldotconfpp \
14            -lstgia
15
16 LIBS += $(LIB_THREAD)
17
18 ifeq ($(OS),linux)
19 LIBS += -ldl
20 else
21 LIBS += -lintl \
22         -lc
23 endif
24
25 SEARCH_DIRS = -I $(DIR_INCLUDE)
26
27 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
28
29 CXXFLAGS += -Wall
30 LDFLAGS += -Wl,-E -L$(DIR_LIB) -Wl,-rpath,$(PREFIX)/usr/lib/stg -Wl,-rpath-link,$(DIR_LIB)
31
32 vpath %.so $(DIR_LIB)
33
34 .PHONY: all clean distclean libs plugins
35 all: libs plugins $(PROG) ../../Makefile.conf
36
37 libs:
38         $(MAKE) -C $(DIR_LIBSRC)
39
40 plugins: libs 
41         $(MAKE) -C $(DIR_PLUGINS)
42
43 $(PROG): $(OBJS) libs
44         $(CXX) $(OBJS) $(LDFLAGS) $(LIBS) $(STGLIBS) -o $(PROG)
45
46 clean:
47         rm -f deps $(PROG) *.o *.*~
48         $(MAKE) -C $(DIR_LIBSRC) clean
49         $(MAKE) -C $(DIR_PLUGINS) clean
50
51 distclean: clean
52         rm -f ../../Makefile.conf
53
54 ifneq ($(MAKECMDGOALS),distclean)
55 ifneq ($(MAKECMDGOALS),clean)
56 ifneq ($(MAKECMDGOALS),uninstall)
57 -include deps
58 endif
59 endif
60 endif
61
62 deps:   $(SRCS) ../../Makefile.conf
63         $(MAKE) -C $(DIR_LIBSRC) includes
64         @>deps ;\
65         for file in $(SRCS); do\
66           echo "`$(CC) $(CXXFLAGS) $(SEARCH_DIRS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\
67           echo -e '\t$$(CC) -c $$< $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS)' >> deps ;\
68         done