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 \
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)
50 LDFLAGS += -Wl,-E $(STGLIBS_LIBS)
52 .PHONY: all clean distclean libs plugins install uninstall install-bin install-data
53 all: libs plugins $(PROG)
56 $(MAKE) -C $(DIR_LIBSRC)
59 $(MAKE) -C $(DIR_PLUGINS)
62 $(CXX) $^ $(LDFLAGS) $(LIBS) -o $(PROG)
65 rm -f deps $(PROG) *.o tags *.*~ .OS
70 $(MAKE) -C $(DIR_LIBSRC) clean
71 $(MAKE) -C $(DIR_PLUGINS) clean
75 rm -f ../../Makefile.conf
77 install: install-bin install-data
81 install -D -m $(BIN_MODE) -o $(OWNER) $(PROG) $(PREFIX)/usr/sbin/$(PROG)
83 install -D -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
85 $(MAKE) -C $(DIR_INCLUDE) install
86 $(MAKE) -C $(DIR_LIBSRC) install
87 $(MAKE) -C $(DIR_PLUGINS) install
91 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer
92 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-available.d
93 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-enabled.d
94 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/stargazer.conf $(PREFIX)/etc/stargazer/stargazer.conf
95 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/conf-available.d/*.conf $(PREFIX)/etc/stargazer/conf-available.d
96 ln -sf ../conf-available.d/mod_ao.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ao.conf
97 ln -sf ../conf-available.d/mod_ia.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ia.conf
98 ln -sf ../conf-available.d/mod_ping.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ping.conf
99 ln -sf ../conf-available.d/mod_sg.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_sg.conf
100 ln -sf ../conf-available.d/store_files.conf $(PREFIX)/etc/stargazer/conf-enabled.d/store_files.conf
103 ln -sf ../conf-available.d/mod_cap_ether.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_ether.conf
105 ln -sf ../conf-available.d/mod_cap_bpf.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_bpf.conf
108 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/rules $(PREFIX)/etc/stargazer/rules
109 install -m $(BIN_MODE) -o $(OWNER) $(ETC_DIR)/On* $(PREFIX)/etc/stargazer/
112 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/admins
113 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/tariffs
114 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/users/test
115 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/admins/admin.adm $(PREFIX)/var/stargazer/admins/admin.adm
116 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/tariffs/tariff.tf $(PREFIX)/var/stargazer/tariffs/tariff.tf
117 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/conf $(PREFIX)/var/stargazer/users/test/conf
118 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/stat $(PREFIX)/var/stargazer/users/test/stat
120 uninstall: uninstall-bin uninstall-data
123 rm -f $(PREFIX)/usr/sbin/$(PROG)
124 $(MAKE) -C $(DIR_LIBSRC) uninstall
125 $(MAKE) -C $(DIR_PLUGINS) uninstall
126 rm -rf $(PREFIX)/usr/lib/stg
130 rm -rf $(PREFIX)/etc/stargazer
131 rm -rf $(PREFIX)/var/stargazer
134 ifneq ($(MAKECMDGOALS),distclean)
135 ifneq ($(MAKECMDGOALS),clean)
136 ifneq ($(MAKECMDGOALS),uninstall)
142 deps: $(SRCS) ../../Makefile.conf
143 $(MAKE) -C $(DIR_LIBSRC)
145 for file in $(SRCS); do\
146 echo "$$file" | grep ".c$$" > /dev/null;\
149 echo "`$(CC) $(CFLAGS) -MM $$file` Makefile" >> deps ;\
150 printf '%b\n' '\t$$(CC) $(CFLAGS) -c $$<' >> deps ;\
152 echo "`$(CXX) $(CXXFLAGS) -MM $$file` Makefile" >> deps ;\
153 printf '%b\n' '\t$$(CXX) $(CXXFLAGS) -c $$<' >> deps ;\