]> sourceware.org Git - systemtap.git/blame - Makefile.am
Fix build error when !HAVE_NSS
[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 \
e97c0b29
WC
16staprun.8 \
17man/stapprobes.iosched.3stap man/stapprobes.netdev.3stap \
18man/stapprobes.nfs.3stap man/stapprobes.nfsd.3stap \
1f65cc4f 19man/stapprobes.pagefault.3stap man/stapprobes.kprocess.3stap \
e97c0b29
WC
20man/stapprobes.rpc.3stap man/stapprobes.scsi.3stap \
21man/stapprobes.signal.3stap man/stapprobes.socket.3stap \
22man/stapprobes.tcp.3stap man/stapprobes.udp.3stap
4040e9ea
FCE
23# see also configure.ac
24
6d14a4a9 25bin_PROGRAMS = staprun
a0fc7f8e 26bin_SCRIPTS = stap-report
818ba2bc 27oldinclude_HEADERS = includes/sys/sdt.h
6d14a4a9
EB
28
29if BUILD_TRANSLATOR
30bin_PROGRAMS += stap
31man_MANS += stap.1
32bin_SCRIPTS += dtrace
33
a0fc7f8e
DB
34if HAVE_NSS
35bin_PROGRAMS += stap-sign-module
36bin_SCRIPTS += stap-env stap-gen-cert stap-authorize-cert stap-authorize-signing-cert
37
19a0d4b6
MW
38if BUILD_SERVER
39man_MANS += stap-server.8
a0fc7f8e 40bin_PROGRAMS += stap-client-connect stap-server-connect
19a0d4b6
MW
41bin_SCRIPTS += stap-client stap-serverd stap-server stap-find-servers \
42 stap-start-server stap-find-or-start-server stap-stop-server \
2035bcd4 43 stap-authorize-server-cert
19a0d4b6 44endif
a0fc7f8e 45endif
6d14a4a9 46
56e12059 47stap_SOURCES = main.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
MW
53 tapset-utrace.cxx task_finder.cxx dwflpp.cxx rpm_finder.cxx \
54 setupdwfl.cxx
2ed04863 55stap_LDADD = @stap_LIBS@ @sqlite3_LIBS@ @rpm_LIBS@
6d14a4a9
EB
56stap_DEPENDENCIES =
57endif
e9d58a72 58
e434132f
FCE
59BUILT_SOURCES =
60CLEANFILES =
61
62# Arrange for git_version.h to be regenerated at every "make".
4040e9ea 63# Code fragment is based upon RadeonHD.am.
e434132f
FCE
64
65# The stamp file which is never created ensures that git_version.h is updated
66# before every build. Having git_version.h in foo_SOURCES ensures a recompile
67# of foo-bar.c if it is newer than the foo-bar.o file. Using noinst_foo_SOURCES
68# instead of foo_SOURCES prevents shipping git_version.h in dist tarballs,
69# which may cause false GIT_FOO readings.
70BUILT_SOURCES += git_version.stamp
71CLEANFILES += git_version.h
72GIT_VERSION_CMD = $(SHELL) $(top_srcdir)/git_version.sh
73git_version.stamp:
74 @if test -f "$(srcdir)/git_version.h"; then \
75 if test -f "git_version.h"; then :; \
76 else \
77 cp "$(srcdir)/git_version.h" "git_version.h"; \
78 fi; \
79 fi
80 $(GIT_VERSION_CMD) -k -s $(top_srcdir) -o git_version.h
81 @if test -s "$(srcdir)/git_version.h"; then \
82 if cmp "$(srcdir)/git_version.h" "git_version.h"; then :; \
83 else \
84 echo "Error: $(srcdir)/git_version.h and git_version.h differ."; \
85 echo " You probably want to remove the former."; \
86 exit 1; \
87 fi; \
88 fi
89
c0f9d4b0
FCE
90git_version.h:
91 $(srcdir)/git_version.sh -k --srcdir $(srcdir) -o git_version.h
e9d58a72 92
8437928b 93cscope:
6cf88792
FCE
94 cd $(srcdir) && \
95 (echo -q ; git ls-files '*.cxx' '*.c' '*.h' | grep -v '^testsuite' ) > cscope.files && \
8437928b 96 cscope -b -q
e434132f 97
6d14a4a9
EB
98PHONIES =
99if BUILD_TRANSLATOR
5574ef2c
MW
100stap_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@
101stap_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@
e460639f 102stap_CPPFLAGS = $(AM_CPPFLAGS)
8730f377 103stap_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
19a0d4b6 104
2035bcd4 105if HAVE_NSS
1cecb3c5
DB
106stap_client_connect_LDFLAGS = $(AM_LDFLAGS)
107stap_server_connect_LDFLAGS = $(AM_LDFLAGS)
b9c1510e 108stap_sign_module_LDFLAGS = $(AM_LDFLAGS)
a0fc7f8e
DB
109
110if BUILD_SERVER
111install-exec-local: install-scripts
112
113PHONIES += install-scripts
114# scripts must be installed before this rule is run
115install-scripts: install-binSCRIPTS
116 for f in $(bin_SCRIPTS); do \
117 sed -i -e "/INSTALL-HOOK/d;s,exec_prefix=.*,exec_prefix=$(exec_prefix)/bin/,;s,sysconfdir=.*,sysconfdir=$(sysconfdir)," $(DESTDIR)$(bindir)/$$f; \
118 done
119endif
19a0d4b6 120endif
337cd273 121
e460639f
RM
122if BUILD_ELFUTILS
123stap_CPPFLAGS += -Iinclude-elfutils
124stap_LDFLAGS += -Llib-elfutils -Wl,-rpath-link,lib-elfutils \
125 -Wl,--enable-new-dtags,-rpath,$(pkglibdir)
b976b20e
FCE
126
127
e434132f 128BUILT_SOURCES += stamp-elfutils
e460639f
RM
129CLEANFILES += stamp-elfutils
130stamp-elfutils: config.status
b01369ba 131 $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils all bin_PROGRAMS=
e460639f 132 for dir in libelf libebl libdw libdwfl backends; do \
b01369ba 133 $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils/$$dir bin_PROGRAMS= install; \
e460639f
RM
134 done
135 touch $@
1cecb3c5 136stap_DEPENDENCIES += lib-elfutils/libdw.so
e460639f
RM
137lib-elfutils/libdw.so: stamp-elfutils ;
138
337cd273 139PHONIES += install-elfutils
e460639f 140install-elfutils:
17a127da 141 mkdir -p $(DESTDIR)$(pkglibdir)
a3e695ac 142 for file in lib-elfutils/*.so* lib-elfutils/${PACKAGE_NAME}/*.so*; do \
17a127da 143 $(INSTALL_PROGRAM) $$file $(DESTDIR)$(pkglibdir); \
a3e695ac 144 done
e460639f
RM
145install-exec-local: install-elfutils
146endif
d04cf5ff 147
6d14a4a9 148endif
552276c8 149
98aab489 150staprun_SOURCES = runtime/staprun/staprun.c runtime/staprun/staprun_funcs.c\
337cd273 151 runtime/staprun/ctl.c runtime/staprun/common.c
e65b03c1 152
7651c16b 153staprun_CPPFLAGS = $(AM_CPPFLAGS)
47f390f9 154staprun_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ -DSINGLE_THREADED -fno-strict-aliasing -fno-builtin-strftime
5574ef2c 155staprun_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
47f390f9 156staprun_LDADD =
2f1a1aea 157
2035bcd4
DB
158if HAVE_NSS
159staprun_SOURCES += runtime/staprun/modverify.c nsscommon.c
160staprun_CFLAGS += $(nss_CFLAGS) $(nspr_CFLAGS)
e3851784 161staprun_LDADD += -lnss3 -lnspr4
2035bcd4
DB
162endif
163
98aab489
DS
164stapio_SOURCES = runtime/staprun/stapio.c \
165 runtime/staprun/mainloop.c runtime/staprun/common.c \
4776796a 166 runtime/staprun/ctl.c \
4040e9ea 167 runtime/staprun/relay.c runtime/staprun/relay_old.c
47f390f9 168stapio_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ -fno-strict-aliasing -fno-builtin-strftime
5574ef2c 169stapio_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
47f390f9 170stapio_LDADD = -lpthread
98aab489 171
1cecb3c5 172
98aab489 173install-exec-hook:
7ab87feb
FCE
174 if [ `id -u` -eq 0 ]; then chmod 04111 "$(DESTDIR)$(bindir)/staprun"; fi
175
176# Why the "id -u" condition? This way, an unprivileged user can run
177# make install, and have "sudo stap ...." or "sudo staprun ...." work later.
178
98aab489
DS
179
180pkglibexec_PROGRAMS = stapio
181CLEANFILES += $(pkglibexec_PROGRAMS)
e460639f 182
6d14a4a9 183if BUILD_TRANSLATOR
a0fc7f8e
DB
184if HAVE_NSS
185stap_sign_module_SOURCES = modsign.cxx nsscommon.c
186stap_sign_module_CPPFLAGS = -Wall -Werror $(AM_CPPFLAGS) $(nss_CFLAGS) $(nspr_CFLAGS)
187stap_sign_module_LDADD = -lnss3 -lnspr4
188
6d14a4a9 189if BUILD_SERVER
739cf687 190stap_client_connect_SOURCES = stap-client-connect.c nsscommon.c
6d14a4a9 191stap_client_connect_CFLAGS = -Wall -Werror $(nss_CFLAGS) $(nspr_CFLAGS)
e3851784 192stap_client_connect_LDADD = -lssl3 -lnss3 -lnspr4 -lplc4
6d14a4a9 193
739cf687 194stap_server_connect_SOURCES = stap-server-connect.c nsscommon.c
6d14a4a9 195stap_server_connect_CFLAGS = -Wall -Werror $(nss_CFLAGS) $(nspr_CFLAGS)
e3851784 196stap_server_connect_LDADD = -lssl3 -lnss3 -lnspr4 -lplc4
a0fc7f8e 197endif
6d14a4a9
EB
198endif
199
5a5e5134 200noinst_PROGRAMS = loc2c-test
51e874a1 201loc2c_test_SOURCES = loc2c-test.c loc2c.c
5574ef2c 202loc2c_test_CFLAGS = $(stap_CFLAGS)
e460639f
RM
203loc2c_test_CPPFLAGS = $(stap_CPPFLAGS)
204loc2c_test_LDFLAGS = $(stap_LDFLAGS)
205loc2c_test_LDADD = $(stap_LDADD)
6d14a4a9 206endif
51e874a1 207
35a04c8e
FCE
208# crash(8) extension
209if BUILD_CRASHMOD
210STAPLOG=staplog.so
211
212$(STAPLOG): staplog.c
564eb0a8
DS
213 $(CC) $(staplog_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -shared -rdynamic \
214 $(AM_LDFLAGS) $(LDFLAGS) -fPIC -o $@ $<
551a4f58 215all-local: $(STAPLOG) example_index
35a04c8e 216install-exec-local: $(STAPLOG)
674427d3 217 $(MKDIR_P) $(DESTDIR)$(pkglibdir)
17a127da 218 $(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir)
551a4f58
MW
219else
220all-local: example_index
35a04c8e
FCE
221endif
222
2f1a1aea
FCE
223# Get extra libs as needed
224LDADD =
225
ec4d1558 226EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples
551a4f58 227EXAMPLE_META_FILES = $(EXAMPLE_SOURCE_DIR)/*/*.meta
551a4f58 228
751f8288 229example_index: $(EXAMPLE_SOURCE_DIR)/index.html
551a4f58 230
751f8288 231$(EXAMPLE_SOURCE_DIR)/index.html: $(EXAMPLE_META_FILES) $(EXAMPLE_INDEX_GEN)
59ec9408
FCE
232 @echo "The script example index is outdated, run"
233 @echo " cd $(EXAMPLE_SOURCE_DIR) && \\ "
234 @echo " perl examples-index-gen.pl"
235 @echo "to regenerate it."
ec4d1558 236
ecfa3e8b 237install-data-local:
ef9e124a 238 (cd $(srcdir)/runtime; for f in *.[ch]; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/$$f; done)
aaf2af3e
FCE
239 (cd $(srcdir)/runtime/unwind; find . \( -name '*.[ch]' \) -print \
240 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/unwind/$$f; done)
ef9e124a
MH
241 (cd $(srcdir)/runtime/transport; for f in *.[ch]; \
242 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/transport/$$f; done)
6274464e 243 (cd $(srcdir)/runtime/uprobes; for f in Makefile *.[ch]; \
36b16282 244 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/uprobes/$$f; done)
904b272c
JK
245 (cd $(srcdir)/runtime/uprobes2; for f in *.[ch]; \
246 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/uprobes2/$$f; done)
4b2c4ab5 247 (cd $(srcdir)/tapset; find . \( -name '*.stp' -o -name README \) -print \
ef9e124a 248 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/tapset/$$f; done)
751f8288 249 (cd $(srcdir)/testsuite/systemtap.examples; find . -type f -print \
9b3f22a9 250 | egrep -v 'check.exp|ChangeLog|examples-index-gen.pl' \
5b8561dc
MW
251 | while read f; do if test -x $$f; then \
252 i_cmd="$(INSTALL_PROGRAM)"; else \
253 i_cmd="$(INSTALL_DATA)"; fi; \
254 $$i_cmd -D $$f $(DESTDIR)$(docdir)/examples/$$f; done)
552276c8 255 test -e $(DESTDIR)$(sysconfdir)/systemtap || mkdir -p $(DESTDIR)$(sysconfdir)/systemtap
ecfa3e8b 256
e885b2ec
WC
257TEST_COV_DIR = coverage
258
af56020f 259gcov:
e885b2ec 260 @-$(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" all check
af56020f 261 @gcov *.gcno >/dev/null 2>&1
af56020f
FCE
262 @rm -f `ls -1 *.gcov | fgrep -v .cxx.gcov`
263 ls -l *.cxx.gcov
264
e885b2ec
WC
265lcov:
266 @lcov --directory . -z
267 @-$(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" all check
268 @lcov --directory . -c -o stap.info
269 @genhtml -o ./$(TEST_COV_DIR) stap.info
270
1e7ad3bf 271clean-local:
f00a8372
RM
272 rm -f *.gcov *.gcno *.gcda ${PACKAGE_TARNAME}-*.tar.gz
273 rm -rf ${PACKAGE_TARNAME}-${PACKAGE_VERSION}
e885b2ec
WC
274 rm -rf $(TEST_COV_DIR)
275 rm -rf stap.info
35a04c8e 276 rm -rf staplog.so
1c4cf93d
MW
277
278distclean-local:
daae650d 279 rm -rf build-elfutils include-elfutils lib-elfutils
4d4f412b
FCE
280
281uninstall-local:
282 rm -rf $(DESTDIR)$(pkgdatadir)
35a04c8e 283 rm -rf $(DESTDIR)$(libdir)/$(PACKAGE)
4d4f412b 284 -rm -rf $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)
ec4d1558
MW
285 @list='$(EXAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \
286 echo " rm -f '$(EXAMPLE_INSTALL_DIR)/$$p'"; \
287 rm -f "$(EXAMPLE_INSTALL_DIR)/$$p"; \
288 done
289 @list='$(DEMO_SRC)'; for f in $$list; do p=`basename $$f`; \
290 echo " rm -f '$(DEMO_INSTALL_DIR)/$$p'"; \
291 rm -f "$(DEMO_INSTALL_DIR)/$$p"; \
292 done
293 @list='$(SAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \
294 echo " rm -f '$(SAMPLE_INSTALL_DIR)/$$p'"; \
295 rm -f "$(SAMPLE_INSTALL_DIR)/$$p"; \
296 done
8cd5d9f0 297 rm -rf $(DESTDIR)$(sysconfdir)/systemtap
e1335449 298 rm -rf $(DESTDIR)$(docdir)/examples
8129fd92 299
1087b83f
TM
300SUBDIRS = doc grapher
301DIST_SUBDIRS = testsuite $(SUBDIRS)
5ba96b90 302
4b3c90da 303check-local:
17a127da 304 SRCDIR=`cd $(srcdir); pwd`; \
818ba2bc
MW
305 PWD=`pwd`; \
306 $(MAKE) -C testsuite check SYSTEMTAP_RUNTIME=$$SRCDIR/runtime SYSTEMTAP_TAPSET=$$SRCDIR/tapset LD_LIBRARY_PATH=$$PWD/lib-elfutils:$$PWD/lib-elfutils/systemtap SYSTEMTAP_PATH=$$PWD SYSTEMTAP_INCLUDES=$$PWD/includes RUNTESTFLAGS="$(RUNTESTFLAGS)";
5ba96b90
FCE
307
308installcheck:
20fb5020
MW
309 if test \! -e $(DESTDIR)$(bindir)/stap; then \
310 echo $(DESTDIR)$(bindir)/stap doesn\'t exist, run make install; \
311 exit -1; \
0e47827d 312 fi; \
20fb5020
MW
313 if test $(builddir)/stap -nt $(DESTDIR)$(bindir)/stap; then \
314 echo "$(DESTDIR)$(bindir)/stap is not recent, run make install"; \
315 exit -1; \
d5658775 316 fi;
b5935516 317 $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)"
8f3c45cc 318
4040e9ea
FCE
319
320# Any extra flags, such as:
321# --define "with_docs 0"
322# --define "with_bundled_elfutils 1" --define "elfutils_version 0.135"
323RPMBUILDFLAGS=
324
337cd273
FCE
325PHONIES += dist-gzip
326
327.PHONY: $(PHONIES)
328
813ed4cb 329dist-gzip:
4040e9ea
FCE
330 cd $(srcdir); git status | grep working.directory.clean || (echo "You should commit your changes before 'make rpm'.")
331 (cd $(srcdir); git archive --prefix=systemtap-$(VERSION)/ --format=tar HEAD) | gzip > systemtap-$(VERSION).tar.gz
813ed4cb 332
9b2e2b58 333rpm: dist-gzip
4040e9ea
FCE
334 mkdir -p `rpm --eval %_specdir`
335 mkdir -p `rpm --eval %_srcrpmdir`
336 mkdir -p `rpm --eval %_rpmdir`
337 mkdir -p `rpm --eval %_builddir`
338 mkdir -p `rpm --eval %_buildroot`
339 rpmbuild --define "_sourcedir $(PWD)/" -ta systemtap-$(VERSION).tar.gz $(RPMBUILDFLAGS)
This page took 0.114032 seconds and 5 git commands to generate.