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) $(LIBICONV)
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 mkdir -m $(DIR_MODE) -p $(PREFIX)/usr/sbin
87 install -m $(BIN_MODE) -o $(OWNER) $(PROG) $(PREFIX)/usr/sbin/$(PROG)
89 mkdir -m $(DIR_MODE) -p $(PREFIX)/usr/sbin
90 install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
92 $(MAKE) -C $(DIR_INCLUDE) install
93 $(MAKE) -C $(DIR_LIBSRC) install
94 $(MAKE) -C $(DIR_PLUGINS) install
98 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer
99 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-available.d
100 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-enabled.d
101 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/stargazer.conf $(PREFIX)/etc/stargazer/stargazer.conf
102 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/conf-available.d/*.conf $(PREFIX)/etc/stargazer/conf-available.d
103 ln -sf ../conf-available.d/mod_ao.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ao.conf
104 ln -sf ../conf-available.d/mod_ia.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ia.conf
105 ln -sf ../conf-available.d/mod_ping.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ping.conf
106 ln -sf ../conf-available.d/mod_sg.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_sg.conf
107 ln -sf ../conf-available.d/store_files.conf $(PREFIX)/etc/stargazer/conf-enabled.d/store_files.conf
110 ln -sf ../conf-available.d/mod_cap_ether.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_ether.conf
112 ln -sf ../conf-available.d/mod_cap_bpf.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_bpf.conf
115 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/rules $(PREFIX)/etc/stargazer/rules
116 install -m $(BIN_MODE) -o $(OWNER) $(ETC_DIR)/On* $(PREFIX)/etc/stargazer/
119 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/admins
120 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/tariffs
121 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/users/test
122 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/admins/admin.adm $(PREFIX)/var/stargazer/admins/admin.adm
123 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/tariffs/tariff.tf $(PREFIX)/var/stargazer/tariffs/tariff.tf
124 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/conf $(PREFIX)/var/stargazer/users/test/conf
125 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/stat $(PREFIX)/var/stargazer/users/test/stat
127 uninstall: uninstall-bin uninstall-data
130 rm -f $(PREFIX)/usr/sbin/$(PROG)
131 $(MAKE) -C $(DIR_LIBSRC) uninstall
132 $(MAKE) -C $(DIR_PLUGINS) uninstall
133 rm -rf $(PREFIX)/usr/lib/stg
137 rm -rf $(PREFIX)/etc/stargazer
138 rm -rf $(PREFIX)/var/stargazer
141 ifneq ($(MAKECMDGOALS),distclean)
142 ifneq ($(MAKECMDGOALS),clean)
143 ifneq ($(MAKECMDGOALS),uninstall)
149 deps: $(SRCS) ../../Makefile.conf
150 $(MAKE) -C $(DIR_LIBSRC)
152 for file in $(SRCS); do\
153 echo "$$file" | grep ".c$$" > /dev/null;\
156 echo "`$(CC) $(CFLAGS) -MM $$file` Makefile" >> deps ;\
157 printf '%b\n' '\t$$(CC) $(CFLAGS) -c $$<' >> deps ;\
159 echo "`$(CXX) $(CXXFLAGS) -MM $$file` Makefile" >> deps ;\
160 printf '%b\n' '\t$$(CXX) $(CXXFLAGS) -c $$<' >> deps ;\