]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* automake.in (handle_subdirs): Warn if `obj' appears in SUBDIRS.
authorAlexandre Duret-Lutz <adl@gnu.org>
Mon, 22 Jul 2002 20:53:03 +0000 (20:53 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Mon, 22 Jul 2002 20:53:03 +0000 (20:53 +0000)
* tests/subdir7.test: New file.
* tests/Makefile.am (TESTS): Add subdir7.test.

ChangeLog
automake.in
tests/Makefile.am
tests/Makefile.in
tests/subdir7.test [new file with mode: 0755]

index 691b6afa39169bf8ad9b5dc030a83fa55e9b25d1..0fd6cddedb103ce2ceb2d0e167d098ddf2be61fd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2002-07-22  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
+       * automake.in (handle_subdirs): Warn if `obj' appears in SUBDIRS.
+       * tests/subdir7.test: New file.
+       * tests/Makefile.am (TESTS): Add subdir7.test.
+
        * lib/mkinstalldirs: Remove Id keyword.
 
        * lib/am/progs.am (installcheck-%DIR%PROGRAMS): Honor
index b3ac32bbdca83b0085ba7d3967cf0964314d2afb..2fee6e38ec21341ce1ca2dc5e38029edaa0a3d9e 100755 (executable)
@@ -4054,8 +4054,36 @@ sub handle_subdirs
     return
       unless variable_defined ('SUBDIRS');
 
+    my @subdirs = &variable_value_as_list_recursive ('SUBDIRS', 'all');
+    my @dsubdirs = ();
+    @dsubdirs = &variable_value_as_list_recursive ('DIST_SUBDIRS', 'all')
+      if variable_defined ('DIST_SUBDIRS');
+
+    # If an `obj/' directory exists, BSD make will enter it before
+    # reading `Makefile'.  Hence the `Makefile' in the current directory
+    # will not be read.
+    #
+    #  % cat Makefile
+    #  all:
+    #          echo Hello
+    #  % cat obj/Makefile
+    #  all:
+    #          echo World
+    #  % make      # GNU make
+    #  echo Hello
+    #  Hello
+    #  % pmake     # BSD make
+    #  echo World
+    #  World
+    msg_var ('portability', 'SUBDIRS',
+            "naming a subdirectory `obj' causes troubles with BSD make")
+      if grep ($_ eq 'obj', @subdirs);
+    msg_var ('portability', 'DIST_SUBDIRS',
+            "naming a subdirectory `obj' causes troubles with BSD make")
+      if grep ($_ eq 'obj', @dsubdirs);
+
     # Make sure each directory mentioned in SUBDIRS actually exists.
-    foreach my $dir (&variable_value_as_list_recursive ('SUBDIRS', 'all'))
+    foreach my $dir (@subdirs)
     {
        # Skip directories substituted by configure.
        next if $dir =~ /^\@.*\@$/;
index 23bfee93d764c5c84be71f96ea4f3d8a8029270c..61b246622db65cad72cafec3817f21f1f799e288 100644 (file)
@@ -337,6 +337,7 @@ subdir3.test \
 subdir4.test \
 subdir5.test \
 subdir6.test \
+subdir7.test \
 subdirbuiltsources.test \
 subdircond.test \
 subobj.test \
index 27e0d978ad4335894eeb913e0b67454eff5f0eb6..3d6abff4ebd97e88838292106ad3783a76514aaf 100644 (file)
@@ -425,6 +425,7 @@ subdir3.test \
 subdir4.test \
 subdir5.test \
 subdir6.test \
+subdir7.test \
 subdirbuiltsources.test \
 subdircond.test \
 subobj.test \
diff --git a/tests/subdir7.test b/tests/subdir7.test
new file mode 100755 (executable)
index 0000000..99c197f
--- /dev/null
@@ -0,0 +1,32 @@
+#! /bin/sh
+
+# Naming a subdirectory `obj/' is a bad idea.  Automake should say so.
+
+. $srcdir/defs || exit 1
+
+set -e
+
+mkdir obj
+
+cat >>configure.in << 'END'
+AC_CONFIG_FILES(obj/Makefile)
+AC_OUTPUT
+END
+
+: > obj/Makefile.am
+echo 'SUBDIRS = obj' >Makefile.am
+
+$ACLOCAL
+
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'obj.*BSD' stderr
+
+cat >Makefile.am <<EOF
+SUBDIRS = @STH@
+DIST_SUBDIRS = obj
+EOF
+
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'obj.*BSD' stderr