Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 123 lines (101 sloc) 4.615 kb
eabe791 @jwatte initial release
jwatte authored
1 -include makevars.config
2 TEST_SRCS:=$(wildcard test/*.cpp)
3 TEST_OBJS:=$(patsubst %.cpp,obj/%.o,$(TEST_SRCS))
4 TESTS:=$(patsubst test/%.cpp,%,$(TEST_SRCS))
5 TOOL_SRCS:=$(wildcard tool/*.cpp)
6 TOOL_OBJS:=$(patsubst %.cpp,obj/%.o,$(TOOL_SRCS))
7 TOOLS:=$(patsubst tool/%.cpp,%,$(TOOL_SRCS))
8 LIB_SRCS:=$(wildcard lib/*.cpp)
9 LIB_OBJS:=$(patsubst %.cpp,obj/%.o,$(LIB_SRCS))
10 LIBS:=istatdaemon istat
11 DIR_DEPS:=obj obj/lib obj/daemon obj/test obj/tool obj/splitter bin
12 FTEST_FILES:=$(wildcard ftest/test_*.sh)
13 DAEMON_MAIN_SRC:=daemon/main.cpp
14 DAEMON_MAIN_OBJ:=$(patsubst %.cpp,obj/%.o,$(DAEMON_MAIN_SRC))
15 DAEMON_SRCS:=$(filter-out $(DAEMON_MAIN_SRC),$(wildcard daemon/*.cpp))
16 DAEMON_OBJS:=$(patsubst %.cpp,obj/%.o,$(DAEMON_SRCS))
17 SPLITTER_MAIN_SRC:=splitter/main.cpp
18 SPLITTER_MAIN_OBJ:=$(patsubst %.cpp,obj/%.o,$(SPLITTER_MAIN_SRC))
19 DAEMONS:=istatd splitd
b4be5df @jwatte builds on GCC 4.7.1
jwatte authored
20 DEPS:=$(sort $(patsubst %.o,%.d,$(TEST_OBJS) $(TOOL_OBJS) $(LIB_OBJS) $(DAEMON_OBJS) \
21 $(DAEMON_MAIN_OBJ) $(SPLITTER_MAIN_OBJ)))
eabe791 @jwatte initial release
jwatte authored
22 BINS:=$(patsubst %,bin/%,$(TESTS) $(TOOLS) $(DAEMONS))
23 LIB_DEPS:=$(foreach lib,$(LIBS),obj/lib$(lib).a)
24 HDRS:=$(wildcard include/istat/*.h) $(wildcard include/json/*.h)
25 TESTS_TO_RUN:=
26 FILES_SRCS:=$(wildcard files/*)
27 SETTINGS_SRCS:=$(wildcard settings/*)
28
29 DESTDIR?=/
30 USR_PREFIX?=$(DESTDIR)/usr
31 VAR_PREFIX?=$(DESTDIR)/var
32 ETC_PREFIX?=$(DESTDIR)/etc
33 INSTALL?=install -C -D
34 TOUCH=touch
35
36 INSTALL_DIRS:=
37 INSTALL_DSTS:=
38 CXX:=g++#./gstlfilt/gfilt
39 LXXFLAGS:=-Lobj/ $(patsubst %,-l%,$(LIBS))
40 ifeq ($(OPT),)
41 OPT := -O2
42 endif
a898a8a @ehohenstein adding support for building against either libstatgrab 0.17 or 0.90
ehohenstein authored
43 CXXFLAGS:=-pipe $(OPT) -g -I. -Iinclude -MMD -D_LARGEFILE64_SOURCE -Wall -Werror
48d13a6 @poblahblahblah updating the Makefile and configure files in order to be able to specify...
poblahblahblah authored
44 SYS_LIBS:=$(BOOST_SYSTEM) $(BOOST_THREAD) -lboost_signals -lpthread $(STATGRAB) \
a256e0d @lloucas-imvu add libboost-iostreams dependency to configure and fix some libboost rea...
lloucas-imvu authored
45 $(BOOST_FILESYSTEM) $(BOOST_IOSTREAMS) -lboost_date_time $(LIBRT)
eabe791 @jwatte initial release
jwatte authored
46
47 all: $(DIR_DEPS) $(LIB_DEPS) $(BINS) tests ftests
48
49 dpkg:
50 env DEB_BUILD_OPTIONS="nostrip" debuild -us -uc
51 @echo done
52
53 build: $(DIR_DEPS) $(BINS)
54 @echo "build done"
55
56 clean:
57 rm -fr obj bin testdata/* /tmp/test /var/tmp/test /tmp/ss.test
58
59 distclean: clean
6ff26bf @jwatte Additional make file cleanup
jwatte authored
60 rm -fr makevars.config debian/files debian/istatd/
eabe791 @jwatte initial release
jwatte authored
61
62 killall:
63 killall -q istatd || true
64
65 -include make.def
66
67 obj/libistat.a: $(LIB_OBJS)
68 ar cr $@ $^
69 $(eval $(call add_install,obj/libistat.a,$(USR_PREFIX)/lib/libistat.a,664))
70 HEADERS:=$(wildcard include/istat/*)
71 $(foreach hfile,$(HEADERS),$(eval $(call add_install,$(hfile),$(USR_PREFIX)/$(hfile),664)))
72
73 obj/libistatdaemon.a: $(DAEMON_OBJS)
74 ar cr $@ $^
75
76 bin/istatd: $(DAEMON_MAIN_OBJ) $(LIB_DEPS)
77 $(CXX) -g $(DAEMON_MAIN_OBJ) -o $@ $(LXXFLAGS) $(SYS_LIBS)
d645215 @jfschedler package istatd as two debian packages: istatd-server and istatd-agent
jfschedler authored
78 $(eval $(call add_install,bin/istatd,$(USR_PREFIX)/bin/istatd-server,775))
79 $(eval $(call add_install,bin/istatd,$(USR_PREFIX)/bin/istatd-agent,775))
eabe791 @jwatte initial release
jwatte authored
80 bin/splitd: $(SPLITTER_MAIN_OBJ) $(LIB_DEPS)
81 $(CXX) -g $(SPLITTER_MAIN_OBJ) -o $@ $(LXXFLAGS) $(SYS_LIBS)
82 $(eval $(call add_install,bin/splitd,$(USR_PREFIX)/bin/splitd,775))
83
84 $(foreach test,$(TESTS),$(eval $(call build_test,$(test))))
85 $(foreach tool,$(TOOLS),$(eval $(call build_tool,$(tool))))
86 $(foreach dir,obj bin obj/test obj/tool obj/daemon obj/lib obj/splitter,$(eval $(call build_dir,$(dir))))
87
88 obj/%.o: %.cpp
89 $(CXX) $(CXXFLAGS) -c -o $@ $<
90
91 # tests only require libs to be built
92 tests: $(DIR_DEPS) $(patsubst %,run_%,$(TESTS_TO_RUN))
93 @echo "tests complete"
94
95 # ftests require istatd to be built
96 ftests: $(DIR_DEPS) $(BINS) tests $(FTEST_FILES)
d9d89b0 @jwatte Fix linefeeds in makefile
jwatte authored
97 @for ft in $(FTEST_FILES); do echo ""; echo "============================================"; echo "ftest $$ft"; $$ft || exit 1; done
eabe791 @jwatte initial release
jwatte authored
98 bin/istatd --test --config test.cfg
99 @echo "ftests complete"
100
101 -include $(DEPS)
102
d645215 @jfschedler package istatd as two debian packages: istatd-server and istatd-agent
jfschedler authored
103 $(eval $(call add_install,istatd-server.default,$(ETC_PREFIX)/default/istatd-server,755))
104 $(eval $(call add_install,istatd-server-init.sh,$(ETC_PREFIX)/init.d/istatd-server,755))
105 $(eval $(call add_install,istatd-agent.default,$(ETC_PREFIX)/default/istatd-agent,755))
106 $(eval $(call add_install,istatd-agent-init.sh,$(ETC_PREFIX)/init.d/istatd-agent,755))
eabe791 @jwatte initial release
jwatte authored
107 $(foreach set,$(SETTINGS_SRCS),$(eval $(call add_precious_install,$(set),$(VAR_PREFIX)/db/istatd/$(set),664)))
d645215 @jfschedler package istatd as two debian packages: istatd-server and istatd-agent
jfschedler authored
108 $(eval $(call add_precious_install,istatd-server.settings,$(ETC_PREFIX)/istatd-server.cfg,644))
109 $(eval $(call add_precious_install,istatd-agent.settings,$(ETC_PREFIX)/istatd-agent.cfg,644))
eabe791 @jwatte initial release
jwatte authored
110 $(foreach file,$(FILES_SRCS),$(eval $(call add_install,$(file),$(USR_PREFIX)/share/istatd/files/$(notdir $(file)),664)))
111
112 # add install must go before make directories
113 $(foreach dir,$(INSTALL_DIRS),$(eval $(call mk_install_dir,$(patsubst %/,%,$(dir)))))
114 $(call mk_install_dir,$(VAR_PREFIX)/db/istatd)
115
116 install: $(INSTALL_DIRS) $(INSTALL_DSTS)
117 #update-rc.d istatd defaults
118 @echo done
119
120 uninstall:
121 rm -f $(INSTALL_DSTS)
122 rm -f $(ETC_PREFIX)/rc*.d/*istatd
Something went wrong with that request. Please try again.