]> sourceware.org Git - systemtap.git/blob - Makefile.am
BZ915247: remove i18n stub support from python dtrace.in script
[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
51 stap_SOURCES += re2c-migrate/stapregex.cxx \
52 re2c-migrate/re2c-regex.cxx re2c-migrate/re2c-emit.cxx \
53 re2c-migrate/re2c-dfa.cxx re2c-migrate/re2c-globals.cxx
54 noinst_HEADERS = sdt_types.h
55 stap_LDADD = @stap_LIBS@ @sqlite3_LIBS@ @LIBINTL@
56 stap_DEPENDENCIES =
57 endif
58
59 install: all
60 $(MAKE) $(AM_MAKEFLAGS) install-recursive
61
62 BUILT_SOURCES =
63 CLEANFILES =
64
65 # Arrange for git_version.h to be regenerated at every "make".
66 # Code fragment is based upon RadeonHD.am.
67
68 # The stamp file which is never created ensures that git_version.h is updated
69 # before every build. Having git_version.h in foo_SOURCES ensures a recompile
70 # of foo-bar.c if it is newer than the foo-bar.o file. Using noinst_foo_SOURCES
71 # instead of foo_SOURCES prevents shipping git_version.h in dist tarballs,
72 # which may cause false GIT_FOO readings.
73 BUILT_SOURCES += git_version.stamp
74 CLEANFILES += git_version.h
75 GIT_VERSION_CMD = $(SHELL) $(top_srcdir)/git_version.sh
76 git_version.stamp:
77 @if test -f "$(srcdir)/git_version.h"; then \
78 if test -f "git_version.h"; then :; \
79 else \
80 cp "$(srcdir)/git_version.h" "git_version.h"; \
81 fi; \
82 fi
83 $(GIT_VERSION_CMD) -k -s $(top_srcdir) -o git_version.h
84 @if test -s "$(srcdir)/git_version.h"; then \
85 if cmp "$(srcdir)/git_version.h" "git_version.h"; then :; \
86 else \
87 echo "Error: $(srcdir)/git_version.h and git_version.h differ."; \
88 echo " You probably want to remove the former."; \
89 exit 1; \
90 fi; \
91 fi
92
93 git_version.h:
94 $(srcdir)/git_version.sh -k --srcdir $(srcdir) -o git_version.h
95
96 cscope:
97 cd $(srcdir) && \
98 (echo -q ; git ls-files '*.cxx' '*.c' '*.h' | grep -v '^testsuite' ) > cscope.files && \
99 cscope -b -q
100
101 PHONIES =
102 if BUILD_TRANSLATOR
103 stap_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@
104 stap_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@
105 stap_CPPFLAGS = $(AM_CPPFLAGS) -DSTAP_SDT_V2
106 stap_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
107
108 if HAVE_AVAHI
109 stap_CXXFLAGS += $(avahi_CFLAGS)
110 stap_CPPFLAGS += $(avahi_CFLAGS)
111 stap_LDADD += $(avahi_LIBS)
112 endif
113
114 if HAVE_NSS
115 stap_SOURCES += nsscommon.cxx csclient.cxx cscommon.cxx
116 stap_CFLAGS += $(nss_CFLAGS) -DSTAP
117 stap_CXXFLAGS += $(nss_CFLAGS)
118 stap_CPPFLAGS += $(nss_CFLAGS)
119 stap_LDADD += $(nss_LIBS)
120
121 install-exec-local: install-scripts
122
123 PHONIES += install-scripts
124 # scripts must be installed before this rule is run
125 install-scripts: install-binSCRIPTS install-pkglibexecSCRIPTS
126 for f in $(bin_SCRIPTS); do \
127 sed -i -e "s,\$${PKGLIBEXECDIR},$(pkglibexecdir)/," $(DESTDIR)$(bindir)/$$f; \
128 done
129 for f in $(pkglibexec_SCRIPTS); do \
130 sed -i -e "/INSTALL-HOOK/d;s,sysconfdir=.*,sysconfdir=$(sysconfdir),;s,pkglibexecdir=.*,pkglibexecdir=$(pkglibexecdir)/,;s,localstatedir=.*,localstatedir=$(localstatedir),;s,\$${PKGLIBEXECDIR},$(pkglibexecdir)/," $(DESTDIR)$(pkglibexecdir)/$$f; \
131 done
132 endif
133
134 if BUILD_ELFUTILS
135 stap_CPPFLAGS += -Iinclude-elfutils
136 stap_LDFLAGS += -Llib-elfutils -Wl,-rpath-link,lib-elfutils \
137 -Wl,--enable-new-dtags,-rpath,$(pkglibdir)
138
139
140 BUILT_SOURCES += stamp-elfutils
141 CLEANFILES += stamp-elfutils
142 stamp-elfutils: config.status
143 $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils all bin_PROGRAMS=
144 for dir in libelf libebl libdw libdwfl backends; do \
145 $(MAKE) $(AM_MAKEFLAGS) -j1 -C build-elfutils/$$dir bin_PROGRAMS= install; \
146 done
147 $(MAKE) $(AM_MAKEFLAGS) -j1 -C build-elfutils install-pkgincludeHEADERS;
148 touch $@
149 stap_DEPENDENCIES += lib-elfutils/libdw.so
150 lib-elfutils/libdw.so: stamp-elfutils ;
151
152 PHONIES += install-elfutils
153 install-elfutils:
154 mkdir -p $(DESTDIR)$(pkglibdir)
155 for file in lib-elfutils/*.so* lib-elfutils/${PACKAGE_NAME}/*.so*; do \
156 $(INSTALL_PROGRAM) $$file $(DESTDIR)$(pkglibdir); \
157 done
158 install-exec-local: install-elfutils
159 endif
160 endif
161
162 CLEANFILES += $(pkglibexec_PROGRAMS)
163
164 if BUILD_TRANSLATOR
165 if HAVE_NSS
166 stap_sign_module_SOURCES = stap-sign-module.cxx nsscommon.cxx util.cxx
167 stap_sign_module_CPPFLAGS = $(AM_CPPFLAGS)
168 stap_sign_module_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
169 stap_sign_module_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
170 stap_sign_module_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
171 stap_sign_module_LDADD = $(nss_LIBS)
172
173 stap_authorize_cert_SOURCES = stap-authorize-cert.cxx nsscommon.cxx util.cxx
174 stap_authorize_cert_CPPFLAGS = $(AM_CPPFLAGS)
175 stap_authorize_cert_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
176 stap_authorize_cert_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
177 stap_authorize_cert_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
178 stap_authorize_cert_LDADD = $(nss_LIBS)
179
180 if BUILD_SERVER
181 stap_serverd_SOURCES = stap-serverd.cxx cscommon.cxx util.cxx privilege.cxx nsscommon.cxx cmdline.cxx
182 stap_serverd_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
183 stap_serverd_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
184 stap_serverd_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
185 stap_serverd_LDADD = $(nss_LIBS) -lpthread
186 if HAVE_AVAHI
187 stap_serverd_CFLAGS += $(avahi_CFLAGS)
188 stap_serverd_CXXFLAGS += $(avahi_CFLAGS)
189 stap_serverd_LDADD += $(avahi_LIBS)
190 endif
191
192 stap_gen_cert_SOURCES = stap-gen-cert.cxx util.cxx nsscommon.cxx
193 stap_gen_cert_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
194 stap_gen_cert_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
195 stap_gen_cert_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
196 stap_gen_cert_LDADD = $(nss_LIBS)
197 endif
198 endif
199
200 noinst_PROGRAMS = loc2c-test
201 loc2c_test_SOURCES = loc2c-test.c loc2c.c
202 loc2c_test_CFLAGS = $(stap_CFLAGS)
203 loc2c_test_CPPFLAGS = $(stap_CPPFLAGS)
204 loc2c_test_LDFLAGS = $(stap_LDFLAGS)
205 loc2c_test_LDADD = $(stap_LDADD)
206 endif
207
208 # crash(8) extension
209 if BUILD_CRASHMOD
210 STAPLOG=staplog.so
211
212 $(STAPLOG): staplog.c
213 $(CC) $(staplog_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -shared -rdynamic \
214 $(AM_LDFLAGS) $(LDFLAGS) -fPIC -o $@ $<
215 all-local: $(STAPLOG) example_index
216 install-exec-local: $(STAPLOG)
217 $(MKDIR_P) $(DESTDIR)$(pkglibdir)
218 $(INSTALL) $(STAPLOG) $(DESTDIR)$(pkglibdir)
219 else
220 all-local: example_index
221 endif
222
223 # Get extra libs as needed
224 LDADD =
225
226 EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples
227 EXAMPLE_META_FILES = $(EXAMPLE_SOURCE_DIR)/*/*.meta
228
229 example_index: $(EXAMPLE_SOURCE_DIR)/index.html
230
231 $(EXAMPLE_SOURCE_DIR)/index.html: $(EXAMPLE_META_FILES) $(EXAMPLE_INDEX_GEN)
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."
236
237 install-data-local:
238 (cd $(srcdir)/runtime; for f in *.[ch]; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/$$f; done)
239 if HAVE_DYNINST
240 (cd $(srcdir)/runtime/dyninst; find . \( -name '*.[ch]' \) -print \
241 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/dyninst/$$f; done)
242 endif
243 (cd $(srcdir)/runtime/unwind; find . \( -name '*.[ch]' \) -print \
244 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/unwind/$$f; done)
245 (cd $(srcdir)/runtime/transport; for f in *.[ch]; \
246 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/transport/$$f; done)
247 (cd $(srcdir)/runtime/linux; for f in *.[ch]; \
248 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/linux/$$f; done)
249 (cd $(srcdir)/runtime/linux/uprobes; for f in Makefile *.[ch]; \
250 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/linux/uprobes/$$f; done)
251 (cd $(srcdir)/runtime/linux/uprobes2; for f in *.[ch]; \
252 do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/linux/uprobes2/$$f; done)
253 (cd $(srcdir)/tapset; find . \( -name '*.stp' -o -name '*.stpm' -o -name README \) -print \
254 | while read f; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/tapset/$$f; done)
255 (cd $(srcdir)/testsuite/systemtap.examples; find . -type f -print \
256 | egrep -v 'check.exp|ChangeLog|examples-index-gen.pl|html/.*\.tmpl$$' \
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)
261 test -e $(DESTDIR)$(sysconfdir)/systemtap || mkdir -p $(DESTDIR)$(sysconfdir)/systemtap
262 if 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
265 endif
266
267
268 TEST_COV_DIR = coverage
269
270 gcov:
271 find . -name '*.gc*' | xargs rm -f
272 $(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" CFLAGS="-g -fprofile-arcs -ftest-coverage" all install
273 -sudo $(MAKE) installcheck $${RUNTESTFLAGS+RUNTESTFLAGS=$${RUNTESTFLAGS}}
274 for dir in $(SUBDIRS); do \
275 (cd $$dir; gcov *.gcno > SUMMARY.gcov 2>&1 || true); \
276 done
277 find . -name '*.gcov'
278
279 clean-local:
280 rm -rf ${PACKAGE_TARNAME}-*.tar.gz
281 rm -rf ${PACKAGE_TARNAME}-${PACKAGE_VERSION}
282 rm -rf $(TEST_COV_DIR)
283 rm -rf stap.info
284 rm -rf staplog.so
285
286 distclean-local:
287 rm -rf build-elfutils include-elfutils lib-elfutils
288 rm -f doc/beginners/en-US doc/beginners/build/en-US/testsuite
289
290 uninstall-local:
291 rm -rf $(DESTDIR)$(pkgdatadir)
292 rm -rf $(DESTDIR)$(libdir)/$(PACKAGE)
293 -rm -rf $(DESTDIR)$(localstatedir)/cache/$(PACKAGE)
294 @list='$(EXAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \
295 echo " rm -f '$(EXAMPLE_INSTALL_DIR)/$$p'"; \
296 rm -f "$(EXAMPLE_INSTALL_DIR)/$$p"; \
297 done
298 @list='$(DEMO_SRC)'; for f in $$list; do p=`basename $$f`; \
299 echo " rm -f '$(DEMO_INSTALL_DIR)/$$p'"; \
300 rm -f "$(DEMO_INSTALL_DIR)/$$p"; \
301 done
302 @list='$(SAMPLE_SRC)'; for f in $$list; do p=`basename $$f`; \
303 echo " rm -f '$(SAMPLE_INSTALL_DIR)/$$p'"; \
304 rm -f "$(SAMPLE_INSTALL_DIR)/$$p"; \
305 done
306 rm -rf $(DESTDIR)$(sysconfdir)/systemtap
307 rm -rf $(DESTDIR)$(docdir)/examples
308 if BUILD_SERVER
309 rm -rf $(DESTDIR)$(localstatedir)/run/stap-server
310 rm -f $(DESTDIR)$(localstatedir)/log/stap-server/log
311 endif
312
313 SUBDIRS = . stapdyn staprun re2c-migrate doc man po
314 # NB: the gcov target above uses this to enumarate linked binaries' build directories
315 DIST_SUBDIRS = testsuite $(SUBDIRS)
316 EXTRA_DIST = m4/ChangeLog
317
318 check-local:
319 SRCDIR=`cd $(srcdir); pwd`; \
320 PWD=`pwd`; \
321 $(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)";
322
323 installcheck:
324 if test \! -e $(DESTDIR)$(bindir)/stap; then \
325 echo $(DESTDIR)$(bindir)/stap doesn\'t exist, run make install; \
326 exit -1; \
327 fi; \
328 if test $(builddir)/stap -nt $(DESTDIR)$(bindir)/stap; then \
329 echo "$(DESTDIR)$(bindir)/stap is not recent, run make install"; \
330 exit -1; \
331 fi;
332 $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)"
333
334 PHONIES += runcheck
335 # All the variables are overridden by run-stap, but SYSTEMTAP_RUNTIME
336 # is used by the testsuite scripts themselves.
337 runcheck: testsuite/stap testsuite/dtrace
338 $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" \
339 SYSTEMTAP_PATH="`cd testsuite; pwd`" \
340 SYSTEMTAP_RUNTIME="`cd $(srcdir)/runtime; pwd`"
341 testsuite/stap: run-stap
342 (echo '#!/bin/sh'; echo "exec `pwd`/run-stap" '$${1+"$$@"}') > $@.new
343 chmod 555 $@.new
344 mv -f $@.new $@
345 testsuite/dtrace: dtrace
346 (echo '#!/bin/sh'; echo "exec `pwd`/dtrace" '$${1+"$$@"}') > $@.new
347 chmod 555 $@.new
348 mv -f $@.new $@
349
350 PHONIES += update-po
351 update-po:
352 (cd $(srcdir); ls -1d *.c *.cxx *.h staprun/*.c staprun/*.h) \
353 | grep -v loc2c-test.c \
354 | grep -v config.h \
355 | grep -v git_version.h \
356 | grep -v staprun/config.h \
357 | sort > $(srcdir)/po/POTFILES.in
358 $(MAKE) -C po update-po
359
360
361 # Any extra flags, such as:
362 # --define "with_docs 0"
363 # --define "with_bundled_elfutils 1" --define "elfutils_version 0.135"
364 RPMBUILDFLAGS=
365
366 PHONIES += dist-gzip rpm srpm
367
368 PHONIES += uprobes install-uprobes
369 uprobes:
370 $(MAKE) -C $(srcdir)/runtime/uprobes clean default
371 install-uprobes:
372 $(MAKE) -C $(DESTDIR)$(pkgdatadir)/runtime/uprobes clean default
373
374 .PHONY: $(PHONIES)
375
376 dist-gzip:
377 cd $(srcdir); git status | grep working.directory.clean || (echo "You should commit your changes before 'make rpm'.")
378 (cd $(srcdir); git archive --prefix=systemtap-$(VERSION)/ --format=tar HEAD) | gzip > systemtap-$(VERSION).tar.gz
379
380 rpm: dist-gzip
381 if [ `id -u` = 0 ]; then echo NOTE: do not run this as root; exit 1; fi
382 mkdir -p `rpm --eval %_specdir`
383 mkdir -p `rpm --eval %_srcrpmdir`
384 mkdir -p `rpm --eval %_rpmdir`
385 mkdir -p `rpm --eval %_builddir`
386 mkdir -p `rpm --eval %_buildroot`
387 rpmbuild --define "_sourcedir $(PWD)/" -ta systemtap-$(VERSION).tar.gz $(RPMBUILDFLAGS)
388
389 srpm: dist-gzip
390 mkdir -p `rpm --eval %_srcrpmdir`
391 rpmbuild --define "_sourcedir $(PWD)/" -ts systemtap-$(VERSION).tar.gz $(RPMBUILDFLAGS)
392
393 ACLOCAL_AMFLAGS = -I m4
This page took 0.051051 seconds and 5 git commands to generate.