]> git.stg.codes - stg.git/blob - projects/rlm_stg/Makefile
Disable installing db structure for Firebird
[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 = crypto \
15           common
16           
17 STGLIBS_INCS = $(addprefix -I ../../stglibs/,$(addsuffix .lib/include,$(STGLIBS)))
18 STGLIBS_LIBS = $(addprefix -L ../../stglibs/,$(addsuffix .lib,$(STGLIBS)))
19
20 LIBS += $(addprefix -lstg,$(STGLIBS)) $(LIB_THREAD)
21
22 ifeq ($(OS),linux)
23 LIBS += -ldl
24 else
25 LIBS += -lintl \
26         -lc \
27         -liconv
28 endif
29
30 SEARCH_DIRS = -I ../../include
31
32 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
33
34 CXXFLAGS += -fPIC $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
35 CFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
36 LDFLAGS += -shared -Wl,-rpath,$(PREFIX)/usr/lib/stg -Wl,-E $(STGLIBS_LIBS)
37
38 .PHONY: all clean distclean libs install uninstall install-bin uninstall-bin
39 all: libs $(PROG) ../../Makefile.conf
40
41 libs:
42         $(MAKE) -C $(DIR_LIBSRC)
43
44 $(PROG): $(OBJS)
45         $(CXX) $^ $(LDFLAGS) -o $(PROG) $(LIBS)
46
47 clean:
48         rm -f deps $(PROG) *.o tags *.*~ .OS
49         rm -f .OS
50         rm -f core*
51         $(MAKE) -C $(DIR_LIBSRC) clean
52
53 distclean: clean
54         rm -f ../../Makefile.conf
55
56 install: install-bin
57
58 install-bin:
59         install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/lib/$(PROG)
60         $(MAKE) -C $(DIR_LIBSRC) install
61
62 uninstall: uninstall-bin
63
64 uninstall-bin:
65         rm -f $(PREFIX)/usr/lib/$(PROG)
66
67 ifneq ($(MAKECMDGOALS),distclean)
68 ifneq ($(MAKECMDGOALS),clean)
69 ifneq ($(MAKECMDGOALS),uninstall)
70 -include deps
71 endif
72 endif
73 endif
74
75 deps:   $(SRCS) ../../Makefile.conf
76         $(MAKE) -C $(DIR_LIBSRC)
77         @>deps ;\
78         for file in $(SRCS); do\
79           echo "`$(CC) $(CXXFLAGS) -MM $$file` Makefile" >> deps ;\
80           echo -e '\t$$(CC) -c $$< $(CXXFLAGS)' >> deps ;\
81         done