1 ###############################################################################
2 # $Id: Makefile,v 1.50 2010/10/07 18:27:27 faust Exp $
3 ###############################################################################
5 include ../../Makefile.conf
25 STGLIBS = -lstg_logger \
34 LIBS += $(LIB_THREAD) \
37 LIBS += $(LIB_THREAD) \
41 SEARCH_DIRS = -I $(DIR_INCLUDE)
43 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
45 LDFLAGS += -Wl,-E -L$(DIR_LIB) -Wl,-rpath,$(PREFIX)/usr/lib/stg -Wl,-rpath-link,$(DIR_LIB)
48 .PHONY: all clean distclean libs plugins install uninstall install-bin install-data
49 all: libs plugins $(PROG)
52 $(MAKE) -C $(DIR_LIBSRC)
55 $(MAKE) -C $(DIR_PLUGINS)
58 $(CXX) $(OBJS) $(LDFLAGS) $(LIBS) $(STGLIBS) -o $(PROG)
61 rm -f deps $(PROG) *.o tags *.*~ .OS
66 $(MAKE) -C $(DIR_LIBSRC) clean
67 $(MAKE) -C $(DIR_PLUGINS) clean
71 rm -f ../../Makefile.conf
73 install: install-bin install-data
76 mkdir -m $(BIN_MODE) -p $(PREFIX)/usr/sbin
77 install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
78 $(MAKE) -C $(DIR_LIBSRC) install
79 $(MAKE) -C $(DIR_PLUGINS) install
83 mkdir -m $(DATA_MODE) -p $(PREFIX)/etc/stargazer
84 mkdir -m $(DATA_MODE) -p $(PREFIX)/etc/stargazer/conf-available.d
85 mkdir -m $(DATA_MODE) -p $(PREFIX)/etc/stargazer/conf-enabled.d
86 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/stargazer.conf $(PREFIX)/etc/stargazer/stargazer.conf
87 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/conf-available.d/*.conf $(PREFIX)/etc/stargazer/conf-available.d
88 ln -s $(PREFIX)/etc/stargazer/conf-available.d/mod_ao.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ao.conf
89 ln -s $(PREFIX)/etc/stargazer/conf-available.d/mod_ia.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ia.conf
90 ln -s $(PREFIX)/etc/stargazer/conf-available.d/mod_ping.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ping.conf
91 ln -s $(PREFIX)/etc/stargazer/conf-available.d/mod_sg.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_sg.conf
94 ln -s $(PREFIX)/etc/stargazer/conf-available.d/mod_cap_ether.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_ether.conf
96 ln -s $(PREFIX)/etc/stargazer/conf-available.d/mod_cap_bpf.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_bpf.conf
99 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/rules $(PREFIX)/etc/stargazer/rules
100 install -m $(BIN_MODE) -o $(OWNER) $(ETC_DIR)/On* $(PREFIX)/etc/stargazer/
103 mkdir -m $(DATA_MODE) -p $(PREFIX)/var/stargazer/admins
104 mkdir -m $(DATA_MODE) -p $(PREFIX)/var/stargazer/tariffs
105 mkdir -m $(DATA_MODE) -p $(PREFIX)/var/stargazer/users/test
106 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/admins/admin.adm $(PREFIX)/var/stargazer/admins/admin.adm
107 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/tariffs/tariff.tf $(PREFIX)/var/stargazer/tariffs/tariff.tf
108 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/conf $(PREFIX)/var/stargazer/users/test/conf
109 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/stat $(PREFIX)/var/stargazer/users/test/stat
111 ifeq ($(CHECK_FBCLIENT),yes)
112 # Install firebird db
113 mkdir -p $(PREFIX)/var/stargazer
114 chown $(OWNER):$(FIREBIRD_GROUP) $(PREFIX)/var/stargazer
115 chmod g+rw $(PREFIX)/var/stargazer
116 echo "connect '$(DB_ADDRESS)' user '$(DB_USER)' password '$(DB_PASSWORD)';" > .db.sql
117 echo "drop database;" >> .db.sql
118 echo "create database '$(DB_ADDRESS)' user '$(DB_USER)' password '$(DB_PASSWORD)' default character set win1251;" >> .db.sql
119 cat $(VAR_DIR)/../00-base-00.sql >> .db.sql
120 $(FIREBIRD_ISQL) -i .db.sql
124 uninstall: uninstall-bin uninstall-data
127 rm -f $(PREFIX)/usr/sbin/$(PROG)
128 $(MAKE) -C $(DIR_LIBSRC) uninstall
129 $(MAKE) -C $(DIR_PLUGINS) uninstall
130 rm -rf $(PREFIX)/usr/lib/stg
134 rm -rf $(PREFIX)/etc/stargazer
135 rm -rf $(PREFIX)/var/stargazer
138 ifneq ($(MAKECMDGOALS),distclean)
139 ifneq ($(MAKECMDGOALS),clean)
140 ifneq ($(MAKECMDGOALS),uninstall)
146 deps: $(SRCS) ../../Makefile.conf
147 $(MAKE) -C $(DIR_LIBSRC) includes
149 for file in $(SRCS); do\
150 echo "`$(CC) $(CXXFLAGS) $(SEARCH_DIRS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\
151 echo -e '\t$$(CC) -c $$< $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS)' >> deps ;\