]> sourceware.org Git - systemtap.git/blame - Makefile.am
Correct email address for doc/ChangeLog
[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
4040e9ea 4AUTOMAKE_OPTIONS = no-dist
42b926b7 5
e460639f 6pkglibexecdir = ${libexecdir}/${PACKAGE}
b899aa79 7oldincludedir = ${includedir}/sys
e460639f 8
6bc51533 9AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DPKGDATADIR='"${pkgdatadir}"' -DPKGLIBDIR='"$(pkglibexecdir)"'
f00a8372 10
8558d392 11AM_CFLAGS = -D_GNU_SOURCE -fexceptions -Wall -Werror -Wunused -Wformat=2 -W
a4531d21 12AM_CXXFLAGS = -Wall -Werror
77de5e9e 13
19a0d4b6 14man_MANS = stap.1 stapprobes.5 stapfuncs.5 stapvars.5 stapex.5 staprun.8 man/stapprobes.iosched.5 man/stapprobes.netdev.5 man/stapprobes.nfs.5 man/stapprobes.nfsd.5 man/stapprobes.pagefault.5 man/stapprobes.process.5 man/stapprobes.rpc.5 man/stapprobes.scsi.5 man/stapprobes.signal.5 man/stapprobes.socket.5 man/stapprobes.tcp.5 man/stapprobes.udp.5
4040e9ea
FCE
15# see also configure.ac
16
19a0d4b6
MW
17bin_PROGRAMS = stap staprun
18bin_SCRIPTS = stap-report
b899aa79 19oldinclude_HEADERS = runtime/sdt.h
19a0d4b6
MW
20if BUILD_SERVER
21man_MANS += stap-server.8
22bin_PROGRAMS += stap-client-connect stap-server-connect
23bin_SCRIPTS += stap-client stap-serverd stap-server stap-find-servers \
24 stap-start-server stap-find-or-start-server stap-stop-server \
25 stap-gen-server-cert stap-add-server-cert
26endif
b899aa79 27bin_SCRIPTS += dtrace
56e12059 28stap_SOURCES = main.cxx \
f4b28491 29 parse.cxx staptree.cxx elaborate.cxx translate.cxx \
1b78aef5 30 tapsets.cxx buildrun.cxx loc2c.c hash.cxx mdfour.c \
86bf665e 31 cache.cxx util.cxx coveragedb.cxx dwarf_wrappers.cxx
42feb3c0 32stap_LDADD = @stap_LIBS@ @sqlite3_LIBS@
e9d58a72 33
e434132f
FCE
34BUILT_SOURCES =
35CLEANFILES =
1cecb3c5 36stap_DEPENDENCIES =
e434132f
FCE
37
38# Arrange for git_version.h to be regenerated at every "make".
4040e9ea 39# Code fragment is based upon RadeonHD.am.
e434132f
FCE
40
41# The stamp file which is never created ensures that git_version.h is updated
42# before every build. Having git_version.h in foo_SOURCES ensures a recompile
43# of foo-bar.c if it is newer than the foo-bar.o file. Using noinst_foo_SOURCES
44# instead of foo_SOURCES prevents shipping git_version.h in dist tarballs,
45# which may cause false GIT_FOO readings.
46BUILT_SOURCES += git_version.stamp
47CLEANFILES += git_version.h
48GIT_VERSION_CMD = $(SHELL) $(top_srcdir)/git_version.sh
49git_version.stamp:
50 @if test -f "$(srcdir)/git_version.h"; then \
51 if test -f "git_version.h"; then :; \
52 else \
53 cp "$(srcdir)/git_version.h" "git_version.h"; \
54 fi; \
55 fi
56 $(GIT_VERSION_CMD) -k -s $(top_srcdir) -o git_version.h
57 @if test -s "$(srcdir)/git_version.h"; then \
58 if cmp "$(srcdir)/git_version.h" "git_version.h"; then :; \
59 else \
60 echo "Error: $(srcdir)/git_version.h and git_version.h differ."; \
61 echo " You probably want to remove the former."; \
62 exit 1; \
63 fi; \
64 fi
65
c0f9d4b0
FCE
66git_version.h:
67 $(srcdir)/git_version.sh -k --srcdir $(srcdir) -o git_version.h
e9d58a72 68
8437928b 69cscope:
6cf88792
FCE
70 cd $(srcdir) && \
71 (echo -q ; git ls-files '*.cxx' '*.c' '*.h' | grep -v '^testsuite' ) > cscope.files && \
8437928b 72 cscope -b -q
e434132f
FCE
73
74
78f6bba6 75stap_CXXFLAGS = $(AM_CXXFLAGS)
e460639f 76stap_CPPFLAGS = $(AM_CPPFLAGS)
8730f377
FCE
77stap_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
78staprun_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
b976b20e 79stapio_CPPFLAGS = $(AM_CPPFLAGS)
8730f377 80stapio_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
19a0d4b6
MW
81
82if BUILD_SERVER
1cecb3c5
DB
83stap_client_connect_LDFLAGS = $(AM_LDFLAGS)
84stap_server_connect_LDFLAGS = $(AM_LDFLAGS)
19a0d4b6 85endif
337cd273
FCE
86
87PHONIES =
e460639f
RM
88if BUILD_ELFUTILS
89stap_CPPFLAGS += -Iinclude-elfutils
90stap_LDFLAGS += -Llib-elfutils -Wl,-rpath-link,lib-elfutils \
91 -Wl,--enable-new-dtags,-rpath,$(pkglibdir)
b976b20e
FCE
92
93
e434132f 94BUILT_SOURCES += stamp-elfutils
e460639f
RM
95CLEANFILES += stamp-elfutils
96stamp-elfutils: config.status
b01369ba 97 $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils all bin_PROGRAMS=
e460639f 98 for dir in libelf libebl libdw libdwfl backends; do \
b01369ba 99 $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils/$$dir bin_PROGRAMS= install; \
e460639f
RM
100 done
101 touch $@
1cecb3c5 102stap_DEPENDENCIES += lib-elfutils/libdw.so
e460639f
RM
103lib-elfutils/libdw.so: stamp-elfutils ;
104
f28a8c28
SC
105pkglib_LIBRARIES = libsduprobes.a
106libsduprobes_a_SOURCES = runtime/sduprobes.c
107sduprobes.o: runtime/sduprobes.c
108 $(CC) -g -O0 -c -o $@ $<
109
337cd273 110PHONIES += install-elfutils
e460639f 111install-elfutils:
17a127da 112 mkdir -p $(DESTDIR)$(pkglibdir)
a3e695ac 113 for file in lib-elfutils/*.so* lib-elfutils/${PACKAGE_NAME}/*.so*; do \
17a127da 114 $(INSTALL_PROGRAM) $$file $(DESTDIR)$(pkglibdir); \
a3e695ac 115 done
e460639f
RM
116install-exec-local: install-elfutils
117endif
d04cf5ff 118
98aab489 119staprun_SOURCES = runtime/staprun/staprun.c runtime/staprun/staprun_funcs.c\
337cd273 120 runtime/staprun/ctl.c runtime/staprun/common.c
e65b03c1 121
7651c16b 122staprun_CPPFLAGS = $(AM_CPPFLAGS)
3a4e19b8 123staprun_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -DSINGLE_THREADED -fno-strict-aliasing
337cd273 124staprun_LDADD = @PROCFLAGS@
2f1a1aea 125
98aab489
DS
126stapio_SOURCES = runtime/staprun/stapio.c \
127 runtime/staprun/mainloop.c runtime/staprun/common.c \
4776796a 128 runtime/staprun/ctl.c \
4040e9ea 129 runtime/staprun/relay.c runtime/staprun/relay_old.c
3a4e19b8 130stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) -fno-strict-aliasing
4776796a 131stapio_LDADD = @PROCFLAGS@ -lpthread
98aab489 132
19a0d4b6 133if BUILD_SERVER
1cecb3c5 134stap_client_connect_SOURCES = stap-client-connect.c
43498922 135stap_client_connect_CFLAGS = -Wall -Werror $(nss_CFLAGS) $(nspr_CFLAGS)
1cecb3c5
DB
136stap_client_connect_LDADD = -lssl3
137
138stap_server_connect_SOURCES = stap-server-connect.c
43498922 139stap_server_connect_CFLAGS = -Wall -Werror $(nss_CFLAGS) $(nspr_CFLAGS)
1cecb3c5 140stap_server_connect_LDADD = -lssl3
19a0d4b6 141endif
1cecb3c5 142
98aab489 143install-exec-hook:
7ab87feb
FCE
144 if [ `id -u` -eq 0 ]; then chmod 04111 "$(DESTDIR)$(bindir)/staprun"; fi
145
146# Why the "id -u" condition? This way, an unprivileged user can run
147# make install, and have "sudo stap ...." or "sudo staprun ...." work later.
148
98aab489
DS
149
150pkglibexec_PROGRAMS = stapio
151CLEANFILES += $(pkglibexec_PROGRAMS)
e460639f 152
5a5e5134 153noinst_PROGRAMS = loc2c-test
51e874a1 154loc2c_test_SOURCES = loc2c-test.c loc2c.c
e460639f
RM
155loc2c_test_CPPFLAGS = $(stap_CPPFLAGS)
156loc2c_test_LDFLAGS = $(stap_LDFLAGS)
157loc2c_test_LDADD = $(stap_LDADD)
51e874a1 158
35a04c8e
FCE
159# crash(8) extension
160if BUILD_CRASHMOD
161STAPLOG=staplog.so
162
163$(STAPLOG): staplog.c
564eb0a8
DS
164 $(CC) $(staplog_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -shared -rdynamic \
165 $(AM_LDFLAGS) $(LDFLAGS) -fPIC -o $@ $<
551a4f58 166all-local: $(STAPLOG) example_index
35a04c8e 167install-exec-local: $(STAPLOG)
674427d3 168 $(MKDIR_P) $(DESTDIR)$(pkglibdir)
17a127da 169 $(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir)
551a4f58
MW
170else
171all-local: example_index
35a04c8e
FCE
172endif
173
2f1a1aea
FCE
174# Get extra libs as needed
175LDADD =
176
ec4d1558 177EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples
551a4f58 178EXAMPLE_META_FILES = $(EXAMPLE_SOURCE_DIR)/*/*.meta
551a4f58 179
751f8288 180example_index: $(EXAMPLE_SOURCE_DIR)/index.html
551a4f58 181
751f8288 182$(EXAMPLE_SOURCE_DIR)/index.html: $(EXAMPLE_META_FILES) $(EXAMPLE_INDEX_GEN)
59ec9408
FCE
183 @echo "The script example index is outdated, run"
184 @echo " cd $(EXAMPLE_SOURCE_DIR) && \\ "
185 @echo " perl examples-index-gen.pl"
186 @echo "to regenerate it."
ec4d1558 187
ecfa3e8b 188install-data-local:
ef9e124a 189 (cd $(srcdir)/runtime; for f in *.[ch]; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/$$f; done)
aaf2af3e
FCE
190 (cd $(srcdir)/runtime/unwind; find . \( -name '*.[ch]' \) -print \
191 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/unwind/$$f; done)
ef9e124a
MH
192 (cd $(srcdir)/runtime/transport; for f in *.[ch]; \
193 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/transport/$$f; done)
6274464e 194 (cd $(srcdir)/runtime/uprobes; for f in Makefile *.[ch]; \
36b16282 195 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/uprobes/$$f; done)
904b272c
JK
196 (cd $(srcdir)/runtime/uprobes2; for f in *.[ch]; \
197 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/uprobes2/$$f; done)
4b2c4ab5 198 (cd $(srcdir)/tapset; find . \( -name '*.stp' -o -name README \) -print \
ef9e124a 199 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/tapset/$$f; done)
751f8288 200 (cd $(srcdir)/testsuite/systemtap.examples; find . -type f -print \
9b3f22a9 201 | egrep -v 'check.exp|ChangeLog|examples-index-gen.pl' \
5b8561dc
MW
202 | while read f; do if test -x $$f; then \
203 i_cmd="$(INSTALL_PROGRAM)"; else \
204 i_cmd="$(INSTALL_DATA)"; fi; \
205 $$i_cmd -D $$f $(DESTDIR)$(docdir)/examples/$$f; done)
ecfa3e8b 206
e885b2ec
WC
207TEST_COV_DIR = coverage
208
af56020f 209gcov:
e885b2ec 210 @-$(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" all check
af56020f 211 @gcov *.gcno >/dev/null 2>&1
af56020f
FCE
212 @rm -f `ls -1 *.gcov | fgrep -v .cxx.gcov`
213 ls -l *.cxx.gcov
214
e885b2ec
WC
215lcov:
216 @lcov --directory . -z
217 @-$(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" all check
218 @lcov --directory . -c -o stap.info
219 @genhtml -o ./$(TEST_COV_DIR) stap.info
220
1e7ad3bf 221clean-local:
f00a8372
RM
222 rm -f *.gcov *.gcno *.gcda ${PACKAGE_TARNAME}-*.tar.gz
223 rm -rf ${PACKAGE_TARNAME}-${PACKAGE_VERSION}
e885b2ec
WC
224 rm -rf $(TEST_COV_DIR)
225 rm -rf stap.info
35a04c8e 226 rm -rf staplog.so
1c4cf93d
MW
227
228distclean-local:
daae650d 229 rm -rf build-elfutils include-elfutils lib-elfutils
4d4f412b
FCE
230
231uninstall-local:
232 rm -rf $(DESTDIR)$(pkgdatadir)
233 rm -rf $(DESTDIR)$(libexecdir)/$(PACKAGE)
35a04c8e 234 rm -rf $(DESTDIR)$(libdir)/$(PACKAGE)
4d4f412b 235 -rm -rf $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)
ec4d1558
MW
236 @list='$(EXAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \
237 echo " rm -f '$(EXAMPLE_INSTALL_DIR)/$$p'"; \
238 rm -f "$(EXAMPLE_INSTALL_DIR)/$$p"; \
239 done
240 @list='$(DEMO_SRC)'; for f in $$list; do p=`basename $$f`; \
241 echo " rm -f '$(DEMO_INSTALL_DIR)/$$p'"; \
242 rm -f "$(DEMO_INSTALL_DIR)/$$p"; \
243 done
244 @list='$(SAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \
245 echo " rm -f '$(SAMPLE_INSTALL_DIR)/$$p'"; \
246 rm -f "$(SAMPLE_INSTALL_DIR)/$$p"; \
247 done
8cd5d9f0 248 rm -rf $(DESTDIR)$(sysconfdir)/systemtap
35a04c8e 249# XXX: leaves behind man pages
8129fd92 250
465e8fbf 251SUBDIRS = testsuite doc
5ba96b90 252
5ba96b90 253check:
17a127da 254 SRCDIR=`cd $(srcdir); pwd`; \
d5658775 255 $(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)" RUNTESTFLAGS="$(RUNTESTFLAGS)";
5ba96b90
FCE
256
257installcheck:
20fb5020
MW
258 if test \! -e $(DESTDIR)$(bindir)/stap; then \
259 echo $(DESTDIR)$(bindir)/stap doesn\'t exist, run make install; \
260 exit -1; \
0e47827d 261 fi; \
20fb5020
MW
262 if test $(builddir)/stap -nt $(DESTDIR)$(bindir)/stap; then \
263 echo "$(DESTDIR)$(bindir)/stap is not recent, run make install"; \
264 exit -1; \
d5658775 265 fi;
b5935516 266 $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)"
8f3c45cc 267
4040e9ea
FCE
268
269# Any extra flags, such as:
270# --define "with_docs 0"
271# --define "with_bundled_elfutils 1" --define "elfutils_version 0.135"
272RPMBUILDFLAGS=
273
337cd273
FCE
274PHONIES += dist-gzip
275
276.PHONY: $(PHONIES)
277
813ed4cb 278dist-gzip:
4040e9ea
FCE
279 cd $(srcdir); git status | grep working.directory.clean || (echo "You should commit your changes before 'make rpm'.")
280 (cd $(srcdir); git archive --prefix=systemtap-$(VERSION)/ --format=tar HEAD) | gzip > systemtap-$(VERSION).tar.gz
813ed4cb 281
9b2e2b58 282rpm: dist-gzip
4040e9ea
FCE
283 mkdir -p `rpm --eval %_specdir`
284 mkdir -p `rpm --eval %_srcrpmdir`
285 mkdir -p `rpm --eval %_rpmdir`
286 mkdir -p `rpm --eval %_builddir`
287 mkdir -p `rpm --eval %_buildroot`
288 rpmbuild --define "_sourcedir $(PWD)/" -ta systemtap-$(VERSION).tar.gz $(RPMBUILDFLAGS)
This page took 0.095666 seconds and 5 git commands to generate.