automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: hack distdir to support SUN make in VPATH builds.


From: Alexandre Duret-Lutz
Subject: FYI: hack distdir to support SUN make in VPATH builds.
Date: Thu, 05 Sep 2002 16:27:53 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-debian-linux-gnu)

I'm checking this in.  This allows `make distdir' to work despite
Sun make's VPATH munging.

The idea of stripping $(srcdir) like comes from the following
post of Tom:

  http://gcc.gnu.org/ml/gcc-patches/2001-06/msg00067.html

Tom, I couldn't reproduce the error you mention with
../include/x.h, on this box.  That's probably good news :)
% uname -a
SunOS atlaua 5.8 Generic_108528-09 sun4u sparc SUNW,Ultra-250


I've run `make check' successfully on sparc-sun-solaris2.8 (32
tests skipped) and i686-pc-linux-gnu (1 test skipped).

2002-09-05  Alexandre Duret-Lutz  <address@hidden>

        * lib/am/distdir.am (distcheck): Strip $(srcdir) prefix on
        distributed files, to workaround Sun make VPATH munging.
        This fixes subdircond2.test, subdircond3.test, and subpkg.test
        on Solaris.
        * tests/extra6.test, tests/lex3.test, tests/pr87.test,
        tests/pr9.test, tests/target-cflags.test, tests/texinfo13.test,
        tests/texinfo16.test, tests/yacc7.test, tests/yaccvpath.test:
        Don't require GNU make.

Index: lib/am/distdir.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/distdir.am,v
retrieving revision 1.37
diff -u -r1.37 distdir.am
--- lib/am/distdir.am   5 Sep 2002 10:25:06 -0000       1.37
+++ lib/am/distdir.am   5 Sep 2002 14:12:17 -0000
@@ -62,7 +62,35 @@
 ?DISTDIRS?     $(mkinstalldirs) %DISTDIRS%
 ##
 ##
-       @list='$(DISTFILES)'; for file in $$list; do \
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+##
+## Yet another hack to support SUN make.
+##
+## Let's assume `foo' appears in DISTFILES and is not a built file.
+## When building with VPATH=$(srcdir), SUN make will rewrite `foo' as
+## `$(srcdir)/foo'.  An attempt to install the file with
+##    cp $file $(distdir)/$file
+## will thus install $(srcdir)/foo as $(distdir)/$(srcdir)/foo
+## instead of $(distdir)/foo.
+##
+## So let's strip this leading $(srcdir)/ when it exists.  (As far we
+## know, only SUN make adds it.)  Searching whether the file is to be
+## found in the source or build directory will be done latter.
+##
+## In case we are _not_ using SUN make, how can we be sure we are
+## not stripping a legitimate filename that starts with the same
+## pattern as $(srcdir)?
+## Well, it can't happen without the Makefile author distributing
+## something out of the distribution (which is bad).   As an example,
+## consider `EXTRA_DIST = ../bar'.  This is an issue if $srcdir is `..',
+## however getting this value for srcdir is impossible: `EXTRA_DIST = ../bar'
+## implies we are in a subdirectory (so `../bar' is within the package),
+## hence `$srcdir' is something like `../../subdir'.
+##
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+         esac; \
 ##
 ## Always look for the file in the build directory first.  That way
 ## for something like yacc output we will correctly pick up the latest
Index: tests/extra6.test
===================================================================
RCS file: /cvs/automake/automake/tests/extra6.test,v
retrieving revision 1.4
diff -u -r1.4 extra6.test
--- tests/extra6.test   18 Jun 2002 19:08:27 -0000      1.4
+++ tests/extra6.test   5 Sep 2002 14:12:17 -0000
@@ -3,8 +3,6 @@
 # Check to make sure EXTRA_DIST can contain a directory or
 # a subdirectory, in $(builddir) or $(srcdir).
 
-# 'make distdir' + VPATH does not work with Solaris make.
-required=GNUmake
 . $srcdir/defs || exit 1
 
 set -e
Index: tests/lex3.test
===================================================================
RCS file: /cvs/automake/automake/tests/lex3.test,v
retrieving revision 1.10
diff -u -r1.10 lex3.test
--- tests/lex3.test     21 Jun 2002 20:24:33 -0000      1.10
+++ tests/lex3.test     5 Sep 2002 14:12:17 -0000
@@ -3,7 +3,7 @@
 # Test associated with PR 19.
 # From Matthew D. Langston.
 
-required='GNUmake gcc gzip'
+required='gcc gzip'
 . $srcdir/defs || exit 1
 
 # Ignore user CFLAGS.
Index: tests/pr87.test
===================================================================
RCS file: /cvs/automake/automake/tests/pr87.test,v
retrieving revision 1.13
diff -u -r1.13 pr87.test
--- tests/pr87.test     18 Jun 2002 19:44:48 -0000      1.13
+++ tests/pr87.test     5 Sep 2002 14:12:17 -0000
@@ -2,8 +2,7 @@
 
 # Test for PR automake/87.
 
-# Require GNU make for `make distcheck'
-required='GNUmake gcc'
+required=gcc
 . $srcdir/defs || exit 1
 
 subdirs="foo bar"
Index: tests/pr9.test
===================================================================
RCS file: /cvs/automake/automake/tests/pr9.test,v
retrieving revision 1.9
diff -u -r1.9 pr9.test
--- tests/pr9.test      18 Jun 2002 19:08:28 -0000      1.9
+++ tests/pr9.test      5 Sep 2002 14:12:17 -0000
@@ -2,8 +2,7 @@
 
 # Test for bug in PR 9.
 
-# `distcheck' requires GNU make.
-required='GNUmake gzip'
+required=gzip
 . $srcdir/defs || exit 1
 
 cat > configure.in << 'END'
Index: tests/target-cflags.test
===================================================================
RCS file: /cvs/automake/automake/tests/target-cflags.test,v
retrieving revision 1.9
diff -u -r1.9 target-cflags.test
--- tests/target-cflags.test    18 Jun 2002 19:44:48 -0000      1.9
+++ tests/target-cflags.test    5 Sep 2002 14:12:17 -0000
@@ -3,7 +3,7 @@
 # Test to make sure target specific CFLAGS work
 # Assar Westerlund <address@hidden>
 
-required='GNUmake gcc'
+required=gcc
 . $srcdir/defs || exit 1
 
 cat > configure.in << 'END'
Index: tests/texinfo13.test
===================================================================
RCS file: /cvs/automake/automake/tests/texinfo13.test,v
retrieving revision 1.1
diff -u -r1.1 texinfo13.test
--- tests/texinfo13.test        25 Aug 2002 20:45:51 -0000      1.1
+++ tests/texinfo13.test        5 Sep 2002 14:12:17 -0000
@@ -3,7 +3,7 @@
 # Check for subdir Texinfo.
 # PR/343
 
-required='GNUmake makeinfo'
+required='makeinfo'
 . $srcdir/defs || exit 1
 
 set -e
Index: tests/texinfo16.test
===================================================================
RCS file: /cvs/automake/automake/tests/texinfo16.test,v
retrieving revision 1.1
diff -u -r1.1 texinfo16.test
--- tests/texinfo16.test        30 Jul 2002 20:15:32 -0000      1.1
+++ tests/texinfo16.test        5 Sep 2002 14:12:17 -0000
@@ -2,7 +2,7 @@
 
 # Check that info files are built in $(srcdir).
 
-required='GNUmake makeinfo'
+required='makeinfo'
 . $srcdir/defs || exit 1
 
 set -e
Index: tests/yacc7.test
===================================================================
RCS file: /cvs/automake/automake/tests/yacc7.test,v
retrieving revision 1.10
diff -u -r1.10 yacc7.test
--- tests/yacc7.test    21 Jun 2002 19:59:40 -0000      1.10
+++ tests/yacc7.test    5 Sep 2002 14:12:17 -0000
@@ -6,7 +6,6 @@
 # Also check that the sources of the generated parser are distributed.
 # PR/47.
 
-required=GNUmake
 . $srcdir/defs || exit 1
 
 cat >> configure.in << 'END'
Index: tests/yaccvpath.test
===================================================================
RCS file: /cvs/automake/automake/tests/yaccvpath.test,v
retrieving revision 1.11
diff -u -r1.11 yaccvpath.test
--- tests/yaccvpath.test        18 Jun 2002 19:55:58 -0000      1.11
+++ tests/yaccvpath.test        5 Sep 2002 14:12:17 -0000
@@ -6,8 +6,7 @@
 # `make' and `make distdir' and check whether the version of `parse.c'
 # to be distributed is up to date.
 
-# Require GNU make for `make distdir'
-required='GNUmake gcc bison'
+required='gcc bison'
 . $srcdir/defs || exit 1
 
 cat > configure.in << 'END'

-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]