1 ###############################################################################
2 # $Id: Makefile,v 1.50 2010/10/07 18:27:27 faust Exp $
3 ###############################################################################
5 include ../../Makefile.conf
9 SRCS = ./admin_impl.cpp \
22 ./traffcounter_impl.cpp \
27 STGLIBS = -lstglogger \
36 LIBS += $(LIB_THREAD) \
39 LIBS += $(LIB_THREAD) \
43 SEARCH_DIRS = -I $(DIR_INCLUDE)
45 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
47 LDFLAGS += -Wl,-E -L$(DIR_LIB) -Wl,-rpath,$(PREFIX)/usr/lib/stg -Wl,-rpath-link,$(DIR_LIB)
50 .PHONY: all clean distclean libs plugins install uninstall install-bin install-data
51 all: libs plugins $(PROG)
54 $(MAKE) -C $(DIR_LIBSRC)
57 $(MAKE) -C $(DIR_PLUGINS)
60 $(CXX) $(OBJS) $(LDFLAGS) $(LIBS) $(STGLIBS) -o $(PROG)
63 rm -f deps $(PROG) *.o tags *.*~ .OS
68 $(MAKE) -C $(DIR_LIBSRC) clean
69 $(MAKE) -C $(DIR_PLUGINS) clean
73 rm -f ../../Makefile.conf
75 install: install-bin install-data
78 install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
79 $(MAKE) -C $(DIR_INCLUDE) install
80 $(MAKE) -C $(DIR_LIBSRC) install
81 $(MAKE) -C $(DIR_PLUGINS) install
85 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer
86 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-available.d
87 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-enabled.d
88 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/stargazer.conf $(PREFIX)/etc/stargazer/stargazer.conf
89 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/conf-available.d/*.conf $(PREFIX)/etc/stargazer/conf-available.d
90 ln -s ../conf-available.d/mod_ao.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ao.conf
91 ln -s ../conf-available.d/mod_ia.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ia.conf
92 ln -s ../conf-available.d/mod_ping.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ping.conf
93 ln -s ../conf-available.d/mod_sg.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_sg.conf
96 ln -s ../conf-available.d/mod_cap_ether.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_ether.conf
98 ln -s ../conf-available.d/mod_cap_bpf.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_bpf.conf
101 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/rules $(PREFIX)/etc/stargazer/rules
102 install -m $(BIN_MODE) -o $(OWNER) $(ETC_DIR)/On* $(PREFIX)/etc/stargazer/
105 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/admins
106 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/tariffs
107 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/users/test
108 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/admins/admin.adm $(PREFIX)/var/stargazer/admins/admin.adm
109 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/tariffs/tariff.tf $(PREFIX)/var/stargazer/tariffs/tariff.tf
110 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/conf $(PREFIX)/var/stargazer/users/test/conf
111 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/stat $(PREFIX)/var/stargazer/users/test/stat
113 ifeq ($(CHECK_FBCLIENT),yes)
114 # Install firebird db
115 mkdir -p $(PREFIX)/var/stargazer
116 chown $(OWNER):$(FIREBIRD_GROUP) $(PREFIX)/var/stargazer
117 chmod g+rw $(PREFIX)/var/stargazer
118 echo "connect '$(DB_ADDRESS)' user '$(DB_USER)' password '$(DB_PASSWORD)';" > .db.sql
119 echo "drop database;" >> .db.sql
120 echo "create database '$(DB_ADDRESS)' user '$(DB_USER)' password '$(DB_PASSWORD)' default character set win1251;" >> .db.sql
121 cat $(VAR_DIR)/../00-base-00.sql >> .db.sql
122 $(FIREBIRD_ISQL) -i .db.sql
126 uninstall: uninstall-bin uninstall-data
129 rm -f $(PREFIX)/usr/sbin/$(PROG)
130 $(MAKE) -C $(DIR_LIBSRC) uninstall
131 $(MAKE) -C $(DIR_PLUGINS) uninstall
132 rm -rf $(PREFIX)/usr/lib/stg
136 rm -rf $(PREFIX)/etc/stargazer
137 rm -rf $(PREFIX)/var/stargazer
140 ifneq ($(MAKECMDGOALS),distclean)
141 ifneq ($(MAKECMDGOALS),clean)
142 ifneq ($(MAKECMDGOALS),uninstall)
148 deps: $(SRCS) ../../Makefile.conf
149 $(MAKE) -C $(DIR_LIBSRC) includes
151 for file in $(SRCS); do\
152 echo "`$(CC) $(CXXFLAGS) $(SEARCH_DIRS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\
153 echo -e '\t$$(CC) -c $$< $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS)' >> deps ;\