]> git.stg.codes - stg.git/blob - projects/sgconf_xml/Makefile
Правка пути к xsl для DocBook
[stg.git] / projects / sgconf_xml / Makefile
1 ###############################################################################
2 # $Id: Makefile,v 1.3 2008/05/11 09:30:43 nobunaga Exp $
3 ###############################################################################
4
5 include ../../Makefile.conf
6
7 PROG = sgconf_xml
8
9 SRCS = ./main.cpp \
10        ./parser.cpp
11
12 LIBS =  -lconffiles \
13         -lstg_crypto \
14         -lstg_common \
15         -lsrvconf
16
17 LIBS += -lexpat \
18         $(LIB_THREAD)
19
20 ifeq ($(OS),linux)
21 LIBS += -ldl
22 else
23 LIBS += -lc \
24         -liconv
25 endif
26
27 SEARCH_DIRS = -I $(DIR_INCLUDE)
28
29 ifeq ($(OS),bsd)
30 SEARCH_DIRS += -I/usr/local/include
31 CXXFLAGS += -DHAVE_DECL_GETOPT=1
32 endif
33
34 ifeq ($(OS),bsd5)
35 SEARCH_DIRS += -I/usr/local/include
36 CXXFLAGS += -DHAVE_DECL_GETOPT=1
37 endif
38
39 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
40
41 CXXFLAGS += -Wall
42 LDFLAGS += -Wl,-E -L$(DIR_LIB) -Wl,-rpath,$(PREFIX)/usr/lib/stg -Wl,-rpath-link,$(DIR_LIB)
43
44 vpath %.so $(DIR_LIB)
45
46 .PHONY: all clean distclean libs install uninstall install-bin install-data uninstall-bin uninstall-data
47 all: libs $(PROG) ../../Makefile.conf
48
49 libs:
50         $(MAKE) -C $(DIR_LIBSRC)
51
52 $(PROG): $(OBJS) $(STGLIBS)
53         $(CC) $^ $(LIBS) $(LDFLAGS) -o $(PROG)
54
55 clean:
56         rm -f deps $(PROG) *.o tags *.*~ .OS
57         rm -f .OS
58         rm -f .store
59         rm -f .db.sql
60         rm -f core*
61         $(MAKE) -C $(DIR_LIBSRC) clean
62
63 distclean: clean
64         rm -f ../../Makefile.conf
65
66 install: install-bin install-data
67
68 install-bin:
69         install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
70         $(MAKE) -C $(DIR_LIBSRC) install
71
72 install-data:
73         # Install etc
74         install -m $(DATA_MODE) -o $(OWNER) -D $(ETC_DIR)/sgconf.conf $(PREFIX)/etc/stargazer/sgconf.conf
75
76 uninstall: uninstall-bin uninstall-data
77
78 uninstall-bin:
79         rm -f $(PREFIX)/usr/sbin/$(PROG)
80
81 uninstall-data:
82         # Uninstall etc
83         rm -f $(PREFIX)/etc/stargazer/sgconf.conf
84
85
86 ifneq ($(MAKECMDGOALS),distclean)
87 ifneq ($(MAKECMDGOALS),clean)
88 ifneq ($(MAKECMDGOALS),uninstall)
89 -include deps
90 endif
91 endif
92 endif
93
94 deps:   $(SRCS) ../../Makefile.conf
95         $(MAKE) -C $(DIR_LIBSRC) includes
96         @>deps ;\
97         for file in $(SRCS); do\
98           echo "`$(CC) $(CXXFLAGS) $(SEARCH_DIRS) -MM $$file` Makefile" >> deps ;\
99           echo -e '\t$$(CC) -c $$< $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS)' >> deps ;\
100         done
101
102