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