]> git.stg.codes - stg.git/blob - projects/rlm_stg/Makefile
Full month stats patches added (derived from GTS version)
[stg.git] / projects / rlm_stg / Makefile
1 ###############################################################################
2 # $Id: Makefile,v 1.5 2009/03/03 15:49:34 faust Exp $
3 ###############################################################################
4
5 include ../../Makefile.conf
6
7 LIB_NAME = rlm_stg
8
9 PROG = $(LIB_NAME).so
10
11 SRCS = ./rlm_stg.cpp \
12        ./stg_client.cpp
13
14 STGLIBS = -lstgcommon \
15           -lstgcrypto
16
17 LIBS += $(LIB_THREAD)
18
19 ifeq ($(OS),linux)
20 LIBS += -ldl
21 else
22 LIBS += -lintl \
23         -lc
24 endif
25
26 SEARCH_DIRS = -I $(DIR_INCLUDE)
27
28 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
29
30 CXXFLAGS += -Wall -fPIC -I./ 
31 LDFLAGS += -shared -L$(DIR_LIB) -Wl,-rpath,$(PREFIX)/usr/lib/stg
32
33 vpath %.so $(DIR_LIB)
34
35 .PHONY: all clean distclean libs install uninstall install-bin uninstall-bin
36 all: libs $(PROG) ../../Makefile.conf
37
38 libs:
39         $(MAKE) -C $(DIR_LIBSRC)
40
41 $(PROG): $(OBJS) $(STGLIBS) 
42         $(CC) $^ $(LDFLAGS) -o $(PROG) $(LIBS)
43
44 clean:
45         rm -f deps $(PROG) *.o tags *.*~ .OS
46         rm -f .OS
47         rm -f core*
48         $(MAKE) -C $(DIR_LIBSRC) clean
49
50 distclean: clean
51         rm -f ../../Makefile.conf
52
53 install: install-bin
54
55 install-bin:
56         install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/lib/$(PROG)
57         $(MAKE) -C $(DIR_LIBSRC) install
58
59 uninstall: uninstall-bin
60
61 uninstall-bin:
62         rm -f $(PREFIX)/usr/lib/$(PROG)
63
64 ifneq ($(MAKECMDGOALS),distclean)
65 ifneq ($(MAKECMDGOALS),clean)
66 ifneq ($(MAKECMDGOALS),uninstall)
67 -include deps
68 endif
69 endif
70 endif
71
72 deps:   $(SRCS) ../../Makefile.conf
73         $(MAKE) -C $(DIR_LIBSRC) includes
74         @>deps ;\
75         for file in $(SRCS); do\
76           echo "`$(CC) $(CXXFLAGS) $(SEARCH_DIRS) -MM $$file` Makefile" >> deps ;\
77           echo -e '\t$$(CC) -c $$< $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS)' >> deps ;\
78         done
79
80