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 = scriptexecuter \
32 STGLIBS_INCS = $(addprefix -I ../../stglibs/,$(addsuffix .lib/include,$(STGLIBS)))
33 STGLIBS_LIBS = $(addprefix -L ../../stglibs/,$(addsuffix .lib,$(STGLIBS)))
35 LIBS += $(addprefix -lstg,$(STGLIBS)) $(LIB_THREAD)
43 SEARCH_DIRS = -I ../../include
45 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
47 CXXFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
48 CFLAGS += $(DEFS) $(STGLIBS_INCS) $(SEARCH_DIRS)
51 LDFLAGS += -Wl,-E $(STGLIBS_LIBS)
54 LDFLAGS += $(STGLIBS_LIBS)
56 .PHONY: all clean distclean libs plugins install uninstall install-bin install-data
57 all: libs plugins $(PROG)
60 $(MAKE) -C $(DIR_LIBSRC)
63 $(MAKE) -C $(DIR_PLUGINS)
66 $(CXX) $^ $(LDFLAGS) $(LIBS) -o $(PROG)
69 rm -f deps $(PROG) *.o tags *.*~ .OS
74 $(MAKE) -C $(DIR_LIBSRC) clean
75 $(MAKE) -C $(DIR_PLUGINS) clean
79 rm -f ../../Makefile.conf
81 install: install-bin install-data
85 install -D -m $(BIN_MODE) -o $(OWNER) $(PROG) $(PREFIX)/usr/sbin/$(PROG)
87 install -D -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
89 $(MAKE) -C $(DIR_INCLUDE) install
90 $(MAKE) -C $(DIR_LIBSRC) install
91 $(MAKE) -C $(DIR_PLUGINS) install
95 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer
96 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-available.d
97 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-enabled.d
98 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/stargazer.conf $(PREFIX)/etc/stargazer/stargazer.conf
99 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/conf-available.d/*.conf $(PREFIX)/etc/stargazer/conf-available.d
100 ln -sf ../conf-available.d/mod_ao.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ao.conf
101 ln -sf ../conf-available.d/mod_ia.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ia.conf
102 ln -sf ../conf-available.d/mod_ping.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ping.conf
103 ln -sf ../conf-available.d/mod_sg.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_sg.conf
104 ln -sf ../conf-available.d/store_files.conf $(PREFIX)/etc/stargazer/conf-enabled.d/store_files.conf
107 ln -sf ../conf-available.d/mod_cap_ether.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_ether.conf
109 ln -sf ../conf-available.d/mod_cap_bpf.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_bpf.conf
112 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/rules $(PREFIX)/etc/stargazer/rules
113 install -m $(BIN_MODE) -o $(OWNER) $(ETC_DIR)/On* $(PREFIX)/etc/stargazer/
116 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/admins
117 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/tariffs
118 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/users/test
119 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/admins/admin.adm $(PREFIX)/var/stargazer/admins/admin.adm
120 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/tariffs/tariff.tf $(PREFIX)/var/stargazer/tariffs/tariff.tf
121 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/conf $(PREFIX)/var/stargazer/users/test/conf
122 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/stat $(PREFIX)/var/stargazer/users/test/stat
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)
149 for file in $(SRCS); do\
150 echo "$$file" | grep ".c$$" > /dev/null;\
153 echo "`$(CC) $(CFLAGS) -MM $$file` Makefile" >> deps ;\
154 printf '%b\n' '\t$$(CC) $(CFLAGS) -c $$<' >> deps ;\
156 echo "`$(CXX) $(CXXFLAGS) -MM $$file` Makefile" >> deps ;\
157 printf '%b\n' '\t$$(CXX) $(CXXFLAGS) -c $$<' >> deps ;\