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