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 \
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 install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
77 $(MAKE) -C $(DIR_LIBSRC) install
78 $(MAKE) -C $(DIR_PLUGINS) install
82 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer
83 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-available.d
84 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-enabled.d
85 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/stargazer.conf $(PREFIX)/etc/stargazer/stargazer.conf
86 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/conf-available.d/*.conf $(PREFIX)/etc/stargazer/conf-available.d
87 ln -s ../conf-available.d/mod_ao.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ao.conf
88 ln -s ../conf-available.d/mod_ia.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ia.conf
89 ln -s ../conf-available.d/mod_ping.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ping.conf
90 ln -s ../conf-available.d/mod_sg.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_sg.conf
93 ln -s ../conf-available.d/mod_cap_ether.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_ether.conf
95 ln -s ../conf-available.d/mod_cap_bpf.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_bpf.conf
98 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/rules $(PREFIX)/etc/stargazer/rules
99 install -m $(BIN_MODE) -o $(OWNER) $(ETC_DIR)/On* $(PREFIX)/etc/stargazer/
102 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/admins
103 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/tariffs
104 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/users/test
105 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/admins/admin.adm $(PREFIX)/var/stargazer/admins/admin.adm
106 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/tariffs/tariff.tf $(PREFIX)/var/stargazer/tariffs/tariff.tf
107 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/conf $(PREFIX)/var/stargazer/users/test/conf
108 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/stat $(PREFIX)/var/stargazer/users/test/stat
110 ifeq ($(CHECK_FBCLIENT),yes)
111 # Install firebird db
112 mkdir -p $(PREFIX)/var/stargazer
113 chown $(OWNER):$(FIREBIRD_GROUP) $(PREFIX)/var/stargazer
114 chmod g+rw $(PREFIX)/var/stargazer
115 echo "connect '$(DB_ADDRESS)' user '$(DB_USER)' password '$(DB_PASSWORD)';" > .db.sql
116 echo "drop database;" >> .db.sql
117 echo "create database '$(DB_ADDRESS)' user '$(DB_USER)' password '$(DB_PASSWORD)' default character set win1251;" >> .db.sql
118 cat $(VAR_DIR)/../00-base-00.sql >> .db.sql
119 $(FIREBIRD_ISQL) -i .db.sql
123 uninstall: uninstall-bin uninstall-data
126 rm -f $(PREFIX)/usr/sbin/$(PROG)
127 $(MAKE) -C $(DIR_LIBSRC) uninstall
128 $(MAKE) -C $(DIR_PLUGINS) uninstall
129 rm -rf $(PREFIX)/usr/lib/stg
133 rm -rf $(PREFIX)/etc/stargazer
134 rm -rf $(PREFIX)/var/stargazer
137 ifneq ($(MAKECMDGOALS),distclean)
138 ifneq ($(MAKECMDGOALS),clean)
139 ifneq ($(MAKECMDGOALS),uninstall)
145 deps: $(SRCS) ../../Makefile.conf
146 $(MAKE) -C $(DIR_LIBSRC) includes
148 for file in $(SRCS); do\
149 echo "`$(CC) $(CXXFLAGS) $(SEARCH_DIRS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\
150 echo -e '\t$$(CC) -c $$< $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS)' >> deps ;\