]> git.stg.codes - stg.git/blob - projects/sgconf_xml/Makefile
Move tariffUsers from users section to tariffs.tariffUsage and fix
[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 =  -lstgconffiles \
13         -lstgsrvconf \
14         -lstgcrypto \
15         -lstgcommon
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 %.a $(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         $(CXX) $^ $(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 uninstall: uninstall-bin uninstall-data
73
74 uninstall-bin:
75         rm -f $(PREFIX)/usr/sbin/$(PROG)
76
77
78 ifneq ($(MAKECMDGOALS),distclean)
79 ifneq ($(MAKECMDGOALS),clean)
80 ifneq ($(MAKECMDGOALS),uninstall)
81 -include deps
82 endif
83 endif
84 endif
85
86 deps:   $(SRCS) ../../Makefile.conf
87         $(MAKE) -C $(DIR_LIBSRC) includes
88         @>deps ;\
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
93
94