]> sourceware.org Git - systemtap.git/blob - Makefile.am
Use -Wextra. Fix some warnings.
[systemtap.git] / Makefile.am
1 # Makefile.am --- automake input file for systemtap
2 ## process this file with automake to produce Makefile.in
3
4 # we don't maintain a ChangeLog, which makes us non-GNU -> foreign
5 AUTOMAKE_OPTIONS = no-dist foreign
6
7 pkglibexecdir = ${libexecdir}/${PACKAGE}
8 oldincludedir = ${includedir}/sys
9
10 AM_CPPFLAGS = -DBINDIR='"$(bindir)"' \
11 -DSYSCONFDIR='"$(sysconfdir)"' \
12 -DPKGDATADIR='"$(pkgdatadir)"' \
13 -DPKGLIBDIR='"$(pkglibexecdir)"' \
14 -DLOCALEDIR='"$(localedir)"' \
15 -I$(srcdir)/includes -I$(builddir)/includes/sys
16
17 AM_CFLAGS = -D_GNU_SOURCE -fexceptions -Wall -Wextra -Werror -Wunused -Wformat=2 -W
18 AM_CXXFLAGS = -Wall -Wextra -Werror
19
20 bin_SCRIPTS = stap-report
21 pkglibexec_SCRIPTS = stap-env
22 oldinclude_HEADERS = includes/sys/sdt.h includes/sys/sdt-config.h
23
24 bin_PROGRAMS =
25
26 if BUILD_TRANSLATOR
27 bin_PROGRAMS += stap
28 bin_SCRIPTS += dtrace
29
30 pkglibexec_PROGRAMS =
31
32 if HAVE_NSS
33 pkglibexec_PROGRAMS += stap-sign-module stap-authorize-cert
34
35 if BUILD_SERVER
36 pkglibexec_PROGRAMS += stap-serverd stap-gen-cert
37 bin_SCRIPTS += stap-server
38 pkglibexec_SCRIPTS += stap-start-server stap-stop-server
39 endif
40 endif
41
42 stap_SOURCES = main.cxx session.cxx \
43 parse.cxx staptree.cxx elaborate.cxx translate.cxx \
44 tapsets.cxx buildrun.cxx loc2c.c hash.cxx mdfour.c \
45 cache.cxx util.cxx coveragedb.cxx dwarf_wrappers.cxx \
46 tapset-been.cxx tapset-procfs.cxx tapset-timers.cxx tapset-netfilter.cxx \
47 tapset-perfmon.cxx tapset-mark.cxx tapset-itrace.cxx \
48 tapset-utrace.cxx task_finder.cxx dwflpp.cxx rpm_finder.cxx \
49 setupdwfl.cxx remote.cxx privilege.cxx cmdline.cxx \
50 tapset-dynprobe.cxx tapset-method.cxx translator-output.cxx \
51 stapregex.cxx stapregex-tree.cxx stapregex-parse.cxx \
52 stapregex-dfa.cxx stringtable.cxx
53 noinst_HEADERS = sdt_types.h
54 stap_LDADD = @stap_LIBS@ @sqlite3_LIBS@ @LIBINTL@ -lpthread
55 stap_DEPENDENCIES =
56
57 if BUILD_VIRT
58 bin_PROGRAMS += stapvirt
59 stapvirt_SOURCES = stapvirt.c
60 stapvirt_CFLAGS = $(AM_CFLAGS)
61 stapvirt_CFLAGS += $(libvirt_CFLAGS) $(libxml2_CFLAGS)
62 stapvirt_LDFLAGS = $(AM_LDFLAGS)
63 stapvirt_LDADD = $(libvirt_LIBS) $(libxml2_LIBS)
64 endif
65
66 endif
67
68 install: all
69 $(MAKE) $(AM_MAKEFLAGS) install-recursive
70
71 BUILT_SOURCES =
72 CLEANFILES =
73
74 # Arrange for git_version.h to be regenerated at every "make".
75 # Code fragment is based upon RadeonHD.am.
76
77 # The stamp file which is never created ensures that git_version.h is updated
78 # before every build. Having git_version.h in foo_SOURCES ensures a recompile
79 # of foo-bar.c if it is newer than the foo-bar.o file. Using noinst_foo_SOURCES
80 # instead of foo_SOURCES prevents shipping git_version.h in dist tarballs,
81 # which may cause false GIT_FOO readings.
82 BUILT_SOURCES += git_version.stamp
83 CLEANFILES += git_version.h
84 GIT_VERSION_CMD = $(SHELL) $(top_srcdir)/git_version.sh
85 git_version.stamp:
86 @if test -f "$(srcdir)/git_version.h"; then \
87 if test -f "git_version.h"; then :; \
88 else \
89 cp "$(srcdir)/git_version.h" "git_version.h"; \
90 fi; \
91 fi
92 $(GIT_VERSION_CMD) -k -s $(top_srcdir) -o git_version.h
93 @if test -s "$(srcdir)/git_version.h"; then \
94 if cmp "$(srcdir)/git_version.h" "git_version.h"; then :; \
95 else \
96 echo "Error: $(srcdir)/git_version.h and git_version.h differ."; \
97 echo " You probably want to remove the former."; \
98 exit 1; \
99 fi; \
100 fi
101
102 git_version.h:
103 $(srcdir)/git_version.sh -k --srcdir $(srcdir) -o git_version.h
104
105 cscope:
106 cd $(srcdir) && \
107 (echo -q ; git ls-files '*.cxx' '*.c' '*.h' | grep -v '^testsuite' ) > cscope.files && \
108 cscope -b -q @DYNINST_CXXFLAGS@
109
110 PHONIES =
111 if BUILD_TRANSLATOR
112 stap_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@
113 stap_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ @cxx11@
114 stap_CPPFLAGS = $(AM_CPPFLAGS) -DSTAP_SDT_V2
115 stap_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
116
117 if HAVE_AVAHI
118 stap_CXXFLAGS += $(avahi_CFLAGS)
119 stap_CPPFLAGS += $(avahi_CFLAGS)
120 stap_LDADD += $(avahi_LIBS)
121 endif
122
123 if HAVE_NSS
124 stap_SOURCES += nsscommon.cxx csclient.cxx cscommon.cxx
125 stap_CFLAGS += $(nss_CFLAGS) -DSTAP
126 stap_CXXFLAGS += $(nss_CFLAGS)
127 stap_CPPFLAGS += $(nss_CFLAGS)
128 stap_LDADD += $(nss_LIBS)
129
130 install-exec-local: install-scripts
131
132 PHONIES += install-scripts
133 # scripts must be installed before this rule is run
134 install-scripts: install-binSCRIPTS install-pkglibexecSCRIPTS
135 for f in $(bin_SCRIPTS); do \
136 sed -i -e "s,\$${PKGLIBEXECDIR},$(pkglibexecdir)/," $(DESTDIR)$(bindir)/$$f; \
137 done
138 for f in $(pkglibexec_SCRIPTS); do \
139 sed -i -e "/INSTALL-HOOK/d;s,sysconfdir=.*,sysconfdir=$(sysconfdir),;s,pkglibexecdir=.*,pkglibexecdir=$(pkglibexecdir)/,;s,localstatedir=.*,localstatedir=$(localstatedir),;s,\$${PKGLIBEXECDIR},$(pkglibexecdir)/," $(DESTDIR)$(pkglibexecdir)/$$f; \
140 done
141 endif
142
143 if BUILD_ELFUTILS
144 stap_CPPFLAGS += -Iinclude-elfutils
145 stap_LDFLAGS += -Llib-elfutils -Wl,-rpath-link,lib-elfutils \
146 -Wl,--enable-new-dtags,-rpath,$(pkglibdir)
147
148
149 BUILT_SOURCES += stamp-elfutils
150 CLEANFILES += stamp-elfutils
151 stamp-elfutils: config.status
152 $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils all bin_PROGRAMS=
153 for dir in libelf libebl libdw libdwfl backends; do \
154 $(MAKE) $(AM_MAKEFLAGS) -j1 -C build-elfutils/$$dir bin_PROGRAMS= install; \
155 done
156 $(MAKE) $(AM_MAKEFLAGS) -j1 -C build-elfutils install-pkgincludeHEADERS;
157 touch $@
158 stap_DEPENDENCIES += lib-elfutils/libdw.so
159 lib-elfutils/libdw.so: stamp-elfutils ;
160
161 PHONIES += install-elfutils
162 install-elfutils:
163 mkdir -p $(DESTDIR)$(pkglibdir)
164 for file in lib-elfutils/*.so* lib-elfutils/${PACKAGE_NAME}/*.so*; do \
165 $(INSTALL_PROGRAM) $$file $(DESTDIR)$(pkglibdir); \
166 done
167 install-exec-local: install-elfutils
168 endif
169 endif
170
171 CLEANFILES += $(pkglibexec_PROGRAMS)
172
173 if BUILD_TRANSLATOR
174 if HAVE_NSS
175 stap_sign_module_SOURCES = stap-sign-module.cxx nsscommon.cxx util.cxx
176 stap_sign_module_CPPFLAGS = $(AM_CPPFLAGS)
177 stap_sign_module_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
178 stap_sign_module_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
179 stap_sign_module_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
180 stap_sign_module_LDADD = $(nss_LIBS)
181
182 stap_authorize_cert_SOURCES = stap-authorize-cert.cxx nsscommon.cxx util.cxx
183 stap_authorize_cert_CPPFLAGS = $(AM_CPPFLAGS)
184 stap_authorize_cert_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
185 stap_authorize_cert_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
186 stap_authorize_cert_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
187 stap_authorize_cert_LDADD = $(nss_LIBS)
188
189 if BUILD_SERVER
190 stap_serverd_SOURCES = stap-serverd.cxx cscommon.cxx util.cxx privilege.cxx nsscommon.cxx cmdline.cxx
191 stap_serverd_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
192 stap_serverd_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
193 stap_serverd_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
194 stap_serverd_LDADD = $(nss_LIBS) -lpthread
195 if HAVE_AVAHI
196 stap_serverd_CFLAGS += $(avahi_CFLAGS)
197 stap_serverd_CXXFLAGS += $(avahi_CFLAGS)
198 stap_serverd_LDADD += $(avahi_LIBS)
199 endif
200
201 stap_gen_cert_SOURCES = stap-gen-cert.cxx util.cxx nsscommon.cxx
202 stap_gen_cert_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
203 stap_gen_cert_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
204 stap_gen_cert_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
205 stap_gen_cert_LDADD = $(nss_LIBS)
206 endif
207 endif
208
209 noinst_PROGRAMS = loc2c-test
210 loc2c_test_SOURCES = loc2c-test.c loc2c.c
211 loc2c_test_CFLAGS = $(stap_CFLAGS)
212 loc2c_test_CPPFLAGS = $(stap_CPPFLAGS)
213 loc2c_test_LDFLAGS = $(stap_LDFLAGS)
214 loc2c_test_LDADD = $(stap_LDADD)
215 endif
216
217 # crash(8) extension
218 if BUILD_CRASHMOD
219 STAPLOG=staplog.so
220
221 $(STAPLOG): staplog.c
222 $(CC) $(staplog_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -shared -rdynamic \
223 $(AM_LDFLAGS) $(LDFLAGS) -fPIC -o $@ $<
224 all-local: $(STAPLOG) example_index
225 install-exec-local: $(STAPLOG)
226 $(MKDIR_P) $(DESTDIR)$(pkglibdir)
227 $(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir)
228 else
229 all-local: example_index
230 endif
231
232 # Get extra libs as needed
233 LDADD =
234
235 EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples
236 EXAMPLE_META_FILES = $(EXAMPLE_SOURCE_DIR)/*/*.meta
237
238 example_index: $(EXAMPLE_SOURCE_DIR)/index.html
239
240 $(EXAMPLE_SOURCE_DIR)/index.html: $(EXAMPLE_META_FILES) $(EXAMPLE_INDEX_GEN)
241 @echo "The script example index is outdated, run"
242 @echo " cd $(EXAMPLE_SOURCE_DIR) && \\ "
243 @echo " perl examples-index-gen.pl"
244 @echo "to regenerate it."
245
246 install-data-local:
247 (cd $(srcdir)/runtime; for f in *.[ch]; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/$$f; done)
248 if HAVE_DYNINST
249 (cd $(srcdir)/runtime/dyninst; find . \( -name '*.[ch]' \) -print \
250 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/dyninst/$$f; done)
251 endif
252 (cd $(srcdir)/runtime/unwind; find . \( -name '*.[ch]' \) -print \
253 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/unwind/$$f; done)
254 (cd $(srcdir)/runtime/transport; for f in *.[ch]; \
255 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/transport/$$f; done)
256 (cd $(srcdir)/runtime/linux; for f in *.[ch]; \
257 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/linux/$$f; done)
258 (cd $(srcdir)/runtime/linux/uprobes; for f in Makefile *.[ch]; \
259 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/linux/uprobes/$$f; done)
260 (cd $(srcdir)/runtime/linux/uprobes2; for f in *.[ch]; \
261 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/linux/uprobes2/$$f; done)
262 (cd $(srcdir)/tapset; find . \( -name '*.stp' -o -name '*.stpm' -o -name README \) -print \
263 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/tapset/$$f; done)
264 (cd $(srcdir)/testsuite/systemtap.examples; find . -type f -print \
265 | egrep -v 'check.exp|ChangeLog|examples-index-gen.pl|html/.*\.tmpl$$' \
266 | while read f; do if test -x $$f; then \
267 i_cmd="$(INSTALL_PROGRAM)"; else \
268 i_cmd="$(INSTALL_DATA)"; fi; \
269 $$i_cmd -D $$f $(DESTDIR)$(docdir)/examples/$$f; done)
270 test -e $(DESTDIR)$(sysconfdir)/systemtap || mkdir -p $(DESTDIR)$(sysconfdir)/systemtap
271 if BUILD_SERVER
272 test -e $(DESTDIR)$(localstatedir)/run/stap-server || mkdir -p $(DESTDIR)$(localstatedir)/run/stap-server
273 test -e $(DESTDIR)$(localstatedir)/log || mkdir -p $(DESTDIR)$(localstatedir)/log
274 endif
275
276
277 TEST_COV_DIR = coverage
278
279 gcov:
280 find . -name '*.gc*' | xargs rm -f
281 $(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" CFLAGS="-g -fprofile-arcs -ftest-coverage" all install
282 -sudo $(MAKE) installcheck $${RUNTESTFLAGS+RUNTESTFLAGS=$${RUNTESTFLAGS}}
283 for dir in $(SUBDIRS); do \
284 (cd $$dir; gcov *.gcno > SUMMARY.gcov 2>&1 || true); \
285 done
286 find . -name '*.gcov'
287
288 clean-local:
289 rm -rf ${PACKAGE_TARNAME}-*.tar.gz
290 rm -rf ${PACKAGE_TARNAME}-${PACKAGE_VERSION}
291 rm -rf $(TEST_COV_DIR)
292 rm -rf stap.info
293 rm -rf staplog.so
294
295 distclean-local:
296 rm -rf build-elfutils include-elfutils lib-elfutils
297 rm -f doc/beginners/en-US doc/beginners/build/en-US/testsuite
298
299 uninstall-local:
300 rm -rf $(DESTDIR)$(pkgdatadir)
301 rm -rf $(DESTDIR)$(libdir)/$(PACKAGE)
302 -rm -rf $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)
303 @list='$(EXAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \
304 echo " rm -f '$(EXAMPLE_INSTALL_DIR)/$$p'"; \
305 rm -f "$(EXAMPLE_INSTALL_DIR)/$$p"; \
306 done
307 @list='$(DEMO_SRC)'; for f in $$list; do p=`basename $$f`; \
308 echo " rm -f '$(DEMO_INSTALL_DIR)/$$p'"; \
309 rm -f "$(DEMO_INSTALL_DIR)/$$p"; \
310 done
311 @list='$(SAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \
312 echo " rm -f '$(SAMPLE_INSTALL_DIR)/$$p'"; \
313 rm -f "$(SAMPLE_INSTALL_DIR)/$$p"; \
314 done
315 rm -rf $(DESTDIR)$(sysconfdir)/systemtap
316 rm -rf $(DESTDIR)$(docdir)/examples
317 if BUILD_SERVER
318 rm -rf $(DESTDIR)$(localstatedir)/run/stap-server
319 rm -f $(DESTDIR)$(localstatedir)/log/stap-server/log
320 endif
321
322 SUBDIRS = . java stapdyn staprun doc man po
323 # NB: the gcov target above uses this to enumarate linked binaries' build directories
324 DIST_SUBDIRS = testsuite $(SUBDIRS)
325 EXTRA_DIST = m4/ChangeLog
326
327 check-local:
328 SRCDIR=`cd $(srcdir); pwd`; \
329 PWD=`pwd`; \
330 $(MAKE) -C testsuite check SYSTEMTAP_RUNTIME=$$SRCDIR/runtime SYSTEMTAP_TAPSET=$$SRCDIR/tapset LD_LIBRARY_PATH=$$LD_LIBRARY_PATH$${LD_LIBRARY_PATH:+:}$$PWD/lib-elfutils:$$PWD/lib-elfutils/systemtap SYSTEMTAP_PATH=$$PWD SYSTEMTAP_INCLUDES=$$PWD/includes RUNTESTFLAGS="$(RUNTESTFLAGS)" PKGLIBDIR="$(pkglibexecdir)";
331
332 installcheck:
333 if test \! -e $(DESTDIR)$(bindir)/stap; then \
334 echo $(DESTDIR)$(bindir)/stap doesn\'t exist, run make install; \
335 exit -1; \
336 fi; \
337 if test $(builddir)/stap -nt $(DESTDIR)$(bindir)/stap; then \
338 echo "$(DESTDIR)$(bindir)/stap is not recent, run make install"; \
339 exit -1; \
340 fi;
341 $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)"
342
343 PHONIES += runcheck
344 # All the variables are overridden by run-stap, but SYSTEMTAP_RUNTIME
345 # is used by the testsuite scripts themselves.
346 runcheck: testsuite/stap testsuite/dtrace
347 $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" \
348 SYSTEMTAP_PATH="`cd testsuite; pwd`" \
349 SYSTEMTAP_RUNTIME="`cd $(srcdir)/runtime; pwd`"
350 testsuite/stap: run-stap
351 (echo '#!/bin/sh'; echo "exec `pwd`/run-stap" '$${1+"$$@"}') > $@.new
352 chmod 555 $@.new
353 mv -f $@.new $@
354 testsuite/dtrace: dtrace
355 (echo '#!/bin/sh'; echo "exec `pwd`/dtrace" '$${1+"$$@"}') > $@.new
356 chmod 555 $@.new
357 mv -f $@.new $@
358
359 PHONIES += update-po
360 update-po:
361 (cd $(srcdir); ls -1d *.c *.cxx *.h staprun/*.c staprun/*.h) \
362 | grep -v loc2c-test.c \
363 | grep -v config.h \
364 | grep -v git_version.h \
365 | grep -v staprun/config.h \
366 | sort > $(srcdir)/po/POTFILES.in
367 $(MAKE) -C po update-po
368 @echo
369 @echo if systemtam.pot is shown as modified ...
370 @echo
371 (cd $(srcdir)/po; git status *.pot)
372 @echo
373 @echo ... then check in with zanata ...
374 @echo
375 @echo % cd $(srcdir)
376 @echo % zanata-cli -B push -s po -t po
377 @echo % zanata-cli -B pull -s po -t po
378 @echo
379 @echo if the .po files are shown as modified ...
380 @echo
381 (cd $(srcdir)/po; git status *.po)
382 @echo
383 @echo ... regenerate just once ...
384 @echo
385 @echo % $(MAKE) -C `pwd` update-po
386
387
388 # Any extra flags, such as:
389 # --define "with_docs 0"
390 # --define "with_bundled_elfutils 1" --define "elfutils_version 0.135"
391 RPMBUILDFLAGS=
392
393 PHONIES += dist-gzip rpm srpm
394
395 PHONIES += uprobes install-uprobes
396 uprobes:
397 $(MAKE) -C $(srcdir)/runtime/uprobes clean default
398 install-uprobes:
399 $(MAKE) -C $(DESTDIR)$(pkgdatadir)/runtime/uprobes clean default
400
401 .PHONY: $(PHONIES)
402
403 dist-gzip:
404 cd $(srcdir); git status | grep working.directory.clean || (echo "You should commit your changes before 'make rpm'.")
405 (cd $(srcdir); git archive --prefix=systemtap-$(VERSION)/ --format=tar HEAD) | gzip > systemtap-$(VERSION).tar.gz
406
407 rpm: dist-gzip
408 if [ `id -u` = 0 ]; then echo NOTE: do not run this as root; exit 1; fi
409 if [ ! -w `rpm --eval %_topdir` ]; then \
410 echo WARNING: you do not have access to `rpm --eval %_topdir`; \
411 echo WARNING: you may receive a permission denied error; \
412 echo WARNING: consider adding \'%_topdir $(HOME)/rpmbuild\' to $(HOME)/.rpmmacros; \
413 fi
414 mkdir -p `rpm --eval %_specdir`
415 mkdir -p `rpm --eval %_srcrpmdir`
416 mkdir -p `rpm --eval %_rpmdir`
417 mkdir -p `rpm --eval %_builddir`
418 mkdir -p `rpm --eval %_buildroot`
419 rpmbuild --define "_sourcedir $(PWD)/" -ta systemtap-$(VERSION).tar.gz $(RPMBUILDFLAGS)
420
421 srpm: dist-gzip
422 mkdir -p `rpm --eval %_srcrpmdir`
423 rpmbuild --define "_sourcedir $(PWD)/" -ts systemtap-$(VERSION).tar.gz $(RPMBUILDFLAGS)
424
425 ACLOCAL_AMFLAGS = -I m4
This page took 0.059062 seconds and 6 git commands to generate.