From: Nicholas Nethercote Date: Wed, 1 Sep 2004 23:20:49 +0000 (+0000) Subject: Use Makefile.am includes. This gets rid of 110 lines of repetitive Makefile.am X-Git-Tag: svn/VALGRIND_3_0_0~1642 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acd57ac59563279d750e1de6fe40cfdf1113546d;p=thirdparty%2Fvalgrind.git Use Makefile.am includes. This gets rid of 110 lines of repetitive Makefile.am cruft, yay! git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2641 --- diff --git a/Makefile.all.am b/Makefile.all.am new file mode 100644 index 0000000000..d1b45fca3d --- /dev/null +++ b/Makefile.all.am @@ -0,0 +1,8 @@ + +## This file should be included by *every* Makefile.am, except those for docs/ +## and tests/ subdirectories. + +valdir = $(libdir)/valgrind +inplacedir = $(top_builddir)/.in_place + + diff --git a/Makefile.am b/Makefile.am index 60252dd960..00cd05defc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,9 @@ AUTOMAKE_OPTIONS = foreign 1.6 dist-bzip2 -## include must be first for vg_skin.h +include $(top_srcdir)/Makefile.all.am + +## include must be first for tool.h ## addrcheck must come after memcheck, for mac_*.o SUBDIRS = include coregrind . docs tests auxprogs \ memcheck \ @@ -13,13 +15,6 @@ SUBDIRS = include coregrind . docs tests auxprogs \ lackey \ none -AM_CPPFLAGS = -AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ - @PREFERRED_STACK_BOUNDARY@ -g - -valdir = $(libdir)/valgrind -inplacedir = $(top_builddir)/.in_place - SUPP_FILES = \ glibc-2.1.supp glibc-2.2.supp glibc-2.3.supp \ xfree-3.supp xfree-4.supp @@ -44,7 +39,9 @@ EXTRA_DIST = \ ACKNOWLEDGEMENTS \ README_PACKAGERS \ README_MISSING_SYSCALL_OR_IOCTL TODO \ - valgrind.spec.in valgrind.pc.in + valgrind.spec.in valgrind.pc.in \ + Makefile.all.am Makefile.tool.am Makefile.core-AM_CPPFLAGS.am \ + Makefile.tool-inplace.am install-exec-hook: $(mkinstalldirs) $(DESTDIR)$(valdir) diff --git a/Makefile.core-AM_CPPFLAGS.am b/Makefile.core-AM_CPPFLAGS.am new file mode 100644 index 0000000000..4a68b1ad09 --- /dev/null +++ b/Makefile.core-AM_CPPFLAGS.am @@ -0,0 +1,5 @@ +add_includes = -I$(top_builddir)/coregrind -I$(top_srcdir)/coregrind \ + -I$(top_builddir)/include -I$(top_srcdir)/include + +AM_CPPFLAGS = $(add_includes) + diff --git a/Makefile.tool-inplace.am b/Makefile.tool-inplace.am new file mode 100644 index 0000000000..75d4991df9 --- /dev/null +++ b/Makefile.tool-inplace.am @@ -0,0 +1,4 @@ +all-local: + mkdir -p $(inplacedir) + -rm -f $(addprefix $(inplacedir)/,$(val_PROGRAMS)) + ln -f -s $(addprefix ../$(subdir)/,$(val_PROGRAMS)) $(inplacedir) diff --git a/Makefile.tool.am b/Makefile.tool.am new file mode 100644 index 0000000000..cdde4b8d3b --- /dev/null +++ b/Makefile.tool.am @@ -0,0 +1,16 @@ + +include $(top_srcdir)/Makefile.all.am + +SUBDIRS = . tests docs + +## Need $(top_builddir)/include because tool.h is built from tool.h.base; +## otherwise it will not work if builddir != srcdir. +add_includes = -I$(top_builddir)/include -I$(top_srcdir)/include + +AM_CPPFLAGS = $(add_includes) +AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ + @PREFERRED_STACK_BOUNDARY@ -g +AM_CCASFLAGS = $(add_includes) + +include $(top_srcdir)/Makefile.tool-inplace.am + diff --git a/addrcheck/Makefile.am b/addrcheck/Makefile.am index df789a4714..dba0a481ec 100644 --- a/addrcheck/Makefile.am +++ b/addrcheck/Makefile.am @@ -1,14 +1,7 @@ - -SUBDIRS = . docs tests +include $(top_srcdir)/Makefile.tool.am # include memcheck/ for mac_shared.h -AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ - -I$(top_srcdir)/memcheck -AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ - @PREFERRED_STACK_BOUNDARY@ -g - -valdir = $(libdir)/valgrind -inplacedir = $(top_builddir)/.in_place +AM_CPPFLAGS += -I$(top_srcdir)/memcheck val_PROGRAMS = vgskin_addrcheck.so vgpreload_addrcheck.so @@ -28,7 +21,3 @@ vgpreload_addrcheck_so_DEPENDENCIES = \ ../memcheck/mac_replace_strmem.o vgpreload_addrcheck_so_LDFLAGS = -shared -Wl,-z,interpose,-z,initfirst -all-local: - mkdir -p $(inplacedir) - -rm -f $(addprefix $(inplacedir)/,$(val_PROGRAMS)) - ln -f -s $(addprefix $(top_builddir)/$(subdir)/,$(val_PROGRAMS)) $(inplacedir) diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index bd46a4112a..1e31292cab 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -1,12 +1,9 @@ +include $(top_srcdir)/Makefile.all.am +include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am -SUBDIRS = . - -AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ - -I$(top_builddir)/coregrind -I$(top_srcdir)/coregrind AM_CFLAGS = $(WERROR) -Winline -Wall -O -g bin_PROGRAMS = valgrind-listener -valgrind_listener_SOURCES = \ - valgrind-listener.c +valgrind_listener_SOURCES = valgrind-listener.c diff --git a/cachegrind/Makefile.am b/cachegrind/Makefile.am index f1735bda67..284006781e 100644 --- a/cachegrind/Makefile.am +++ b/cachegrind/Makefile.am @@ -1,12 +1,4 @@ - -SUBDIRS = . docs tests - -AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ - @PREFERRED_STACK_BOUNDARY@ -g - -valdir = $(libdir)/valgrind -inplacedir = $(top_builddir)/.in_place +include $(top_srcdir)/Makefile.tool.am bin_SCRIPTS = cg_annotate @@ -17,7 +9,3 @@ val_PROGRAMS = vgskin_cachegrind.so vgskin_cachegrind_so_SOURCES = cg_main.c vgskin_cachegrind_so_LDFLAGS = -shared -all-local: - mkdir -p $(inplacedir) - -rm -f $(inplacedir)/$(val_PROGRAMS) - ln -f -s $(top_builddir)/$(subdir)/$(val_PROGRAMS) $(inplacedir)/$(val_PROGRAMS) diff --git a/corecheck/Makefile.am b/corecheck/Makefile.am index b790a83703..9e4c37b7d0 100644 --- a/corecheck/Makefile.am +++ b/corecheck/Makefile.am @@ -1,19 +1,7 @@ - -SUBDIRS = . tests docs - -AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ - @PREFERRED_STACK_BOUNDARY@ -g - -valdir = $(libdir)/valgrind -inplacedir = $(top_builddir)/.in_place +include $(top_srcdir)/Makefile.tool.am val_PROGRAMS = vgskin_corecheck.so vgskin_corecheck_so_SOURCES = cc_main.c vgskin_corecheck_so_LDFLAGS = -shared -all-local: - mkdir -p $(inplacedir) - -rm -f $(inplacedir)/$(val_PROGRAMS) - ln -f -s $(top_builddir)/$(subdir)/$(val_PROGRAMS) $(inplacedir)/$(val_PROGRAMS) diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am index adfb629be6..b8696479af 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am @@ -1,13 +1,10 @@ +include $(top_srcdir)/Makefile.all.am +include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am SUBDIRS = x86 demangle . docs -add_includes = -I$(srcdir)/demangle -I$(top_builddir)/include \ - -I$(top_srcdir)/include -I$(srcdir)/x86 - -valdir = $(libdir)/valgrind -inplacedir = $(top_builddir)/.in_place - -AM_CPPFLAGS = $(add_includes) -DVG_LIBDIR="\"$(valdir)"\" \ +AM_CPPFLAGS += -DVG_LIBDIR="\"$(valdir)"\" -I$(srcdir)/demangle \ + -I$(srcdir)/x86 \ -DKICKSTART_BASE=$(KICKSTART_BASE) AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fno-omit-frame-pointer \ @PREFERRED_STACK_BOUNDARY@ -g -DELFSZ=32 diff --git a/coregrind/demangle/Makefile.am b/coregrind/demangle/Makefile.am index b1956c44e9..9aa1b3ad9b 100644 --- a/coregrind/demangle/Makefile.am +++ b/coregrind/demangle/Makefile.am @@ -1,6 +1,6 @@ +include $(top_srcdir)/Makefile.all.am +include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am -AM_CPPFLAGS = -I$(top_builddir)/coregrind -I$(top_srcdir)/coregrind \ - -I$(top_builddir)/include -I$(top_srcdir)/include AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer -g noinst_HEADERS = \ @@ -14,6 +14,7 @@ noinst_LIBRARIES = libdemangle.a libdemangle_a_SOURCES = \ cp-demangle.c cplus-dem.c dyn-string.c safe-ctype.c +## Ignore harmless warnings for these ones cp-demangle.o: CFLAGS += -Wno-unused -Wno-shadow cplus-dem.o: CFLAGS += -Wno-unused diff --git a/helgrind/Makefile.am b/helgrind/Makefile.am index 05b4ea42eb..68aa37fd8f 100644 --- a/helgrind/Makefile.am +++ b/helgrind/Makefile.am @@ -1,12 +1,4 @@ - -SUBDIRS = . docs tests - -AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ - @PREFERRED_STACK_BOUNDARY@ -g - -valdir = $(libdir)/valgrind -inplacedir = $(top_builddir)/.in_place +include $(top_srcdir)/Makefile.tool.am val_PROGRAMS = vgskin_helgrind.so vgpreload_helgrind.so @@ -22,7 +14,3 @@ hgincludedir = $(includedir)/valgrind hginclude_HEADERS = helgrind.h -all-local: - mkdir -p $(inplacedir) - -rm -f $(addprefix $(inplacedir)/,$(val_PROGRAMS)) - ln -f -s $(addprefix $(top_builddir)/$(subdir)/,$(val_PROGRAMS)) $(inplacedir) diff --git a/lackey/Makefile.am b/lackey/Makefile.am index 7bbc4f25fb..a21574b9e4 100644 --- a/lackey/Makefile.am +++ b/lackey/Makefile.am @@ -1,20 +1,7 @@ - -SUBDIRS = . docs tests - -AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ - @PREFERRED_STACK_BOUNDARY@ -g - -valdir = $(libdir)/valgrind -inplacedir = $(top_builddir)/.in_place +include $(top_srcdir)/Makefile.tool.am val_PROGRAMS = vgskin_lackey.so vgskin_lackey_so_SOURCES = lk_main.c vgskin_lackey_so_LDFLAGS = -shared - -all-local: - mkdir -p $(inplacedir) - -rm -f $(inplacedir)/$(val_PROGRAMS) - ln -f -s $(top_builddir)/$(subdir)/$(val_PROGRAMS) $(inplacedir)/$(val_PROGRAMS) diff --git a/massif/Makefile.am b/massif/Makefile.am index bc2616143c..620c4f1d87 100644 --- a/massif/Makefile.am +++ b/massif/Makefile.am @@ -1,12 +1,6 @@ +include $(top_srcdir)/Makefile.tool.am -SUBDIRS = . tests docs hp2ps - -AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ - @PREFERRED_STACK_BOUNDARY@ -g - -valdir = $(libdir)/valgrind -inplacedir = $(top_builddir)/.in_place +SUBDIRS += hp2ps val_PROGRAMS = vgskin_massif.so vgpreload_massif.so @@ -18,7 +12,3 @@ vgpreload_massif_so_LDADD = $(top_builddir)/coregrind/vg_replace_malloc.o vgpreload_massif_so_DEPENDENCIES = $(top_builddir)/coregrind/vg_replace_malloc.o vgpreload_massif_so_LDFLAGS = -shared -Wl,-z,interpose,-z,initfirst -all-local: - mkdir -p $(inplacedir) - -rm -f $(addprefix $(inplacedir)/,$(val_PROGRAMS)) - ln -f -s $(addprefix $(top_builddir)/$(subdir)/,$(val_PROGRAMS)) $(inplacedir) diff --git a/massif/hp2ps/Makefile.am b/massif/hp2ps/Makefile.am index 58e39a30dd..1f5100623c 100644 --- a/massif/hp2ps/Makefile.am +++ b/massif/hp2ps/Makefile.am @@ -1,11 +1,6 @@ +include $(top_srcdir)/Makefile.all.am -valdir = $(libdir)/valgrind -inplacedir = $(top_builddir)/.in_place - -AM_CPPFLAGS = $(add_includes) -AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fno-omit-frame-pointer \ - @PREFERRED_STACK_BOUNDARY@ -g -AM_CCASFLAGS = $(add_includes) +AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -g val_PROGRAMS = hp2ps @@ -59,8 +54,5 @@ noinst_HEADERS = \ TraceElement.h \ Utilities.h -all-local: - mkdir -p $(inplacedir) - -rm -f $(addprefix $(inplacedir)/,$(val_PROGRAMS)) - ln -f -s $(addprefix ../$(subdir)/,$(val_PROGRAMS)) $(inplacedir) +include $(top_srcdir)/Makefile.tool-inplace.am diff --git a/memcheck/Makefile.am b/memcheck/Makefile.am index e46a5beb1f..a19a9062d8 100644 --- a/memcheck/Makefile.am +++ b/memcheck/Makefile.am @@ -1,15 +1,7 @@ +include $(top_srcdir)/Makefile.tool.am -SUBDIRS = . tests docs - -all_includes = -I$(top_builddir)/include -I$(top_srcdir)/include - -AM_CPPFLAGS = $(all_includes) -AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O2 -fomit-frame-pointer \ - @PREFERRED_STACK_BOUNDARY@ -g -AM_CCASFLAGS = $(all_includes) - -valdir = $(libdir)/valgrind -inplacedir = $(top_builddir)/.in_place +## Build Memcheck at a higher optimisation level +AM_CFLAGS += -O2 val_PROGRAMS = vgskin_memcheck.so vgpreload_memcheck.so @@ -43,7 +35,3 @@ noinst_HEADERS = \ mac_replace_strmem.o: CFLAGS += -fno-omit-frame-pointer -all-local: - mkdir -p $(inplacedir) - -rm -f $(addprefix $(inplacedir)/,$(val_PROGRAMS)) - ln -f -s $(addprefix $(top_builddir)/$(subdir)/,$(val_PROGRAMS)) $(inplacedir) diff --git a/none/Makefile.am b/none/Makefile.am index f27ec45978..a4fc9e6faf 100644 --- a/none/Makefile.am +++ b/none/Makefile.am @@ -1,19 +1,7 @@ - -SUBDIRS = . docs tests - -AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ - @PREFERRED_STACK_BOUNDARY@ -g - -valdir = $(libdir)/valgrind -inplacedir = $(top_builddir)/.in_place +include $(top_srcdir)/Makefile.tool.am val_PROGRAMS = vgskin_none.so vgskin_none_so_SOURCES = nl_main.c vgskin_none_so_LDFLAGS = -shared -all-local: - mkdir -p $(inplacedir) - -rm -f $(inplacedir)/$(val_PROGRAMS) - ln -f -s $(top_builddir)/$(subdir)/$(val_PROGRAMS) $(inplacedir)/$(val_PROGRAMS)