From: Nicholas Nethercote Date: Fri, 6 Feb 2009 07:12:57 +0000 (+0000) Subject: Make Makefile.install.am much less confusing. X-Git-Tag: svn/VALGRIND_3_5_0~1015 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2d5f140a5b52f637cb138216c57cfd697d7c04cb;p=thirdparty%2Fvalgrind.git Make Makefile.install.am much less confusing. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9118 --- diff --git a/Makefile.inplace.am b/Makefile.inplace.am index 839fc32fae..c524832dde 100644 --- a/Makefile.inplace.am +++ b/Makefile.inplace.am @@ -1,8 +1,8 @@ # This is used by coregrind/Makefile.am and Makefile.tool.am for doing # "in-place" installs. It copies $(noinst_PROGRAMS) into $inplacedir, doing # some magic renaming as it does. -# For a description of what these magic sed commands do, see comments -# in Makefile.install.am (which has identical magic) +# There is similar code in Makefile.install.am (which describes how the +# magic sed commands work). all-local: if [ -n "$(noinst_PROGRAMS)" ] ; then \ diff --git a/Makefile.install.am b/Makefile.install.am index 8ac1db947f..b2facf1bb3 100644 --- a/Makefile.install.am +++ b/Makefile.install.am @@ -1,6 +1,11 @@ - -# What the first for loop does: it copies a bunch of files which names -# of the form wurble-arch-os to $prefix/lib/valgrind/arch-os/wurble. +# This is used by coregrind/Makefile.am and by /Makefile.am for doing +# "make install". It copies $(noinst_PROGRAMS) into $prefix/lib/valgrind/, +# doing some magic renaming as it does. +# It needs to be depended on by an 'install-exec-local' rule. +# There is similar code in Makefile.inplace.am. +# +# Details about the renaming: the loop copies a bunch of files with +# names of the form wurble-arch-os to $prefix/lib/valgrind/arch-os/wurble. # There is some complexity in the sed mangling because wurble may itself # contain a dash, which must be ignored. For example we want # exp-omega-x86-linux @@ -9,20 +14,8 @@ # and not in # $prefix/lib/valgrind/omega-x86-linux/exp # or similarly mutant place. -# -# Note there is identical sed magic in Makefile.inplace.am. -# What the second for loop does: it copies libcoregrind.a and libvex.a -# into the correct (target-specific) lib dirs at install time. -# $(noinst_LIBRARIES) will look like this: -# libcoregrind_x86_linux.a libreplacemalloc_toolpreload_x86_linux.a -# libcoregrind_amd64_linux.a libreplacemalloc_toolpreload_amd64_linux.a -# The 'if expr' filters out all but the libcoregrind_ ones. -# pD and pU are the (arch,os) target pairs separated by a dash (pD) or -# an underscore (pU) respectively, eg amd64-linux (pD) and amd64_linux (pU). -# It then copies libcoregrind.a and libvex.a to the right places. - -install-exec-local: +install-exec-local-programs: if [ -n "$(noinst_PROGRAMS)" ] ; then \ for f in $(noinst_PROGRAMS); do \ name=`echo $$f | sed -e 's/-\([^-]*-[^-.]*\)\(\..*\)\?$$/\2/'`; \ @@ -30,15 +23,5 @@ install-exec-local: $(mkinstalldirs) $(DESTDIR)$(valdir)/$$plat; \ $(INSTALL_PROGRAM) $$f $(DESTDIR)$(valdir)/$$plat/$$name; \ done ; \ - fi ; \ - if [ -n "$(noinst_LIBRARIES)" ] ; then \ - for f in $(noinst_LIBRARIES) expr_wont_match_me; do \ - if expr match $$f libcoregrind_ > /dev/null ; then \ - pU=`echo $$f | sed -e 's/libcoregrind_//g' -e 's/\.a//g'` ; \ - pD=`echo $$pU | sed -e 's/_/-/g'` ; \ - $(INSTALL_DATA) $$f $(DESTDIR)$(valdir)/$$pD/libcoregrind.a ; \ - $(INSTALL_DATA) @VEX_DIR@/libvex_$$pU.a \ - $(DESTDIR)$(valdir)/$$pD/libvex.a ; \ - fi ; \ - done ; \ fi + diff --git a/Makefile.tool.am b/Makefile.tool.am index 3c6be1a9ee..8e896f1bd2 100644 --- a/Makefile.tool.am +++ b/Makefile.tool.am @@ -153,3 +153,6 @@ LIBREPLACEMALLOC_LDFLAGS_PPC32_AIX5 = \ LIBREPLACEMALLOC_LDFLAGS_PPC64_AIX5 = \ $(LIBREPLACEMALLOC_PPC64_AIX5) + + +install-exec-local: install-exec-local-programs diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am index 4ae49d35bd..d13d40baea 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am @@ -1,8 +1,7 @@ # Be very careful when renaming any files, targets, whatever, in this -# Makefile. The install-exec-local target in ../Makefile.install.am -# does some fragile sed file-name-mangling which is liable to break if -# the names of noinst_LIBRARIES or noinst_PROGRAMS change 'shape'. +# Makefile. Various parts of the system rely on these names having +# particular forms. include $(top_srcdir)/Makefile.all.am include $(top_srcdir)/Makefile.flags.am @@ -32,23 +31,30 @@ default.supp: $(SUPP_FILES) noinst_LIBRARIES = +LIBPLATFORMS = if VGCONF_PLATFORMS_INCLUDE_X86_LINUX noinst_LIBRARIES += libcoregrind_x86_linux.a libreplacemalloc_toolpreload_x86_linux.a +LIBPLATFORMS += x86_linux endif if VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX noinst_LIBRARIES += libcoregrind_amd64_linux.a libreplacemalloc_toolpreload_amd64_linux.a +LIBPLATFORMS += amd64_linux endif if VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX noinst_LIBRARIES += libcoregrind_ppc32_linux.a libreplacemalloc_toolpreload_ppc32_linux.a +LIBPLATFORMS += ppc32_linux endif if VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX noinst_LIBRARIES += libcoregrind_ppc64_linux.a libreplacemalloc_toolpreload_ppc64_linux.a +LIBPLATFORMS += ppc64_linux endif if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5 noinst_LIBRARIES += libcoregrind_ppc32_aix5.a libreplacemalloc_toolpreload_ppc32_aix5.a +LIBPLATFORMS += ppc32_aix5 endif if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5 noinst_LIBRARIES += libcoregrind_ppc64_aix5.a libreplacemalloc_toolpreload_ppc64_aix5.a +LIBPLATFORMS += ppc64_aix5 endif @@ -267,7 +273,6 @@ libcoregrind_x86_linux_a_SOURCES = \ m_sigframe/sigframe-x86-linux.c \ m_syswrap/syscall-x86-linux.S \ m_syswrap/syswrap-x86-linux.c - libcoregrind_x86_linux_a_CPPFLAGS = $(AM_CPPFLAGS_X86_LINUX) libcoregrind_x86_linux_a_CFLAGS = $(AM_CFLAGS_X86_LINUX) libcoregrind_x86_linux_a_CCASFLAGS = $(AM_CCASFLAGS_X86_LINUX) @@ -280,7 +285,6 @@ libcoregrind_amd64_linux_a_SOURCES = \ m_sigframe/sigframe-amd64-linux.c \ m_syswrap/syscall-amd64-linux.S \ m_syswrap/syswrap-amd64-linux.c - libcoregrind_amd64_linux_a_CPPFLAGS = $(AM_CPPFLAGS_AMD64_LINUX) libcoregrind_amd64_linux_a_CFLAGS = $(AM_CFLAGS_AMD64_LINUX) libcoregrind_amd64_linux_a_CCASFLAGS = $(AM_CCASFLAGS_AMD64_LINUX) @@ -293,7 +297,6 @@ libcoregrind_ppc32_linux_a_SOURCES = \ m_sigframe/sigframe-ppc32-linux.c \ m_syswrap/syscall-ppc32-linux.S \ m_syswrap/syswrap-ppc32-linux.c - libcoregrind_ppc32_linux_a_CPPFLAGS = $(AM_CPPFLAGS_PPC32_LINUX) libcoregrind_ppc32_linux_a_CFLAGS = $(AM_CFLAGS_PPC32_LINUX) libcoregrind_ppc32_linux_a_CCASFLAGS = $(AM_CCASFLAGS_PPC32_LINUX) @@ -306,7 +309,6 @@ libcoregrind_ppc64_linux_a_SOURCES = \ m_sigframe/sigframe-ppc64-linux.c \ m_syswrap/syscall-ppc64-linux.S \ m_syswrap/syswrap-ppc64-linux.c - libcoregrind_ppc64_linux_a_CPPFLAGS = $(AM_CPPFLAGS_PPC64_LINUX) libcoregrind_ppc64_linux_a_CFLAGS = $(AM_CFLAGS_PPC64_LINUX) libcoregrind_ppc64_linux_a_CCASFLAGS = $(AM_CCASFLAGS_PPC64_LINUX) @@ -319,7 +321,6 @@ libcoregrind_ppc32_aix5_a_SOURCES = \ m_sigframe/sigframe-ppc32-aix5.c \ m_syswrap/syscall-ppc32-aix5.S \ m_syswrap/syswrap-ppc32-aix5.c - libcoregrind_ppc32_aix5_a_CPPFLAGS = $(AM_CPPFLAGS_PPC32_AIX5) libcoregrind_ppc32_aix5_a_CFLAGS = $(AM_CFLAGS_PPC32_AIX5) libcoregrind_ppc32_aix5_a_CCASFLAGS = $(AM_CCASFLAGS_PPC32_AIX5) @@ -333,7 +334,6 @@ libcoregrind_ppc64_aix5_a_SOURCES = \ m_sigframe/sigframe-ppc64-aix5.c \ m_syswrap/syscall-ppc64-aix5.S \ m_syswrap/syswrap-ppc64-aix5.c - libcoregrind_ppc64_aix5_a_CPPFLAGS = $(AM_CPPFLAGS_PPC64_AIX5) libcoregrind_ppc64_aix5_a_CFLAGS = $(AM_CFLAGS_PPC64_AIX5) libcoregrind_ppc64_aix5_a_CCASFLAGS = $(AM_CCASFLAGS_PPC64_AIX5) @@ -418,6 +418,22 @@ vgpreload_core_ppc64_aix5_so_LDFLAGS = $(PRELOAD_LDFLAGS_PPC64_AIX5) clean-local: $(MAKE) -C @VEX_DIR@ CC="$(CC)" AR="$(AR)" clean +# Nb: The loop installs some .a files for possible use by standalone tools +# into the correct (target-specific) lib dirs at install time. +# $(LIBPLATFORMS) will look like this: +# x86_linux amd64_linux +# pD and pU are the (arch,os) target pairs separated by a dash (pD) or +# an underscore (pU) respectively, eg amd64-linux (pD) and amd64_linux (pU). +# It then copies the libraries to the right places. +install-exec-local: install-exec-local-programs + for pU in $(LIBPLATFORMS) ; do \ + pD=`echo $$pU | sed -e 's/_/-/g'` ; \ + $(INSTALL_DATA) libcoregrind_$$pU.a $(DESTDIR)$(valdir)/$$pD/libcoregrind.a ; \ + $(INSTALL_DATA) libreplacemalloc_toolpreload_$$pU.a $(DESTDIR)$(valdir)/$$pD/libreplacemalloc_toolpreload.a ; \ + $(INSTALL_DATA) @VEX_DIR@/libvex_$$pU.a $(DESTDIR)$(valdir)/$$pD/libvex.a ; \ + done + + MANUAL_DEPS = $(noinst_HEADERS) $(include_HEADERS) EXTRA_DIST = \