]> sourceware.org Git - systemtap.git/blob - Makefile.am
Move old sys/sdt.h to sdt-compat.h for translator use
[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)"' -DSYSCONFDIR='"$(sysconfdir)"' -DPKGDATADIR='"${pkgdatadir}"' -DPKGLIBDIR='"$(pkglibexecdir)"' -I$(srcdir)/includes
11
12 AM_CFLAGS = -D_GNU_SOURCE -fexceptions -Wall -Werror -Wunused -Wformat=2 -W
13 AM_CXXFLAGS = -Wall -Werror
14
15 man_MANS = stapprobes.3stap stapfuncs.3stap stapvars.3stap stapex.3stap \
16 dtrace.1 stap-merge.1\
17 stappaths.7
18
19 bin_SCRIPTS = stap-report
20 pkglibexec_SCRIPTS = stap-env
21 oldinclude_HEADERS = includes/sys/sdt.h
22
23 bin_PROGRAMS =
24
25 if BUILD_TRANSLATOR
26 bin_PROGRAMS += stap
27 man_MANS += stap.1
28 bin_SCRIPTS += dtrace
29
30 pkglibexec_PROGRAMS =
31
32 if HAVE_NSS
33 man_MANS += stap-authorize-signing-cert.8
34 bin_SCRIPTS += stap-authorize-signing-cert
35 pkglibexec_PROGRAMS += stap-sign-module
36 pkglibexec_SCRIPTS += stap-gen-cert stap-authorize-cert
37
38 if BUILD_SERVER
39 man_MANS += stap-client.8 stap-server.8 stap-authorize-server-cert.8
40 pkglibexec_PROGRAMS += stap-client-connect stap-server-connect
41 bin_SCRIPTS += stap-client stap-server stap-authorize-server-cert
42 pkglibexec_SCRIPTS += stap-serverd stap-find-servers \
43 stap-start-server stap-find-or-start-server stap-stop-server
44 endif
45 endif
46
47 stap_SOURCES = main.cxx session.cxx \
48 parse.cxx staptree.cxx elaborate.cxx translate.cxx \
49 tapsets.cxx buildrun.cxx loc2c.c hash.cxx mdfour.c \
50 cache.cxx util.cxx coveragedb.cxx dwarf_wrappers.cxx \
51 tapset-been.cxx tapset-procfs.cxx tapset-timers.cxx \
52 tapset-perfmon.cxx tapset-mark.cxx tapset-itrace.cxx \
53 tapset-utrace.cxx task_finder.cxx dwflpp.cxx rpm_finder.cxx \
54 setupdwfl.cxx csclient.cxx
55 noinst_HEADERS = sdt-compat.h
56 stap_LDADD = @stap_LIBS@ @sqlite3_LIBS@
57 stap_DEPENDENCIES =
58 endif
59
60 BUILT_SOURCES =
61 CLEANFILES =
62
63 # Arrange for git_version.h to be regenerated at every "make".
64 # Code fragment is based upon RadeonHD.am.
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.
71 BUILT_SOURCES += git_version.stamp
72 CLEANFILES += git_version.h
73 GIT_VERSION_CMD = $(SHELL) $(top_srcdir)/git_version.sh
74 git_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
91 git_version.h:
92 $(srcdir)/git_version.sh -k --srcdir $(srcdir) -o git_version.h
93
94 cscope:
95 cd $(srcdir) && \
96 (echo -q ; git ls-files '*.cxx' '*.c' '*.h' | grep -v '^testsuite' ) > cscope.files && \
97 cscope -b -q
98
99 PHONIES =
100 if BUILD_TRANSLATOR
101 stap_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ -D_FILE_OFFSET_BITS=64
102 stap_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@
103 stap_CPPFLAGS = $(AM_CPPFLAGS) -DSTAP_SDT_V2
104 stap_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
105
106 if HAVE_AVAHI
107 stap_CXXFLAGS += $(avahi_CFLAGS)
108 stap_CPPFLAGS += $(avahi_CFLAGS)
109 stap_LDADD += -lavahi-client -lavahi-common
110 endif
111
112 if HAVE_NSS
113 stap_SOURCES += stap-client-connect.c nsscommon.c
114 stap_CFLAGS += $(nss_CFLAGS) $(nspr_CFLAGS) -DSTAP
115 stap_CXXFLAGS += $(nss_CFLAGS) $(nspr_CFLAGS)
116 stap_CPPFLAGS += $(nss_CFLAGS) $(nspr_CFLAGS)
117 stap_LDADD += -lssl3 -lnss3 -lnspr4 -lplc4
118 stap_client_connect_LDFLAGS = $(AM_LDFLAGS)
119 stap_server_connect_LDFLAGS = $(AM_LDFLAGS)
120 stap_sign_module_LDFLAGS = $(AM_LDFLAGS)
121
122 if BUILD_SERVER
123 install-exec-local: install-scripts
124
125 PHONIES += install-scripts
126 # scripts must be installed before this rule is run
127 install-scripts: install-binSCRIPTS install-pkglibexecSCRIPTS
128 for f in $(bin_SCRIPTS); do \
129 sed -i -e "s,\$${PKGLIBEXECDIR},$(pkglibexecdir)/," $(DESTDIR)$(bindir)/$$f; \
130 done
131 for f in $(pkglibexec_SCRIPTS); do \
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; \
133 done
134 endif
135 endif
136
137 if BUILD_ELFUTILS
138 stap_CPPFLAGS += -Iinclude-elfutils
139 stap_LDFLAGS += -Llib-elfutils -Wl,-rpath-link,lib-elfutils \
140 -Wl,--enable-new-dtags,-rpath,$(pkglibdir)
141
142
143 BUILT_SOURCES += stamp-elfutils
144 CLEANFILES += stamp-elfutils
145 stamp-elfutils: config.status
146 $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils all bin_PROGRAMS=
147 for dir in libelf libebl libdw libdwfl backends; do \
148 $(MAKE) $(AM_MAKEFLAGS) -j1 -C build-elfutils/$$dir bin_PROGRAMS= install; \
149 done
150 touch $@
151 stap_DEPENDENCIES += lib-elfutils/libdw.so
152 lib-elfutils/libdw.so: stamp-elfutils ;
153
154 PHONIES += install-elfutils
155 install-elfutils:
156 mkdir -p $(DESTDIR)$(pkglibdir)
157 for file in lib-elfutils/*.so* lib-elfutils/${PACKAGE_NAME}/*.so*; do \
158 $(INSTALL_PROGRAM) $$file $(DESTDIR)$(pkglibdir); \
159 done
160 install-exec-local: install-elfutils
161 endif
162 endif
163
164 CLEANFILES += $(pkglibexec_PROGRAMS)
165
166 if BUILD_TRANSLATOR
167 if HAVE_NSS
168 stap_sign_module_SOURCES = modsign.cxx nsscommon.c
169 stap_sign_module_CPPFLAGS = -Wall -Werror $(AM_CPPFLAGS) $(nss_CFLAGS) $(nspr_CFLAGS)
170 stap_sign_module_LDADD = -lnss3 -lnspr4
171
172 if BUILD_SERVER
173 stap_client_connect_SOURCES = stap-client-connect.c nsscommon.c
174 stap_client_connect_CFLAGS = -Wall -Werror $(nss_CFLAGS) $(nspr_CFLAGS)
175 stap_client_connect_LDADD = -lssl3 -lnss3 -lnspr4 -lplc4
176
177 stap_server_connect_SOURCES = stap-server-connect.c nsscommon.c
178 stap_server_connect_CFLAGS = -Wall -Werror $(nss_CFLAGS) $(nspr_CFLAGS)
179 stap_server_connect_LDADD = -lssl3 -lnss3 -lnspr4 -lplc4
180 endif
181 endif
182
183 noinst_PROGRAMS = loc2c-test
184 loc2c_test_SOURCES = loc2c-test.c loc2c.c
185 loc2c_test_CFLAGS = $(stap_CFLAGS)
186 loc2c_test_CPPFLAGS = $(stap_CPPFLAGS)
187 loc2c_test_LDFLAGS = $(stap_LDFLAGS)
188 loc2c_test_LDADD = $(stap_LDADD)
189 endif
190
191 # crash(8) extension
192 if BUILD_CRASHMOD
193 STAPLOG=staplog.so
194
195 $(STAPLOG): staplog.c
196 $(CC) $(staplog_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -shared -rdynamic \
197 $(AM_LDFLAGS) $(LDFLAGS) -fPIC -o $@ $<
198 all-local: $(STAPLOG) example_index
199 install-exec-local: $(STAPLOG)
200 $(MKDIR_P) $(DESTDIR)$(pkglibdir)
201 $(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir)
202 else
203 all-local: example_index
204 endif
205
206 # Get extra libs as needed
207 LDADD =
208
209 EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples
210 EXAMPLE_META_FILES = $(EXAMPLE_SOURCE_DIR)/*/*.meta
211
212 example_index: $(EXAMPLE_SOURCE_DIR)/index.html
213
214 $(EXAMPLE_SOURCE_DIR)/index.html: $(EXAMPLE_META_FILES) $(EXAMPLE_INDEX_GEN)
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."
219
220 install-data-local:
221 (cd $(srcdir)/runtime; for f in *.[ch]; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/$$f; done)
222 (cd $(srcdir)/runtime/unwind; find . \( -name '*.[ch]' \) -print \
223 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/unwind/$$f; done)
224 (cd $(srcdir)/runtime/transport; for f in *.[ch]; \
225 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/transport/$$f; done)
226 (cd $(srcdir)/runtime/uprobes; for f in Makefile *.[ch]; \
227 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/uprobes/$$f; done)
228 (cd $(srcdir)/runtime/uprobes2; for f in *.[ch]; \
229 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/uprobes2/$$f; done)
230 (cd $(srcdir)/tapset; find . \( -name '*.stp' -o -name README \) -print \
231 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/tapset/$$f; done)
232 (cd $(srcdir)/testsuite/systemtap.examples; find . -type f -print \
233 | egrep -v 'check.exp|ChangeLog|examples-index-gen.pl' \
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)
238 test -e $(DESTDIR)$(sysconfdir)/systemtap || mkdir -p $(DESTDIR)$(sysconfdir)/systemtap
239 if 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
242 endif
243 (cd $(srcdir)/man; for f in *.3*; do $(INSTALL_DATA) -D $$f "$(DESTDIR)$(man3dir)/$$f" || exit $$?; done)
244
245
246 TEST_COV_DIR = coverage
247
248 gcov:
249 @-$(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" all check
250 @gcov *.gcno >/dev/null 2>&1
251 @rm -f `ls -1 *.gcov | fgrep -v .cxx.gcov`
252 ls -l *.cxx.gcov
253
254 lcov:
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
260 clean-local:
261 rm -f *.gcov *.gcno *.gcda ${PACKAGE_TARNAME}-*.tar.gz
262 rm -rf ${PACKAGE_TARNAME}-${PACKAGE_VERSION}
263 rm -rf $(TEST_COV_DIR)
264 rm -rf stap.info
265 rm -rf staplog.so
266
267 distclean-local:
268 rm -rf build-elfutils include-elfutils lib-elfutils
269
270 uninstall-local:
271 rm -rf $(DESTDIR)$(pkgdatadir)
272 rm -rf $(DESTDIR)$(libdir)/$(PACKAGE)
273 -rm -rf $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)
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
286 rm -rf $(DESTDIR)$(sysconfdir)/systemtap
287 rm -rf $(DESTDIR)$(docdir)/examples
288 if BUILD_SERVER
289 rm -rf $(DESTDIR)$(localstatedir)/run/stap-server
290 rm -f $(DESTDIR)$(localstatedir)/log/stap-server/log
291 endif
292 (cd $(srcdir)/man; for f in *.3*; do rm -rf "$(DESTDIR)$(man3dir)/$$f"; done)
293
294 SUBDIRS = doc grapher runtime/staprun
295 DIST_SUBDIRS = testsuite $(SUBDIRS)
296 EXTRA_DIST = man/tapset*.3stap
297
298 check-local:
299 SRCDIR=`cd $(srcdir); pwd`; \
300 PWD=`pwd`; \
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)";
302
303 installcheck:
304 if test \! -e $(DESTDIR)$(bindir)/stap; then \
305 echo $(DESTDIR)$(bindir)/stap doesn\'t exist, run make install; \
306 exit -1; \
307 fi; \
308 if test $(builddir)/stap -nt $(DESTDIR)$(bindir)/stap; then \
309 echo "$(DESTDIR)$(bindir)/stap is not recent, run make install"; \
310 exit -1; \
311 fi;
312 $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)"
313
314 PHONIES += runcheck
315 # All the variables are overridden by run-stap, but SYSTEMTAP_RUNTIME
316 # is used by the testsuite scripts themselves.
317 runcheck: testsuite/stap
318 $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" \
319 SYSTEMTAP_PATH="`cd testsuite; pwd`" \
320 SYSTEMTAP_RUNTIME="`cd $(srcdir)/runtime; pwd`"
321 testsuite/stap: run-stap
322 (echo '#!/bin/sh'; echo "exec `pwd`/run-stap" '$${1+"$$@"}') > $@.new
323 chmod 555 $@.new
324 mv -f $@.new $@
325
326 # Any extra flags, such as:
327 # --define "with_docs 0"
328 # --define "with_bundled_elfutils 1" --define "elfutils_version 0.135"
329 RPMBUILDFLAGS=
330
331 PHONIES += dist-gzip
332
333 .PHONY: $(PHONIES)
334
335 dist-gzip:
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
338
339 rpm: dist-gzip
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.053383 seconds and 6 git commands to generate.