]> sourceware.org Git - systemtap.git/blob - Makefile.am
stapregex REWRITE PROGRESS: ADD stapregex.cxx & related
[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)"' \
11 -DSYSCONFDIR='"$(sysconfdir)"' \
12 -DPKGDATADIR='"$(pkgdatadir)"' \
13 -DPKGLIBDIR='"$(pkglibexecdir)"' \
14 -DLOCALEDIR='"$(localedir)"' \
15 -I$(srcdir)/includes -I$(builddir)/includes/sys
16
17 AM_CFLAGS = -D_GNU_SOURCE -fexceptions -Wall -Werror -Wunused -Wformat=2 -W
18 AM_CXXFLAGS = -Wall -Werror
19
20 bin_SCRIPTS = stap-report
21 pkglibexec_SCRIPTS = stap-env
22 oldinclude_HEADERS = includes/sys/sdt.h includes/sys/sdt-config.h
23
24 bin_PROGRAMS =
25
26 if BUILD_TRANSLATOR
27 bin_PROGRAMS += stap
28 bin_SCRIPTS += dtrace
29
30 pkglibexec_PROGRAMS =
31
32 if HAVE_NSS
33 pkglibexec_PROGRAMS += stap-sign-module stap-authorize-cert
34
35 if BUILD_SERVER
36 pkglibexec_PROGRAMS += stap-serverd stap-gen-cert
37 bin_SCRIPTS += stap-server
38 pkglibexec_SCRIPTS += stap-start-server stap-stop-server
39 endif
40 endif
41
42 stap_SOURCES = main.cxx session.cxx \
43 parse.cxx staptree.cxx elaborate.cxx translate.cxx \
44 tapsets.cxx buildrun.cxx loc2c.c hash.cxx mdfour.c \
45 cache.cxx util.cxx coveragedb.cxx dwarf_wrappers.cxx \
46 tapset-been.cxx tapset-procfs.cxx tapset-timers.cxx tapset-netfilter.cxx \
47 tapset-perfmon.cxx tapset-mark.cxx tapset-itrace.cxx \
48 tapset-utrace.cxx task_finder.cxx dwflpp.cxx rpm_finder.cxx \
49 setupdwfl.cxx remote.cxx privilege.cxx cmdline.cxx \
50 tapset-dynprobe.cxx tapset-method.cxx translator-output.cxx
51 stap_SOURCES += stapregex.cxx stapregex-parse.cxx
52 noinst_HEADERS = sdt_types.h
53 stap_LDADD = @stap_LIBS@ @sqlite3_LIBS@ @LIBINTL@ -lpthread
54 stap_DEPENDENCIES =
55 endif
56
57 install: all
58 $(MAKE) $(AM_MAKEFLAGS) install-recursive
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 @DYNINST_CXXFLAGS@
98
99 PHONIES =
100 if BUILD_TRANSLATOR
101 stap_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@
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 += $(avahi_LIBS)
110 endif
111
112 if HAVE_NSS
113 stap_SOURCES += nsscommon.cxx csclient.cxx cscommon.cxx
114 stap_CFLAGS += $(nss_CFLAGS) -DSTAP
115 stap_CXXFLAGS += $(nss_CFLAGS)
116 stap_CPPFLAGS += $(nss_CFLAGS)
117 stap_LDADD += $(nss_LIBS)
118
119 install-exec-local: install-scripts
120
121 PHONIES += install-scripts
122 # scripts must be installed before this rule is run
123 install-scripts: install-binSCRIPTS install-pkglibexecSCRIPTS
124 for f in $(bin_SCRIPTS); do \
125 sed -i -e "s,\$${PKGLIBEXECDIR},$(pkglibexecdir)/," $(DESTDIR)$(bindir)/$$f; \
126 done
127 for f in $(pkglibexec_SCRIPTS); do \
128 sed -i -e "/INSTALL-HOOK/d;s,sysconfdir=.*,sysconfdir=$(sysconfdir),;s,pkglibexecdir=.*,pkglibexecdir=$(pkglibexecdir)/,;s,localstatedir=.*,localstatedir=$(localstatedir),;s,\$${PKGLIBEXECDIR},$(pkglibexecdir)/," $(DESTDIR)$(pkglibexecdir)/$$f; \
129 done
130 endif
131
132 if BUILD_ELFUTILS
133 stap_CPPFLAGS += -Iinclude-elfutils
134 stap_LDFLAGS += -Llib-elfutils -Wl,-rpath-link,lib-elfutils \
135 -Wl,--enable-new-dtags,-rpath,$(pkglibdir)
136
137
138 BUILT_SOURCES += stamp-elfutils
139 CLEANFILES += stamp-elfutils
140 stamp-elfutils: config.status
141 $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils all bin_PROGRAMS=
142 for dir in libelf libebl libdw libdwfl backends; do \
143 $(MAKE) $(AM_MAKEFLAGS) -j1 -C build-elfutils/$$dir bin_PROGRAMS= install; \
144 done
145 $(MAKE) $(AM_MAKEFLAGS) -j1 -C build-elfutils install-pkgincludeHEADERS;
146 touch $@
147 stap_DEPENDENCIES += lib-elfutils/libdw.so
148 lib-elfutils/libdw.so: stamp-elfutils ;
149
150 PHONIES += install-elfutils
151 install-elfutils:
152 mkdir -p $(DESTDIR)$(pkglibdir)
153 for file in lib-elfutils/*.so* lib-elfutils/${PACKAGE_NAME}/*.so*; do \
154 $(INSTALL_PROGRAM) $$file $(DESTDIR)$(pkglibdir); \
155 done
156 install-exec-local: install-elfutils
157 endif
158 endif
159
160 CLEANFILES += $(pkglibexec_PROGRAMS)
161
162 if BUILD_TRANSLATOR
163 if HAVE_NSS
164 stap_sign_module_SOURCES = stap-sign-module.cxx nsscommon.cxx util.cxx
165 stap_sign_module_CPPFLAGS = $(AM_CPPFLAGS)
166 stap_sign_module_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
167 stap_sign_module_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
168 stap_sign_module_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
169 stap_sign_module_LDADD = $(nss_LIBS)
170
171 stap_authorize_cert_SOURCES = stap-authorize-cert.cxx nsscommon.cxx util.cxx
172 stap_authorize_cert_CPPFLAGS = $(AM_CPPFLAGS)
173 stap_authorize_cert_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
174 stap_authorize_cert_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
175 stap_authorize_cert_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
176 stap_authorize_cert_LDADD = $(nss_LIBS)
177
178 if BUILD_SERVER
179 stap_serverd_SOURCES = stap-serverd.cxx cscommon.cxx util.cxx privilege.cxx nsscommon.cxx cmdline.cxx
180 stap_serverd_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
181 stap_serverd_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
182 stap_serverd_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
183 stap_serverd_LDADD = $(nss_LIBS) -lpthread
184 if HAVE_AVAHI
185 stap_serverd_CFLAGS += $(avahi_CFLAGS)
186 stap_serverd_CXXFLAGS += $(avahi_CFLAGS)
187 stap_serverd_LDADD += $(avahi_LIBS)
188 endif
189
190 stap_gen_cert_SOURCES = stap-gen-cert.cxx util.cxx nsscommon.cxx
191 stap_gen_cert_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
192 stap_gen_cert_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
193 stap_gen_cert_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
194 stap_gen_cert_LDADD = $(nss_LIBS)
195 endif
196 endif
197
198 noinst_PROGRAMS = loc2c-test
199 loc2c_test_SOURCES = loc2c-test.c loc2c.c
200 loc2c_test_CFLAGS = $(stap_CFLAGS)
201 loc2c_test_CPPFLAGS = $(stap_CPPFLAGS)
202 loc2c_test_LDFLAGS = $(stap_LDFLAGS)
203 loc2c_test_LDADD = $(stap_LDADD)
204 endif
205
206 # crash(8) extension
207 if BUILD_CRASHMOD
208 STAPLOG=staplog.so
209
210 $(STAPLOG): staplog.c
211 $(CC) $(staplog_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -shared -rdynamic \
212 $(AM_LDFLAGS) $(LDFLAGS) -fPIC -o $@ $<
213 all-local: $(STAPLOG) example_index
214 install-exec-local: $(STAPLOG)
215 $(MKDIR_P) $(DESTDIR)$(pkglibdir)
216 $(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir)
217 else
218 all-local: example_index
219 endif
220
221 # Get extra libs as needed
222 LDADD =
223
224 EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples
225 EXAMPLE_META_FILES = $(EXAMPLE_SOURCE_DIR)/*/*.meta
226
227 example_index: $(EXAMPLE_SOURCE_DIR)/index.html
228
229 $(EXAMPLE_SOURCE_DIR)/index.html: $(EXAMPLE_META_FILES) $(EXAMPLE_INDEX_GEN)
230 @echo "The script example index is outdated, run"
231 @echo " cd $(EXAMPLE_SOURCE_DIR) && \\ "
232 @echo " perl examples-index-gen.pl"
233 @echo "to regenerate it."
234
235 install-data-local:
236 (cd $(srcdir)/runtime; for f in *.[ch]; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/$$f; done)
237 if HAVE_DYNINST
238 (cd $(srcdir)/runtime/dyninst; find . \( -name '*.[ch]' \) -print \
239 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/dyninst/$$f; done)
240 endif
241 (cd $(srcdir)/runtime/unwind; find . \( -name '*.[ch]' \) -print \
242 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/unwind/$$f; done)
243 (cd $(srcdir)/runtime/transport; for f in *.[ch]; \
244 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/transport/$$f; done)
245 (cd $(srcdir)/runtime/linux; for f in *.[ch]; \
246 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/linux/$$f; done)
247 (cd $(srcdir)/runtime/linux/uprobes; for f in Makefile *.[ch]; \
248 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/linux/uprobes/$$f; done)
249 (cd $(srcdir)/runtime/linux/uprobes2; for f in *.[ch]; \
250 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/linux/uprobes2/$$f; done)
251 (cd $(srcdir)/tapset; find . \( -name '*.stp' -o -name '*.stpm' -o -name README \) -print \
252 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/tapset/$$f; done)
253 (cd $(srcdir)/testsuite/systemtap.examples; find . -type f -print \
254 | egrep -v 'check.exp|ChangeLog|examples-index-gen.pl|html/.*\.tmpl$$' \
255 | while read f; do if test -x $$f; then \
256 i_cmd="$(INSTALL_PROGRAM)"; else \
257 i_cmd="$(INSTALL_DATA)"; fi; \
258 $$i_cmd -D $$f $(DESTDIR)$(docdir)/examples/$$f; done)
259 test -e $(DESTDIR)$(sysconfdir)/systemtap || mkdir -p $(DESTDIR)$(sysconfdir)/systemtap
260 if BUILD_SERVER
261 test -e $(DESTDIR)$(localstatedir)/run/stap-server || mkdir -p $(DESTDIR)$(localstatedir)/run/stap-server
262 test -e $(DESTDIR)$(localstatedir)/log || mkdir -p $(DESTDIR)$(localstatedir)/log
263 endif
264
265
266 TEST_COV_DIR = coverage
267
268 gcov:
269 find . -name '*.gc*' | xargs rm -f
270 $(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" CFLAGS="-g -fprofile-arcs -ftest-coverage" all install
271 -sudo $(MAKE) installcheck $${RUNTESTFLAGS+RUNTESTFLAGS=$${RUNTESTFLAGS}}
272 for dir in $(SUBDIRS); do \
273 (cd $$dir; gcov *.gcno > SUMMARY.gcov 2>&1 || true); \
274 done
275 find . -name '*.gcov'
276
277 clean-local:
278 rm -rf ${PACKAGE_TARNAME}-*.tar.gz
279 rm -rf ${PACKAGE_TARNAME}-${PACKAGE_VERSION}
280 rm -rf $(TEST_COV_DIR)
281 rm -rf stap.info
282 rm -rf staplog.so
283
284 distclean-local:
285 rm -rf build-elfutils include-elfutils lib-elfutils
286 rm -f doc/beginners/en-US doc/beginners/build/en-US/testsuite
287
288 uninstall-local:
289 rm -rf $(DESTDIR)$(pkgdatadir)
290 rm -rf $(DESTDIR)$(libdir)/$(PACKAGE)
291 -rm -rf $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)
292 @list='$(EXAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \
293 echo " rm -f '$(EXAMPLE_INSTALL_DIR)/$$p'"; \
294 rm -f "$(EXAMPLE_INSTALL_DIR)/$$p"; \
295 done
296 @list='$(DEMO_SRC)'; for f in $$list; do p=`basename $$f`; \
297 echo " rm -f '$(DEMO_INSTALL_DIR)/$$p'"; \
298 rm -f "$(DEMO_INSTALL_DIR)/$$p"; \
299 done
300 @list='$(SAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \
301 echo " rm -f '$(SAMPLE_INSTALL_DIR)/$$p'"; \
302 rm -f "$(SAMPLE_INSTALL_DIR)/$$p"; \
303 done
304 rm -rf $(DESTDIR)$(sysconfdir)/systemtap
305 rm -rf $(DESTDIR)$(docdir)/examples
306 if BUILD_SERVER
307 rm -rf $(DESTDIR)$(localstatedir)/run/stap-server
308 rm -f $(DESTDIR)$(localstatedir)/log/stap-server/log
309 endif
310
311 SUBDIRS = . java stapdyn staprun re2c-migrate doc man po
312 # NB: the gcov target above uses this to enumarate linked binaries' build directories
313 DIST_SUBDIRS = testsuite $(SUBDIRS)
314 EXTRA_DIST = m4/ChangeLog
315
316 check-local:
317 SRCDIR=`cd $(srcdir); pwd`; \
318 PWD=`pwd`; \
319 $(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)";
320
321 installcheck:
322 if test \! -e $(DESTDIR)$(bindir)/stap; then \
323 echo $(DESTDIR)$(bindir)/stap doesn\'t exist, run make install; \
324 exit -1; \
325 fi; \
326 if test $(builddir)/stap -nt $(DESTDIR)$(bindir)/stap; then \
327 echo "$(DESTDIR)$(bindir)/stap is not recent, run make install"; \
328 exit -1; \
329 fi;
330 $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)"
331
332 PHONIES += runcheck
333 # All the variables are overridden by run-stap, but SYSTEMTAP_RUNTIME
334 # is used by the testsuite scripts themselves.
335 runcheck: testsuite/stap testsuite/dtrace
336 $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" \
337 SYSTEMTAP_PATH="`cd testsuite; pwd`" \
338 SYSTEMTAP_RUNTIME="`cd $(srcdir)/runtime; pwd`"
339 testsuite/stap: run-stap
340 (echo '#!/bin/sh'; echo "exec `pwd`/run-stap" '$${1+"$$@"}') > $@.new
341 chmod 555 $@.new
342 mv -f $@.new $@
343 testsuite/dtrace: dtrace
344 (echo '#!/bin/sh'; echo "exec `pwd`/dtrace" '$${1+"$$@"}') > $@.new
345 chmod 555 $@.new
346 mv -f $@.new $@
347
348 PHONIES += update-po
349 update-po:
350 (cd $(srcdir); ls -1d *.c *.cxx *.h staprun/*.c staprun/*.h) \
351 | grep -v loc2c-test.c \
352 | grep -v config.h \
353 | grep -v git_version.h \
354 | grep -v staprun/config.h \
355 | sort > $(srcdir)/po/POTFILES.in
356 $(MAKE) -C po update-po
357
358
359 # Any extra flags, such as:
360 # --define "with_docs 0"
361 # --define "with_bundled_elfutils 1" --define "elfutils_version 0.135"
362 RPMBUILDFLAGS=
363
364 PHONIES += dist-gzip rpm srpm
365
366 PHONIES += uprobes install-uprobes
367 uprobes:
368 $(MAKE) -C $(srcdir)/runtime/uprobes clean default
369 install-uprobes:
370 $(MAKE) -C $(DESTDIR)$(pkgdatadir)/runtime/uprobes clean default
371
372 .PHONY: $(PHONIES)
373
374 dist-gzip:
375 cd $(srcdir); git status | grep working.directory.clean || (echo "You should commit your changes before 'make rpm'.")
376 (cd $(srcdir); git archive --prefix=systemtap-$(VERSION)/ --format=tar HEAD) | gzip > systemtap-$(VERSION).tar.gz
377
378 rpm: dist-gzip
379 if [ `id -u` = 0 ]; then echo NOTE: do not run this as root; exit 1; fi
380 mkdir -p `rpm --eval %_specdir`
381 mkdir -p `rpm --eval %_srcrpmdir`
382 mkdir -p `rpm --eval %_rpmdir`
383 mkdir -p `rpm --eval %_builddir`
384 mkdir -p `rpm --eval %_buildroot`
385 rpmbuild --define "_sourcedir $(PWD)/" -ta systemtap-$(VERSION).tar.gz $(RPMBUILDFLAGS)
386
387 srpm: dist-gzip
388 mkdir -p `rpm --eval %_srcrpmdir`
389 rpmbuild --define "_sourcedir $(PWD)/" -ts systemtap-$(VERSION).tar.gz $(RPMBUILDFLAGS)
390
391 ACLOCAL_AMFLAGS = -I m4
This page took 0.058377 seconds and 6 git commands to generate.