1 ###############################################################################
2 # $Id: Makefile,v 1.45 2009/03/20 15:47:10 faust Exp $
3 ###############################################################################
5 include ../../Makefile.conf
25 STGLIBS = -lstg_logger \
34 LIBS += $(LIB_THREAD) \
37 LIBS += $(LIB_THREAD) \
41 SEARCH_DIRS = -I $(DIR_INCLUDE)
43 OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS))))
46 LDFLAGS += -Wl,-E -L$(DIR_LIB) -Wl,-rpath,$(PREFIX)/usr/lib/stg -Wl,-rpath-link,$(DIR_LIB)
49 .PHONY: all clean distclean libs plugins install uninstall install-bin install-data
50 all: libs plugins $(PROG)
53 $(MAKE) -C $(DIR_LIBSRC)
56 $(MAKE) -C $(DIR_PLUGINS)
58 $(PROG): $(OBJS) $(STGLIBS)
59 $(CC) $^ $(LDFLAGS) $(LIBS) -o $(PROG)
62 rm -f deps $(PROG) *.o tags *.*~ .OS
67 $(MAKE) -C $(DIR_LIBSRC) clean
68 $(MAKE) -C $(DIR_PLUGINS) clean
72 rm -f ../../Makefile.conf
74 install: install-bin install-data
77 mkdir -m $(BIN_MODE) -p $(PREFIX)/usr/sbin
78 install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
79 $(MAKE) -C $(DIR_LIBSRC) install
80 $(MAKE) -C $(DIR_PLUGINS) install
84 mkdir -m $(DATA_MODE) -p $(PREFIX)/etc/stargazer
85 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/stargazer.conf $(PREFIX)/etc/stargazer/stargazer.conf
86 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/rules $(PREFIX)/etc/stargazer/rules
87 install -m $(BIN_MODE) -o $(OWNER) $(ETC_DIR)/On* $(PREFIX)/etc/stargazer/
90 mkdir -m $(DATA_MODE) -p $(PREFIX)/var/stargazer/admins
91 mkdir -m $(DATA_MODE) -p $(PREFIX)/var/stargazer/tariffs
92 mkdir -m $(DATA_MODE) -p $(PREFIX)/var/stargazer/users/test
93 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/admins/admin.adm $(PREFIX)/var/stargazer/admins/admin.adm
94 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/tariffs/tariff.tf $(PREFIX)/var/stargazer/tariffs/tariff.tf
95 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/conf $(PREFIX)/var/stargazer/users/test/conf
96 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/stat $(PREFIX)/var/stargazer/users/test/stat
98 ifeq ($(CHECK_FBCLIENT),yes)
100 mkdir -p $(PREFIX)/var/stargazer
101 chown $(OWNER):$(FIREBIRD_GROUP) $(PREFIX)/var/stargazer
102 chmod g+rw $(PREFIX)/var/stargazer
103 echo "connect '$(DB_ADDRESS)' user '$(DB_USER)' password '$(DB_PASSWORD)';" > .db.sql
104 echo "drop database;" >> .db.sql
105 echo "create database '$(DB_ADDRESS)' user '$(DB_USER)' password '$(DB_PASSWORD)' default character set win1251;" >> .db.sql
106 cat $(VAR_DIR)/../00-base-00.sql >> .db.sql
107 $(FIREBIRD_ISQL) -i .db.sql
111 uninstall: uninstall-bin uninstall-data
114 rm -f $(PREFIX)/usr/sbin/$(PROG)
115 $(MAKE) -C $(DIR_LIBSRC) uninstall
116 $(MAKE) -C $(DIR_PLUGINS) uninstall
117 rm -rf $(PREFIX)/usr/lib/stg
121 rm -rf $(PREFIX)/etc/stargazer
122 rm -rf $(PREFIX)/var/stargazer
125 ifneq ($(MAKECMDGOALS),distclean)
126 ifneq ($(MAKECMDGOALS),clean)
127 ifneq ($(MAKECMDGOALS),uninstall)
133 deps: $(SRCS) ../../Makefile.conf
134 $(MAKE) -C $(DIR_LIBSRC) includes
136 for file in $(SRCS); do\
137 echo "`$(CC) $(CXXFLAGS) $(SEARCH_DIRS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\
138 echo -e '\t$$(CC) -c $$< $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS)' >> deps ;\