1 ###############################################################################
2 # $Id: Makefile,v 1.50 2010/10/07 18:27:27 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))))
45 LDFLAGS += -Wl,-E -L$(DIR_LIB) -Wl,-rpath,$(PREFIX)/usr/lib/stg -Wl,-rpath-link,$(DIR_LIB)
48 .PHONY: all clean distclean libs plugins install uninstall install-bin install-data
49 all: libs plugins $(PROG)
52 $(MAKE) -C $(DIR_LIBSRC)
55 $(MAKE) -C $(DIR_PLUGINS)
58 $(CXX) $(OBJS) $(LDFLAGS) $(LIBS) $(STGLIBS) -o $(PROG)
61 rm -f deps $(PROG) *.o tags *.*~ .OS
66 $(MAKE) -C $(DIR_LIBSRC) clean
67 $(MAKE) -C $(DIR_PLUGINS) clean
71 rm -f ../../Makefile.conf
73 install: install-bin install-data
76 mkdir -m $(BIN_MODE) -p $(PREFIX)/usr/sbin
77 install -m $(BIN_MODE) -o $(OWNER) -s $(PROG) $(PREFIX)/usr/sbin/$(PROG)
78 $(MAKE) -C $(DIR_LIBSRC) install
79 $(MAKE) -C $(DIR_PLUGINS) install
83 mkdir -m $(DATA_MODE) -p $(PREFIX)/etc/stargazer
84 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/stargazer.conf $(PREFIX)/etc/stargazer/stargazer.conf
85 install -m $(DATA_MODE) -o $(OWNER) $(ETC_DIR)/rules $(PREFIX)/etc/stargazer/rules
86 install -m $(BIN_MODE) -o $(OWNER) $(ETC_DIR)/On* $(PREFIX)/etc/stargazer/
89 mkdir -m $(DATA_MODE) -p $(PREFIX)/var/stargazer/admins
90 mkdir -m $(DATA_MODE) -p $(PREFIX)/var/stargazer/tariffs
91 mkdir -m $(DATA_MODE) -p $(PREFIX)/var/stargazer/users/test
92 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/admins/admin.adm $(PREFIX)/var/stargazer/admins/admin.adm
93 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/tariffs/tariff.tf $(PREFIX)/var/stargazer/tariffs/tariff.tf
94 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/conf $(PREFIX)/var/stargazer/users/test/conf
95 install -m $(DATA_MODE) -o $(OWNER) $(VAR_DIR)/users/test/stat $(PREFIX)/var/stargazer/users/test/stat
97 ifeq ($(CHECK_FBCLIENT),yes)
99 mkdir -p $(PREFIX)/var/stargazer
100 chown $(OWNER):$(FIREBIRD_GROUP) $(PREFIX)/var/stargazer
101 chmod g+rw $(PREFIX)/var/stargazer
102 echo "connect '$(DB_ADDRESS)' user '$(DB_USER)' password '$(DB_PASSWORD)';" > .db.sql
103 echo "drop database;" >> .db.sql
104 echo "create database '$(DB_ADDRESS)' user '$(DB_USER)' password '$(DB_PASSWORD)' default character set win1251;" >> .db.sql
105 cat $(VAR_DIR)/../00-base-00.sql >> .db.sql
106 $(FIREBIRD_ISQL) -i .db.sql
110 uninstall: uninstall-bin uninstall-data
113 rm -f $(PREFIX)/usr/sbin/$(PROG)
114 $(MAKE) -C $(DIR_LIBSRC) uninstall
115 $(MAKE) -C $(DIR_PLUGINS) uninstall
116 rm -rf $(PREFIX)/usr/lib/stg
120 rm -rf $(PREFIX)/etc/stargazer
121 rm -rf $(PREFIX)/var/stargazer
124 ifneq ($(MAKECMDGOALS),distclean)
125 ifneq ($(MAKECMDGOALS),clean)
126 ifneq ($(MAKECMDGOALS),uninstall)
132 deps: $(SRCS) ../../Makefile.conf
133 $(MAKE) -C $(DIR_LIBSRC) includes
135 for file in $(SRCS); do\
136 echo "`$(CC) $(CXXFLAGS) $(SEARCH_DIRS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\
137 echo -e '\t$$(CC) -c $$< $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS)' >> deps ;\