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