From a2a0946b8a6517592ae03282054c61db0373e2fa Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 29 Jun 2004 09:45:37 +0000 Subject: [PATCH] Make VPATH builds work so that valgrind can be built in a different directory from the source tree. This resolves bug 83040. Based on patch from Ralf Wildenhues . git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2450 --- Makefile.am | 3 ++- addrcheck/Makefile.am | 4 ++-- auxprogs/Makefile.am | 3 ++- cachegrind/Makefile.am | 3 ++- corecheck/Makefile.am | 3 ++- coregrind/Makefile.am | 15 ++++++++------- coregrind/demangle/Makefile.am | 3 ++- helgrind/Makefile.am | 3 ++- lackey/Makefile.am | 3 ++- massif/Makefile.am | 3 ++- memcheck/Makefile.am | 2 +- none/Makefile.am | 3 ++- 12 files changed, 29 insertions(+), 19 deletions(-) diff --git a/Makefile.am b/Makefile.am index 271e1b885..02e2c8566 100644 --- a/Makefile.am +++ b/Makefile.am @@ -53,7 +53,8 @@ install-exec-hook: all-local: mkdir -p $(top_builddir)/.in_place rm -f $(addprefix $(top_builddir)/.in_place/,default.supp $(SUPP_FILES)) - ln -s $(addprefix $(top_srcdir)/../,default.supp $(SUPP_FILES)) $(top_builddir)/.in_place + ln -s ../default.supp $(top_builddir)/.in_place + ln -s $(addprefix ../$(top_srcdir)/,$(SUPP_FILES)) $(top_builddir)/.in_place distclean-local: rm -rf $(top_builddir)/.in_place diff --git a/addrcheck/Makefile.am b/addrcheck/Makefile.am index 3c86d5bac..f4f97c267 100644 --- a/addrcheck/Makefile.am +++ b/addrcheck/Makefile.am @@ -2,8 +2,8 @@ SUBDIRS = . docs tests # include memcheck/ for mac_shared.h -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/memcheck \ - -DVG_LIBDIR="\"$(libdir)"\" +AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ + -I$(top_srcdir)/memcheck -DVG_LIBDIR="\"$(libdir)"\" AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ @PREFERRED_STACK_BOUNDARY@ -g diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index 62e0ff71c..d9d0b2dc0 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS = . -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/coregrind \ +AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ + -I$(top_builddir)/coregrind -I$(top_srcdir)/coregrind \ -DVG_LIBDIR="\"$(libdir)"\" AM_CFLAGS = $(WERROR) -Winline -Wall -O -g diff --git a/cachegrind/Makefile.am b/cachegrind/Makefile.am index a00235e24..0f0a5fea1 100644 --- a/cachegrind/Makefile.am +++ b/cachegrind/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS = . docs tests -AM_CPPFLAGS = -I$(top_srcdir)/include -DVG_LIBDIR="\"$(libdir)"\" +AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ + -DVG_LIBDIR="\"$(libdir)"\" AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ @PREFERRED_STACK_BOUNDARY@ -g diff --git a/corecheck/Makefile.am b/corecheck/Makefile.am index b1682cc16..02880dcdb 100644 --- a/corecheck/Makefile.am +++ b/corecheck/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS = . tests docs -AM_CPPFLAGS = -I$(top_srcdir)/include -DVG_LIBDIR="\"$(libdir)"\" +AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ + -DVG_LIBDIR="\"$(libdir)"\" AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ @PREFERRED_STACK_BOUNDARY@ -g diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am index affceefdd..f4855d06f 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS = x86 demangle . docs -add_includes = -I$(srcdir)/demangle -I$(top_srcdir)/include -I$(srcdir)/x86 +add_includes = -I$(srcdir)/demangle -I$(top_builddir)/include \ + -I$(top_srcdir)/include -I$(srcdir)/x86 valdir = $(libdir)/valgrind inplacedir = $(top_builddir)/.in_place @@ -90,15 +91,15 @@ stage2_LDADD= \ demangle/safe-ctype.o \ -ldl -vg_intercept.c: $(srcdir)/gen_intercepts.pl vg_intercept.c.base +vg_intercept.c: $(srcdir)/gen_intercepts.pl $(srcdir)/vg_intercept.c.base rm -f $@ - $(PERL) $(srcdir)/gen_intercepts.pl < vg_intercept.c.base > $@ + $(PERL) $(srcdir)/gen_intercepts.pl < $(srcdir)/vg_intercept.c.base > $@ -vg_replace_malloc.c: $(srcdir)/gen_intercepts.pl vg_replace_malloc.c.base +vg_replace_malloc.c: $(srcdir)/gen_intercepts.pl $(srcdir)/vg_replace_malloc.c.base rm -f $@ - $(PERL) $(srcdir)/gen_intercepts.pl < vg_replace_malloc.c.base > $@ + $(PERL) $(srcdir)/gen_intercepts.pl < $(srcdir)/vg_replace_malloc.c.base > $@ -vg_toolint.c: $(srcdir)/gen_toolint.pl $(srcdir)/toolfuncs.def $(srcdir)/Makefile +vg_toolint.c: $(srcdir)/gen_toolint.pl $(srcdir)/toolfuncs.def ./Makefile rm -f $@ $(PERL) $(srcdir)/gen_toolint.pl callwrap < $(srcdir)/toolfuncs.def > $@ || rm -f $@ $(PERL) $(srcdir)/gen_toolint.pl missingfuncs < $(srcdir)/toolfuncs.def >> $@ || rm -f $@ @@ -106,7 +107,7 @@ vg_toolint.c: $(srcdir)/gen_toolint.pl $(srcdir)/toolfuncs.def $(srcdir)/Makefil $(PERL) $(srcdir)/gen_toolint.pl initdlsym < $(srcdir)/toolfuncs.def >> $@ || rm -f $@ $(PERL) $(srcdir)/gen_toolint.pl structdef < $(srcdir)/toolfuncs.def >> $@ || rm -f $@ -vg_toolint.h: $(srcdir)/gen_toolint.pl $(srcdir)/toolfuncs.def $(srcdir)/Makefile +vg_toolint.h: $(srcdir)/gen_toolint.pl $(srcdir)/toolfuncs.def ./Makefile rm -f $@ $(PERL) $(srcdir)/gen_toolint.pl proto < $(srcdir)/toolfuncs.def > $@ || rm -f $@ $(PERL) $(srcdir)/gen_toolint.pl struct < $(srcdir)/toolfuncs.def >> $@ || rm -f $@ diff --git a/coregrind/demangle/Makefile.am b/coregrind/demangle/Makefile.am index 1ac2b8fc8..b1956c44e 100644 --- a/coregrind/demangle/Makefile.am +++ b/coregrind/demangle/Makefile.am @@ -1,5 +1,6 @@ -AM_CPPFLAGS = -I$(top_srcdir)/coregrind -I$(top_srcdir)/include +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 = \ diff --git a/helgrind/Makefile.am b/helgrind/Makefile.am index eab751501..09dc6a844 100644 --- a/helgrind/Makefile.am +++ b/helgrind/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS = . docs tests -AM_CPPFLAGS = -I$(top_srcdir)/include -DVG_LIBDIR="\"$(libdir)"\" +AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ + -DVG_LIBDIR="\"$(libdir)"\" AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ @PREFERRED_STACK_BOUNDARY@ -g diff --git a/lackey/Makefile.am b/lackey/Makefile.am index fdadc30e4..7b0599b48 100644 --- a/lackey/Makefile.am +++ b/lackey/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS = . docs tests -AM_CPPFLAGS = -I$(top_srcdir)/include -DVG_LIBDIR="\"$(libdir)"\" +AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ + -DVG_LIBDIR="\"$(libdir)"\" AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ @PREFERRED_STACK_BOUNDARY@ -g diff --git a/massif/Makefile.am b/massif/Makefile.am index 7e1ce6b18..65a69383d 100644 --- a/massif/Makefile.am +++ b/massif/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS = . tests docs hp2ps -AM_CPPFLAGS = -I$(top_srcdir)/include -DVG_LIBDIR="\"$(libdir)"\" +AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ + -DVG_LIBDIR="\"$(libdir)"\" AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ @PREFERRED_STACK_BOUNDARY@ -g diff --git a/memcheck/Makefile.am b/memcheck/Makefile.am index ec5c4731e..5d5fd1568 100644 --- a/memcheck/Makefile.am +++ b/memcheck/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = . tests docs -all_includes = -I$(top_srcdir)/include +all_includes = -I$(top_builddir)/include -I$(top_srcdir)/include AM_CPPFLAGS = $(all_includes) -DVG_LIBDIR="\"$(libdir)"\" AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O2 -fomit-frame-pointer \ diff --git a/none/Makefile.am b/none/Makefile.am index 30a631ea4..775a0cd9b 100644 --- a/none/Makefile.am +++ b/none/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS = . docs tests -AM_CPPFLAGS = -I$(top_srcdir)/include -DVG_LIBDIR="\"$(libdir)"\" +AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ + -DVG_LIBDIR="\"$(libdir)"\" AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer \ @PREFERRED_STACK_BOUNDARY@ -g