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