]> sourceware.org Git - systemtap.git/blame - Makefile.am
Move old sys/sdt.h to sdt-compat.h for translator use
[systemtap.git] / Makefile.am
CommitLineData
2f1a1aea
FCE
1# Makefile.am --- automake input file for systemtap
2## process this file with automake to produce Makefile.in
3
398edb63
JS
4# we don't maintain a ChangeLog, which makes us non-GNU -> foreign
5AUTOMAKE_OPTIONS = no-dist foreign
42b926b7 6
e460639f 7pkglibexecdir = ${libexecdir}/${PACKAGE}
b899aa79 8oldincludedir = ${includedir}/sys
e460639f 9
79a7b65c 10AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DSYSCONFDIR='"$(sysconfdir)"' -DPKGDATADIR='"${pkgdatadir}"' -DPKGLIBDIR='"$(pkglibexecdir)"' -I$(srcdir)/includes
f00a8372 11
8558d392 12AM_CFLAGS = -D_GNU_SOURCE -fexceptions -Wall -Werror -Wunused -Wformat=2 -W
a4531d21 13AM_CXXFLAGS = -Wall -Werror
77de5e9e 14
6d14a4a9 15man_MANS = stapprobes.3stap stapfuncs.3stap stapvars.3stap stapex.3stap \
e25a872f 16dtrace.1 stap-merge.1\
1bb80d04 17stappaths.7
4040e9ea 18
a0fc7f8e 19bin_SCRIPTS = stap-report
961588fd 20pkglibexec_SCRIPTS = stap-env
818ba2bc 21oldinclude_HEADERS = includes/sys/sdt.h
6d14a4a9 22
1bb80d04
FCE
23bin_PROGRAMS =
24
6d14a4a9 25if BUILD_TRANSLATOR
645d2e52 26bin_PROGRAMS += stap
6d14a4a9
EB
27man_MANS += stap.1
28bin_SCRIPTS += dtrace
29
1bb80d04
FCE
30pkglibexec_PROGRAMS =
31
a0fc7f8e 32if HAVE_NSS
31f9baea 33man_MANS += stap-authorize-signing-cert.8
edecda6c
DB
34bin_SCRIPTS += stap-authorize-signing-cert
35pkglibexec_PROGRAMS += stap-sign-module
645d2e52 36pkglibexec_SCRIPTS += stap-gen-cert stap-authorize-cert
a0fc7f8e 37
19a0d4b6 38if BUILD_SERVER
31f9baea 39man_MANS += stap-client.8 stap-server.8 stap-authorize-server-cert.8
edecda6c 40pkglibexec_PROGRAMS += stap-client-connect stap-server-connect
60045090 41bin_SCRIPTS += stap-client stap-server stap-authorize-server-cert
b703674d 42pkglibexec_SCRIPTS += stap-serverd stap-find-servers \
edecda6c 43 stap-start-server stap-find-or-start-server stap-stop-server
19a0d4b6 44endif
a0fc7f8e 45endif
6d14a4a9 46
e2012a7a 47stap_SOURCES = main.cxx session.cxx \
f4b28491 48 parse.cxx staptree.cxx elaborate.cxx translate.cxx \
1b78aef5 49 tapsets.cxx buildrun.cxx loc2c.c hash.cxx mdfour.c \
912e8c59 50 cache.cxx util.cxx coveragedb.cxx dwarf_wrappers.cxx \
01c2eefe 51 tapset-been.cxx tapset-procfs.cxx tapset-timers.cxx \
93646f4d 52 tapset-perfmon.cxx tapset-mark.cxx tapset-itrace.cxx \
3db9c843 53 tapset-utrace.cxx task_finder.cxx dwflpp.cxx rpm_finder.cxx \
2dce8c42 54 setupdwfl.cxx csclient.cxx
22d737e8 55noinst_HEADERS = sdt-compat.h
bcfa72ed 56stap_LDADD = @stap_LIBS@ @sqlite3_LIBS@
6d14a4a9
EB
57stap_DEPENDENCIES =
58endif
e9d58a72 59
e434132f
FCE
60BUILT_SOURCES =
61CLEANFILES =
62
63# Arrange for git_version.h to be regenerated at every "make".
4040e9ea 64# Code fragment is based upon RadeonHD.am.
e434132f
FCE
65
66# The stamp file which is never created ensures that git_version.h is updated
67# before every build. Having git_version.h in foo_SOURCES ensures a recompile
68# of foo-bar.c if it is newer than the foo-bar.o file. Using noinst_foo_SOURCES
69# instead of foo_SOURCES prevents shipping git_version.h in dist tarballs,
70# which may cause false GIT_FOO readings.
71BUILT_SOURCES += git_version.stamp
72CLEANFILES += git_version.h
73GIT_VERSION_CMD = $(SHELL) $(top_srcdir)/git_version.sh
74git_version.stamp:
75 @if test -f "$(srcdir)/git_version.h"; then \
76 if test -f "git_version.h"; then :; \
77 else \
78 cp "$(srcdir)/git_version.h" "git_version.h"; \
79 fi; \
80 fi
81 $(GIT_VERSION_CMD) -k -s $(top_srcdir) -o git_version.h
82 @if test -s "$(srcdir)/git_version.h"; then \
83 if cmp "$(srcdir)/git_version.h" "git_version.h"; then :; \
84 else \
85 echo "Error: $(srcdir)/git_version.h and git_version.h differ."; \
86 echo " You probably want to remove the former."; \
87 exit 1; \
88 fi; \
89 fi
90
c0f9d4b0
FCE
91git_version.h:
92 $(srcdir)/git_version.sh -k --srcdir $(srcdir) -o git_version.h
e9d58a72 93
8437928b 94cscope:
6cf88792
FCE
95 cd $(srcdir) && \
96 (echo -q ; git ls-files '*.cxx' '*.c' '*.h' | grep -v '^testsuite' ) > cscope.files && \
8437928b 97 cscope -b -q
e434132f 98
6d14a4a9
EB
99PHONIES =
100if BUILD_TRANSLATOR
6ca3a004 101stap_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ -D_FILE_OFFSET_BITS=64
5574ef2c 102stap_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@
a794dbeb 103stap_CPPFLAGS = $(AM_CPPFLAGS) -DSTAP_SDT_V2
8730f377 104stap_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
19a0d4b6 105
2dce8c42
DB
106if HAVE_AVAHI
107stap_CXXFLAGS += $(avahi_CFLAGS)
108stap_CPPFLAGS += $(avahi_CFLAGS)
e3aaaf5f 109stap_LDADD += -lavahi-client -lavahi-common
2dce8c42
DB
110endif
111
2035bcd4 112if HAVE_NSS
2fad97fd
DB
113stap_SOURCES += stap-client-connect.c nsscommon.c
114stap_CFLAGS += $(nss_CFLAGS) $(nspr_CFLAGS) -DSTAP
115stap_CXXFLAGS += $(nss_CFLAGS) $(nspr_CFLAGS)
116stap_CPPFLAGS += $(nss_CFLAGS) $(nspr_CFLAGS)
117stap_LDADD += -lssl3 -lnss3 -lnspr4 -lplc4
1cecb3c5
DB
118stap_client_connect_LDFLAGS = $(AM_LDFLAGS)
119stap_server_connect_LDFLAGS = $(AM_LDFLAGS)
b9c1510e 120stap_sign_module_LDFLAGS = $(AM_LDFLAGS)
a0fc7f8e
DB
121
122if BUILD_SERVER
123install-exec-local: install-scripts
124
125PHONIES += install-scripts
126# scripts must be installed before this rule is run
961588fd 127install-scripts: install-binSCRIPTS install-pkglibexecSCRIPTS
a0fc7f8e 128 for f in $(bin_SCRIPTS); do \
961588fd
DB
129 sed -i -e "s,\$${PKGLIBEXECDIR},$(pkglibexecdir)/," $(DESTDIR)$(bindir)/$$f; \
130 done
131 for f in $(pkglibexec_SCRIPTS); do \
60045090 132 sed -i -e "/INSTALL-HOOK/d;s,exec_prefix=.*,exec_prefix=$(exec_prefix)/bin/,;s,sysconfdir=.*,sysconfdir=$(sysconfdir),;s,pkglibexecdir=.*,pkglibexecdir=$(pkglibexecdir)/,;s,localstatedir=.*,localstatedir=$(localstatedir),;s,\$${PKGLIBEXECDIR},$(pkglibexecdir)/," $(DESTDIR)$(pkglibexecdir)/$$f; \
a0fc7f8e
DB
133 done
134endif
19a0d4b6 135endif
337cd273 136
e460639f
RM
137if BUILD_ELFUTILS
138stap_CPPFLAGS += -Iinclude-elfutils
139stap_LDFLAGS += -Llib-elfutils -Wl,-rpath-link,lib-elfutils \
140 -Wl,--enable-new-dtags,-rpath,$(pkglibdir)
b976b20e
FCE
141
142
e434132f 143BUILT_SOURCES += stamp-elfutils
e460639f
RM
144CLEANFILES += stamp-elfutils
145stamp-elfutils: config.status
b01369ba 146 $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils all bin_PROGRAMS=
e460639f 147 for dir in libelf libebl libdw libdwfl backends; do \
e6364d79 148 $(MAKE) $(AM_MAKEFLAGS) -j1 -C build-elfutils/$$dir bin_PROGRAMS= install; \
e460639f
RM
149 done
150 touch $@
1cecb3c5 151stap_DEPENDENCIES += lib-elfutils/libdw.so
e460639f
RM
152lib-elfutils/libdw.so: stamp-elfutils ;
153
337cd273 154PHONIES += install-elfutils
e460639f 155install-elfutils:
17a127da 156 mkdir -p $(DESTDIR)$(pkglibdir)
a3e695ac 157 for file in lib-elfutils/*.so* lib-elfutils/${PACKAGE_NAME}/*.so*; do \
17a127da 158 $(INSTALL_PROGRAM) $$file $(DESTDIR)$(pkglibdir); \
a3e695ac 159 done
e460639f
RM
160install-exec-local: install-elfutils
161endif
6d14a4a9 162endif
552276c8 163
c32d53de 164CLEANFILES += $(pkglibexec_PROGRAMS)
e460639f 165
6d14a4a9 166if BUILD_TRANSLATOR
a0fc7f8e
DB
167if HAVE_NSS
168stap_sign_module_SOURCES = modsign.cxx nsscommon.c
169stap_sign_module_CPPFLAGS = -Wall -Werror $(AM_CPPFLAGS) $(nss_CFLAGS) $(nspr_CFLAGS)
170stap_sign_module_LDADD = -lnss3 -lnspr4
171
6d14a4a9 172if BUILD_SERVER
739cf687 173stap_client_connect_SOURCES = stap-client-connect.c nsscommon.c
6d14a4a9 174stap_client_connect_CFLAGS = -Wall -Werror $(nss_CFLAGS) $(nspr_CFLAGS)
e3851784 175stap_client_connect_LDADD = -lssl3 -lnss3 -lnspr4 -lplc4
6d14a4a9 176
739cf687 177stap_server_connect_SOURCES = stap-server-connect.c nsscommon.c
6d14a4a9 178stap_server_connect_CFLAGS = -Wall -Werror $(nss_CFLAGS) $(nspr_CFLAGS)
e3851784 179stap_server_connect_LDADD = -lssl3 -lnss3 -lnspr4 -lplc4
a0fc7f8e 180endif
6d14a4a9
EB
181endif
182
5a5e5134 183noinst_PROGRAMS = loc2c-test
51e874a1 184loc2c_test_SOURCES = loc2c-test.c loc2c.c
5574ef2c 185loc2c_test_CFLAGS = $(stap_CFLAGS)
e460639f
RM
186loc2c_test_CPPFLAGS = $(stap_CPPFLAGS)
187loc2c_test_LDFLAGS = $(stap_LDFLAGS)
188loc2c_test_LDADD = $(stap_LDADD)
6d14a4a9 189endif
51e874a1 190
35a04c8e
FCE
191# crash(8) extension
192if BUILD_CRASHMOD
193STAPLOG=staplog.so
194
195$(STAPLOG): staplog.c
564eb0a8
DS
196 $(CC) $(staplog_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -shared -rdynamic \
197 $(AM_LDFLAGS) $(LDFLAGS) -fPIC -o $@ $<
551a4f58 198all-local: $(STAPLOG) example_index
35a04c8e 199install-exec-local: $(STAPLOG)
674427d3 200 $(MKDIR_P) $(DESTDIR)$(pkglibdir)
17a127da 201 $(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir)
551a4f58
MW
202else
203all-local: example_index
35a04c8e
FCE
204endif
205
2f1a1aea
FCE
206# Get extra libs as needed
207LDADD =
208
ec4d1558 209EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples
551a4f58 210EXAMPLE_META_FILES = $(EXAMPLE_SOURCE_DIR)/*/*.meta
551a4f58 211
751f8288 212example_index: $(EXAMPLE_SOURCE_DIR)/index.html
551a4f58 213
751f8288 214$(EXAMPLE_SOURCE_DIR)/index.html: $(EXAMPLE_META_FILES) $(EXAMPLE_INDEX_GEN)
59ec9408
FCE
215 @echo "The script example index is outdated, run"
216 @echo " cd $(EXAMPLE_SOURCE_DIR) && \\ "
217 @echo " perl examples-index-gen.pl"
218 @echo "to regenerate it."
ec4d1558 219
ecfa3e8b 220install-data-local:
ef9e124a 221 (cd $(srcdir)/runtime; for f in *.[ch]; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/$$f; done)
aaf2af3e
FCE
222 (cd $(srcdir)/runtime/unwind; find . \( -name '*.[ch]' \) -print \
223 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/unwind/$$f; done)
ef9e124a
MH
224 (cd $(srcdir)/runtime/transport; for f in *.[ch]; \
225 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/transport/$$f; done)
6274464e 226 (cd $(srcdir)/runtime/uprobes; for f in Makefile *.[ch]; \
36b16282 227 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/uprobes/$$f; done)
904b272c
JK
228 (cd $(srcdir)/runtime/uprobes2; for f in *.[ch]; \
229 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/uprobes2/$$f; done)
4b2c4ab5 230 (cd $(srcdir)/tapset; find . \( -name '*.stp' -o -name README \) -print \
ef9e124a 231 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/tapset/$$f; done)
751f8288 232 (cd $(srcdir)/testsuite/systemtap.examples; find . -type f -print \
9b3f22a9 233 | egrep -v 'check.exp|ChangeLog|examples-index-gen.pl' \
5b8561dc
MW
234 | while read f; do if test -x $$f; then \
235 i_cmd="$(INSTALL_PROGRAM)"; else \
236 i_cmd="$(INSTALL_DATA)"; fi; \
237 $$i_cmd -D $$f $(DESTDIR)$(docdir)/examples/$$f; done)
552276c8 238 test -e $(DESTDIR)$(sysconfdir)/systemtap || mkdir -p $(DESTDIR)$(sysconfdir)/systemtap
60045090
DB
239if BUILD_SERVER
240 test -e $(DESTDIR)$(localstatedir)/run/stap-server || mkdir -p $(DESTDIR)$(localstatedir)/run/stap-server
241 test -e $(DESTDIR)$(localstatedir)/log || mkdir -p $(DESTDIR)$(localstatedir)/log
242endif
b46393fc
WC
243 (cd $(srcdir)/man; for f in *.3*; do $(INSTALL_DATA) -D $$f "$(DESTDIR)$(man3dir)/$$f" || exit $$?; done)
244
ecfa3e8b 245
e885b2ec
WC
246TEST_COV_DIR = coverage
247
af56020f 248gcov:
e885b2ec 249 @-$(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" all check
af56020f 250 @gcov *.gcno >/dev/null 2>&1
af56020f
FCE
251 @rm -f `ls -1 *.gcov | fgrep -v .cxx.gcov`
252 ls -l *.cxx.gcov
253
e885b2ec
WC
254lcov:
255 @lcov --directory . -z
256 @-$(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" all check
257 @lcov --directory . -c -o stap.info
258 @genhtml -o ./$(TEST_COV_DIR) stap.info
259
1e7ad3bf 260clean-local:
f00a8372
RM
261 rm -f *.gcov *.gcno *.gcda ${PACKAGE_TARNAME}-*.tar.gz
262 rm -rf ${PACKAGE_TARNAME}-${PACKAGE_VERSION}
e885b2ec
WC
263 rm -rf $(TEST_COV_DIR)
264 rm -rf stap.info
35a04c8e 265 rm -rf staplog.so
1c4cf93d
MW
266
267distclean-local:
daae650d 268 rm -rf build-elfutils include-elfutils lib-elfutils
4d4f412b
FCE
269
270uninstall-local:
271 rm -rf $(DESTDIR)$(pkgdatadir)
35a04c8e 272 rm -rf $(DESTDIR)$(libdir)/$(PACKAGE)
4d4f412b 273 -rm -rf $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)
ec4d1558
MW
274 @list='$(EXAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \
275 echo " rm -f '$(EXAMPLE_INSTALL_DIR)/$$p'"; \
276 rm -f "$(EXAMPLE_INSTALL_DIR)/$$p"; \
277 done
278 @list='$(DEMO_SRC)'; for f in $$list; do p=`basename $$f`; \
279 echo " rm -f '$(DEMO_INSTALL_DIR)/$$p'"; \
280 rm -f "$(DEMO_INSTALL_DIR)/$$p"; \
281 done
282 @list='$(SAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \
283 echo " rm -f '$(SAMPLE_INSTALL_DIR)/$$p'"; \
284 rm -f "$(SAMPLE_INSTALL_DIR)/$$p"; \
285 done
8cd5d9f0 286 rm -rf $(DESTDIR)$(sysconfdir)/systemtap
e1335449 287 rm -rf $(DESTDIR)$(docdir)/examples
60045090
DB
288if BUILD_SERVER
289 rm -rf $(DESTDIR)$(localstatedir)/run/stap-server
2648a9b4 290 rm -f $(DESTDIR)$(localstatedir)/log/stap-server/log
60045090 291endif
b46393fc 292 (cd $(srcdir)/man; for f in *.3*; do rm -rf "$(DESTDIR)$(man3dir)/$$f"; done)
8129fd92 293
d0efb32d 294SUBDIRS = doc grapher runtime/staprun
2a650e10
MW
295DIST_SUBDIRS = testsuite $(SUBDIRS)
296EXTRA_DIST = man/tapset*.3stap
5ba96b90 297
4b3c90da 298check-local:
17a127da 299 SRCDIR=`cd $(srcdir); pwd`; \
818ba2bc 300 PWD=`pwd`; \
645d2e52 301 $(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)";
5ba96b90
FCE
302
303installcheck:
20fb5020
MW
304 if test \! -e $(DESTDIR)$(bindir)/stap; then \
305 echo $(DESTDIR)$(bindir)/stap doesn\'t exist, run make install; \
306 exit -1; \
0e47827d 307 fi; \
20fb5020
MW
308 if test $(builddir)/stap -nt $(DESTDIR)$(bindir)/stap; then \
309 echo "$(DESTDIR)$(bindir)/stap is not recent, run make install"; \
310 exit -1; \
d5658775 311 fi;
a5b17365 312 $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)"
8f3c45cc 313
cb3f3970
RM
314PHONIES += runcheck
315# All the variables are overridden by run-stap, but SYSTEMTAP_RUNTIME
316# is used by the testsuite scripts themselves.
317runcheck: testsuite/stap
318 $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" \
319 SYSTEMTAP_PATH="`cd testsuite; pwd`" \
320 SYSTEMTAP_RUNTIME="`cd $(srcdir)/runtime; pwd`"
321testsuite/stap: run-stap
322 (echo '#!/bin/sh'; echo "exec `pwd`/run-stap" '$${1+"$$@"}') > $@.new
323 chmod 555 $@.new
324 mv -f $@.new $@
4040e9ea
FCE
325
326# Any extra flags, such as:
327# --define "with_docs 0"
328# --define "with_bundled_elfutils 1" --define "elfutils_version 0.135"
329RPMBUILDFLAGS=
330
337cd273
FCE
331PHONIES += dist-gzip
332
333.PHONY: $(PHONIES)
334
813ed4cb 335dist-gzip:
4040e9ea
FCE
336 cd $(srcdir); git status | grep working.directory.clean || (echo "You should commit your changes before 'make rpm'.")
337 (cd $(srcdir); git archive --prefix=systemtap-$(VERSION)/ --format=tar HEAD) | gzip > systemtap-$(VERSION).tar.gz
813ed4cb 338
9b2e2b58 339rpm: dist-gzip
4040e9ea
FCE
340 mkdir -p `rpm --eval %_specdir`
341 mkdir -p `rpm --eval %_srcrpmdir`
342 mkdir -p `rpm --eval %_rpmdir`
343 mkdir -p `rpm --eval %_builddir`
344 mkdir -p `rpm --eval %_buildroot`
345 rpmbuild --define "_sourcedir $(PWD)/" -ta systemtap-$(VERSION).tar.gz $(RPMBUILDFLAGS)
This page took 0.12228 seconds and 5 git commands to generate.