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 \
23 ./traffcounter_impl.cpp \
28 STGLIBS = scriptexecuter \
33 STGLIBS_INCS = $(addprefix -I ../../stglibs/,$(addsuffix .lib/include,$(STGLIBS)))
34 STGLIBS_LIBS = $(addprefix -L ../../stglibs/,$(addsuffix .lib,$(STGLIBS)))
36 LIBS += $(addprefix -lstg,$(STGLIBS)) $(LIB_THREAD)
44 SEARCH_DIRS = -I ../../include
46 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
48 CXXFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
49 CFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
55 LDFLAGS += $(STGLIBS_LIBS)
57 .PHONY: all clean distclean libs plugins install uninstall install-bin install-data
58 all: libs plugins $(PROG)
61 $(MAKE) -C $(DIR_LIBSRC)
64 $(MAKE) -C $(DIR_PLUGINS)
67 $(CXX) $^ $(LDFLAGS) $(LIBS) -o $(PROG)
70 rm -f deps $(PROG) *.o tags *.*~ .OS
75 $(MAKE) -C $(DIR_LIBSRC) clean
76 $(MAKE) -C $(DIR_PLUGINS) clean
80 rm -f ../../Makefile.conf
82 install: install-bin install-data
86 install -D -m $(BIN_MODE) -o $(OWNER) $(PROG) $(PREFIX)/usr/sbin/$(PROG)
88 install -D -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
90 $(MAKE) -C $(DIR_INCLUDE) install
91 $(MAKE) -C $(DIR_LIBSRC) install
92 $(MAKE) -C $(DIR_PLUGINS) install
96 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer
97 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-available.d
98 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-enabled.d
99 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/stargazer.conf $(PREFIX)/etc/stargazer/stargazer.conf
100 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/conf-available.d/*.conf $(PREFIX)/etc/stargazer/conf-available.d
101 ln -sf ../conf-available.d/mod_ao.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ao.conf
102 ln -sf ../conf-available.d/mod_ia.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ia.conf
103 ln -sf ../conf-available.d/mod_ping.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ping.conf
104 ln -sf ../conf-available.d/mod_sg.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_sg.conf
105 ln -sf ../conf-available.d/store_files.conf $(PREFIX)/etc/stargazer/conf-enabled.d/store_files.conf
108 ln -sf ../conf-available.d/mod_cap_ether.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_ether.conf
110 ln -sf ../conf-available.d/mod_cap_bpf.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_bpf.conf
113 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/rules $(PREFIX)/etc/stargazer/rules
114 install -m $(BIN_MODE) -o $(OWNER) $(ETC_DIR)/On* $(PREFIX)/etc/stargazer/
117 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/admins
118 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/tariffs
119 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/users/test
120 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/admins/admin.adm $(PREFIX)/var/stargazer/admins/admin.adm
121 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/tariffs/tariff.tf $(PREFIX)/var/stargazer/tariffs/tariff.tf
122 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/conf $(PREFIX)/var/stargazer/users/test/conf
123 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/stat $(PREFIX)/var/stargazer/users/test/stat
125 uninstall: uninstall-bin uninstall-data
128 rm -f $(PREFIX)/usr/sbin/$(PROG)
129 $(MAKE) -C $(DIR_LIBSRC) uninstall
130 $(MAKE) -C $(DIR_PLUGINS) uninstall
131 rm -rf $(PREFIX)/usr/lib/stg
135 rm -rf $(PREFIX)/etc/stargazer
136 rm -rf $(PREFIX)/var/stargazer
139 ifneq ($(MAKECMDGOALS),distclean)
140 ifneq ($(MAKECMDGOALS),clean)
141 ifneq ($(MAKECMDGOALS),uninstall)
147 deps: $(SRCS) ../../Makefile.conf
148 $(MAKE) -C $(DIR_LIBSRC)
150 for file in $(SRCS); do\
151 echo "$$file" | grep ".c$$" > /dev/null;\
154 echo "`$(CC) $(CFLAGS) -MM $$file` Makefile" >> deps ;\
155 printf '%b\n' '\t$$(CC) $(CFLAGS) -c $$<' >> deps ;\
157 echo "`$(CXX) $(CXXFLAGS) -MM $$file` Makefile" >> deps ;\
158 printf '%b\n' '\t$$(CXX) $(CXXFLAGS) -c $$<' >> deps ;\