]> git.stg.codes - stg.git/blob - projects/sgauth/Makefile
Connection notifier and watcher added
[stg.git] / projects / sgauth / Makefile
1 ###############################################################################
2 # $Id: Makefile,v 1.18 2009/08/06 12:50:55 faust Exp $
3 ###############################################################################
4
5 include ../../Makefile.conf
6
7 PROG = sgauth
8
9 SRCS = ./main.cpp \
10        ./settings_impl.cpp \
11        ./web.cpp
12
13 STGLIBS =  -lstgconffiles \
14            -lstgcrypto \
15            -lstgcommon \
16            -lstgia
17
18 LIBS += $(LIB_THREAD)
19
20 ifeq ($(OS),linux)
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
31 LDFLAGS += -Wl,-E -L$(DIR_LIB) -Wl,-rpath,$(PREFIX)/usr/lib/stg -Wl,-rpath-link,$(DIR_LIB)
32
33 vpath %.so $(DIR_LIB)
34
35 .PHONY: all clean distclean libs install uninstall install-bin install-data uninstall-bin uninstall-data
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 .store
48         rm -f .db.sql
49         rm -f core*
50         rm -f css.h
51         $(MAKE) -C $(DIR_LIBSRC) clean
52
53 distclean: clean
54         rm -f ../../Makefile.conf
55
56 install: install-bin install-data
57
58 install-bin:
59         install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
60         $(MAKE) -C $(DIR_LIBSRC) install
61
62 install-data:
63         # Install etc
64         mkdir -m $(DIR_MODE) -p $(PREFIX)/etc
65         install -m $(DATA_MODE) -o $(OWNER) ./sgauth.conf $(PREFIX)/etc/sgauth.conf
66
67 uninstall: uninstall-bin uninstall-data
68
69 uninstall-bin:
70         rm -f $(PREFIX)/usr/sbin/$(PROG)
71
72 uninstall-data:
73         # Uninstall etc
74         rm -f $(PREFIX)/etc/sgauth.conf
75
76
77 ifneq ($(MAKECMDGOALS),distclean)
78 ifneq ($(MAKECMDGOALS),clean)
79 ifneq ($(MAKECMDGOALS),uninstall)
80 -include deps
81 endif
82 endif
83 endif
84
85 deps:   $(SRCS) ../../Makefile.conf sgauth.css
86         $(MAKE) -C $(DIR_LIBSRC) includes
87         @>deps ;\
88         ./make_css.sh
89         for file in $(SRCS); do\
90           echo "`$(CC) $(CXXFLAGS) $(SEARCH_DIRS) -MM $$file` Makefile" >> deps ;\
91           echo -e '\t$$(CC) -c $$< $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS)' >> deps ;\
92         done