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
80 install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
81 $(MAKE) -C $(DIR_INCLUDE) install
82 $(MAKE) -C $(DIR_LIBSRC) install
83 $(MAKE) -C $(DIR_PLUGINS) install
87 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer
88 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-available.d
89 mkdir -m $(DIR_MODE) -p $(PREFIX)/etc/stargazer/conf-enabled.d
90 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/stargazer.conf $(PREFIX)/etc/stargazer/stargazer.conf
91 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/conf-available.d/*.conf $(PREFIX)/etc/stargazer/conf-available.d
92 ln -sf ../conf-available.d/mod_ao.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ao.conf
93 ln -sf ../conf-available.d/mod_ia.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ia.conf
94 ln -sf ../conf-available.d/mod_ping.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_ping.conf
95 ln -sf ../conf-available.d/mod_sg.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_sg.conf
98 ln -sf ../conf-available.d/mod_cap_ether.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_ether.conf
100 ln -sf ../conf-available.d/mod_cap_bpf.conf $(PREFIX)/etc/stargazer/conf-enabled.d/mod_cap_bpf.conf
103 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/rules $(PREFIX)/etc/stargazer/rules
104 install -m $(BIN_MODE) -o $(OWNER) $(ETC_DIR)/On* $(PREFIX)/etc/stargazer/
107 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/admins
108 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/tariffs
109 mkdir -m $(DIR_MODE) -p $(PREFIX)/var/stargazer/users/test
110 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/admins/admin.adm $(PREFIX)/var/stargazer/admins/admin.adm
111 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/tariffs/tariff.tf $(PREFIX)/var/stargazer/tariffs/tariff.tf
112 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/conf $(PREFIX)/var/stargazer/users/test/conf
113 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/stat $(PREFIX)/var/stargazer/users/test/stat
115 uninstall: uninstall-bin uninstall-data
118 rm -f $(PREFIX)/usr/sbin/$(PROG)
119 $(MAKE) -C $(DIR_LIBSRC) uninstall
120 $(MAKE) -C $(DIR_PLUGINS) uninstall
121 rm -rf $(PREFIX)/usr/lib/stg
125 rm -rf $(PREFIX)/etc/stargazer
126 rm -rf $(PREFIX)/var/stargazer
129 ifneq ($(MAKECMDGOALS),distclean)
130 ifneq ($(MAKECMDGOALS),clean)
131 ifneq ($(MAKECMDGOALS),uninstall)
137 deps: $(SRCS) ../../Makefile.conf
138 $(MAKE) -C $(DIR_LIBSRC)
140 for file in $(SRCS); do\
141 echo "`$(CC) $(CXXFLAGS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\
142 printf '%b\n' '\t$$(CC) -c $$< $(CXXFLAGS)' >> deps ;\