cmogstored 1.8.1 - use default system stack size
[cmogstored.git] / Makefile.am
blobef2aaae56e9230d351bc38d33430f63694d58614
1 ACLOCAL_AMFLAGS = -I m4
2 AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
3 AM_CFLAGS = $(WARN_CFLAGS) $(GCC_ATOMICS_CFLAGS) $(PTHREAD_CFLAGS)
4 AM_LDFLAGS = $(LIBGNU_LIBDEPS)
5 DTRACE = @DTRACE@
6 SUBDIRS = lib
8 # slow.mk is auto-generated by the maintainer (see GNUmakefile)
9 include $(top_srcdir)/test/slow.mk
11 mog_src =
12 mog_src += accept.c
13 mog_src += accept_loop.c
14 mog_src += activeq.h
15 mog_src += addrinfo.c
16 mog_src += alloc.c
17 mog_src += bind_listen.c
18 mog_src += bsd/queue_safe.h
19 mog_src += bsd/simpleq.h
20 mog_src += canonpath.c
21 mog_src += cfg.c
22 mog_src += cfg.h
23 mog_src += cfg_validate.c
24 mog_src += cloexec_detect.c
25 mog_src += cloexec_from.c
26 mog_src += close.c
27 mog_src += cmogstored.h
28 mog_src += compat_accept.h
29 mog_src += compat_epoll_pwait.h
30 mog_src += compat_memstream.h
31 mog_src += compat_sendfile.h
32 mog_src += defaults.h
33 mog_src += dev.c
34 mog_src += digest.c
35 mog_src += digest.h
36 mog_src += exit.c
37 mog_src += fadvise.h
38 mog_src += fdmap.c
39 mog_src += fdmap.h
40 mog_src += file.c
41 mog_src += fs.c
42 mog_src += fs.h
43 mog_src += gcc.h
44 mog_src += http.c
45 mog_src += http.h
46 mog_src += http_date.c
47 mog_src += http_dav.c
48 mog_src += http_get.c
49 mog_src += http_put.c
50 mog_src += http_util.h
51 mog_src += inherit.c
52 mog_src += ioprio.h
53 mog_src += ioprio_linux.h
54 mog_src += ioq.c
55 mog_src += iostat.c
56 mog_src += iostat.h
57 mog_src += iostat_process.c
58 mog_src += ioutil.c
59 mog_src += iov_str.h
60 mog_src += listen_parser.h
61 mog_src += listen_parser_internal.c
62 mog_src += maxconns.c
63 mog_src += mgmt.c
64 mog_src += mgmt.h
65 mog_src += mgmt_fn.c
66 mog_src += mkpath_for.c
67 mog_src += mnt.c
68 mog_src += mnt.h
69 mog_src += mnt_usable.c
70 mog_src += nameinfo.c
71 mog_src += nostd/setproctitle.h
72 mog_src += notify.c
73 mog_src += notify.h
74 mog_src += packaddr.h
75 mog_src += path_parser.h
76 mog_src += pidfile.c
77 mog_src += process.c
78 mog_src += queue_common.c
79 mog_src += queue_epoll.c
80 mog_src += queue_epoll.h
81 mog_src += queue_kqueue.c
82 mog_src += queue_kqueue.h
83 mog_src += queue_loop.c
84 mog_src += queue_step.c
85 mog_src += selfwake.h
86 mog_src += selfwake.c
87 mog_src += sig.c
88 mog_src += svc.c
89 mog_src += svc_dev.c
90 mog_src += thrpool.c
91 mog_src += trace.h
92 mog_src += trywrite.c
93 mog_src += util.h
94 mog_src += upgrade.c
95 mog_src += yield.c
97 LDADD = $(LIBINTL) $(top_builddir)/lib/libgnu.a libnostd.a $(LIB_CLOCK_GETTIME)
98 noinst_LIBRARIES = libnostd.a
99 nostd_include = -include $(top_builddir)/$(CONFIG_HEADER)
100 libnostd_a_SOURCES = nostd/setproctitle.c nostd/setproctitle_noop.c
101 libnostd_a_CFLAGS = $(AM_CFLAGS) $(nostd_include) $(NOSTD_CFLAGS)
103 RLFLAGS = -G2 -e
104 RAGEL = ragel
105 RL_MAIN = cfg_parser.rl iostat_parser.rl listen_parser.rl mgmt_parser.rl \
106           valid_path.rl http_parser.rl chunk_parser.rl valid_put_path.rl
107 RL_CGEN = $(RL_MAIN:.rl=.c)
108 RL_ALL = listen_parser_common.rl http_common.rl path_parser.rl $(RL_MAIN)
110 cfg_parser.c: cfg_parser.rl listen_parser_common.rl
111 listen_parser.c: listen_parser.rl listen_parser_common.rl
112 http_parser.c: http_parser.rl http_common.rl path_parser.rl
113 mgmt_parser.c: path_parser.rl
114 chunk_parser.c: chunk_parser.rl http_common.rl
115 .rl.c:
116         $(AM_V_GEN)$(RAGEL) $< -C $(RLFLAGS) -o $@
118 BUILT_SOURCES = $(top_srcdir)/.version $(top_srcdir)/.gnulib-version
119 bin_PROGRAMS = cmogstored
120 cmogstored_SOURCES = $(mog_src) $(RL_CGEN) cmogstored.c probes.d
122 RUBY = ruby
123 PERL = perl
124 PROVE = prove
125 TEST_EXTENSIONS = .rb .slowrb .perl
126 RB_LOG_COMPILER = $(RUBY)
127 AM_RB_LOG_FLAGS = -I$(top_srcdir)
128 RB_LOG_FLAGS = -w
129 PERL_TESTS = test/mogilefs_integration.perl
130 PERL_LOG_COMPILER = $(PROVE)
131 PERL_LOG_FLAGS = -v
132 SLOWRB_LOG_COMPILER = env RUBY=$(RUBY) top_srcdir=$(top_srcdir) $(SHELL)
133 AM_SLOWRB_LOG_FLAGS = -u -e
134 include $(top_srcdir)/test/ruby.mk
135 check_tests = test/valid-path-1 test/trywrite-1 \
136   test/cfg-parser-1 test/fdmap-1 test/thrpool-1 \
137   test/queue-idle-1 \
138   test/http-parser-1 test/chunk-parser-1 \
139   test/ioutil-1
140 check_PROGRAMS = $(check_tests)
142 TESTS = $(SLOW_RB_FILES) $(RB_TESTS_FAST) $(check_tests) $(PERL_TESTS)
144 # we need TMPDIR to work in a place where iostat(1) gives stats
145 test_tmpdir = $(top_builddir)/tmp
147 $(RB_TESTS_FAST:.rb=.log): $(bin_PROGRAMS) $(test_tmpdir)/.stamp
148 $(RB_TESTS_SLOW:.slowrb=.log): $(bin_PROGRAMS) $(test_tmpdir)/.stamp
149 $(PERL_TESTS:.perl=.log): $(bin_PROGRAMS) $(test_tmpdir)/.stamp
151 $(test_tmpdir)/.stamp:
152         @mkdir -p $(test_tmpdir) && > $@
154 test_COMMON = $(mog_src) $(RL_CGEN) check.h probes.d
156 test_valid_path_1_SOURCES = test/valid-path-1.c $(test_COMMON)
157 test_trywrite_1_SOURCES = test/trywrite-1.c $(test_COMMON)
158 test_cfg_parser_1_SOURCES = test/cfg-parser-1.c $(test_COMMON)
159 test_fdmap_1_SOURCES = test/fdmap-1.c $(test_COMMON)
160 test_thrpool_1_SOURCES = test/thrpool-1.c $(test_COMMON)
161 test_queue_idle_1_SOURCES = test/queue-idle-1.c $(test_COMMON)
162 test_http_parser_1_SOURCES = test/http-parser-1.c $(test_COMMON)
163 test_chunk_parser_1_SOURCES = test/chunk-parser-1.c $(test_COMMON)
164 test_ioutil_1_SOURCES = test/ioutil-1.c $(test_COMMON)
166 if HAVE_LD_WRAP
167 if HAVE_EPOLL
168 check_PROGRAMS += test/epoll-wrap
169 test_epoll_wrap_SOURCES = $(cmogstored_SOURCES) test/epoll-wrap.c
170 test_epoll_wrap_LDFLAGS = $(cmogstored_LDFLAGS) $(AM_LDFLAGS) \
171                           -Wl,--wrap=epoll_ctl -Wl,--wrap=epoll_create
172 endif # HAVE_EPOLL
174 check_PROGRAMS += test/pwrite-wrap
175 test_pwrite_wrap_SOURCES = $(cmogstored_SOURCES) test/pwrite-wrap.c
176 test_pwrite_wrap_LDFLAGS = $(cmogstored_LDFLAGS) $(AM_LDFLAGS) \
177                           -Wl,--wrap=pwrite
179 endif # HAVE_LD_WRAP
181 HELP2MAN = help2man
182 dist_man_MANS = cmogstored.1
184 cmogstored.1: cmogstored.x cmogstored.c
185 .x.1:
186         $(AM_V_GEN)if test -f $(top_builddir)/cmogstored; then \
187         $(HELP2MAN) -i $< -N $(top_builddir)/cmogstored > $@.$$$$ && \
188         mv $@.$$$$ $@; fi
190 vcs_doc := README INSTALL TODO doc/queues.txt doc/design.txt
191 extra_doc = HACKING NEWS ChangeLog TODO
192 RAKE = rake
193 $(top_srcdir)/NEWS: configure.ac
194         $(AM_V_GEN)$(RAKE) -sq news > $@.$$$$ && mv $@.$$$$ $@
195 $(top_srcdir)/ChangeLog: configure.ac
196         $(AM_V_GEN)$(RAKE) -sq changelog > $@.$$$$ && mv $@.$$$$ $@
197 $(top_srcdir)/cmogstored.1.txt: $(top_srcdir)/cmogstored.1
198         $(AM_V_GEN)man --nh $(top_srcdir)/$< > $@.$$$$ && mv $@.$$$$ $@
200 GZIP = gzip
201 RSYNC = rsync
202 RSYNC_DEST = yhbt.net:/srv/yhbt/cmogstored/
203 HTML_DOC = $(vcs_doc) HACKING NEWS ChangeLog cmogstored.1.txt
204 WWW_DOC = $(HTML_DOC) NEWS.atom.xml
205 NEWS.atom.xml: configure.ac
206         $(AM_V_GEN)$(RAKE) -sq news_atom > $@.$$$$ && mv $@.$$$$ $@
208 html = $${i%.txt}.html
209 publish: NEWS.atom.xml NEWS ChangeLog cmogstored.1.txt
210         mkdir -p www/examples/
211 # n.b. git set-file-times is non-standard, but distributed with rsync
212         -cd $(top_srcdir) && git set-file-times $(vcs_doc)
213         $(INSTALL_DATA) -p $(addprefix $(top_srcdir)/,$(WWW_DOC)) www/
214         $(INSTALL_DATA) -p $(addprefix $(top_srcdir)/,$(examples)) \
215                 www/examples/
216         set -e && cd www && \
217                 for i in $(notdir $(WWW_DOC)) $(examples); do \
218                         $(GZIP) < $$i > $$i.gz; \
219                         test -s $$i.gz; \
220                         touch -r $$i $$i.gz; \
221                 done && \
222                 for i in $(notdir $(HTML_DOC)); do \
223                         i=$$(basename $$i); \
224                         ../build-aux/txt2pre $$i > $(html); \
225                         test -s $(html); \
226                         $(GZIP) < $(html) > $(html).gz; \
227                         touch -r $(html) $(html).gz; \
228                 done;
229         $(RSYNC) -av www/ $(RSYNC_DEST)
231 .PHONY: publish
233 tap_support = tapset/all.stp tapset/http_access_log.gawk tapset/ioq_wait.awk
234 examples := examples/cmogstored.socket examples/cmogstored@.service
236 EXTRA_DIST = $(RB_TESTS) $(RL_CGEN) $(RL_ALL) $(PERL_TESTS) $(extra_doc) \
237   .gitignore .gitattributes \
238   Rakefile autogen.sh GNUmakefile bsd/README doc m4 \
239   test/test_helper.rb test/iostat-mock.rb \
240   test/.gitignore test/gen-slow.sh test/slow.mk \
241   cmogstored.x .ctags $(SLOW_RB_FILES) \
242   build-aux/.gitignore build-aux/snippet/.gitignore build-aux/txt2pre \
243   tests/.gitignore \
244   $(top_srcdir)/.version $(top_srcdir)/.gnulib-version \
245   test/valgrind.supp nostd/README \
246   $(tap_support) \
247   $(examples)
249 TESTS_ENVIRONMENT = PATH=$(top_builddir):$$PATH TMPDIR=$(test_tmpdir)
251 VALGRIND = valgrind -v --show-reachable=yes --leak-check=yes \
252            --track-origins=yes --error-exitcode=126 \
253            --suppressions=$(top_srcdir)/test/valgrind.supp
254 VALGRIND_CHECK = check
255 check-valgrind:
256         VALGRIND="$(VALGRIND)" $(MAKE) $(VALGRIND_CHECK)
258 CLEANFILES = -r $(test_tmpdir) $(top_srcdir)/tmp
259 MAINTAINERCLEANFILES = $(dist_man_MANS)
260 include $(top_srcdir)/build-aux/coverage.mk
261 include $(top_srcdir)/build-aux/release.mk
262 include $(top_srcdir)/build-aux/sparse.mk
263 include $(top_srcdir)/build-aux/pgo.mk
265 $(top_srcdir)/.version:
266         echo $(VERSION) > $@-t && mv $@-t $@
267 $(top_srcdir)/.gnulib-version:
268         cd $(top_srcdir) && ./autogen.sh
269 dist-hook:
270         echo $(VERSION) > $(distdir)/.tarball-version
272 if ENABLE_SYSTEMTAP
273 probes.h: probes.d
274         $(DTRACE) -C -h -s $< -o $@
276 probes.o: probes.d
277         $(DTRACE) -C -G -s $< -o $@
279 trace.h: probes.h
280 EXTRA_DIST += probes.h
281 BUILT_SOURCES += probes.h
282 LDADD += probes.o
283 endif