From: Alexandre Duret-Lutz Date: Mon, 22 Jul 2002 20:53:03 +0000 (+0000) Subject: * automake.in (handle_subdirs): Warn if `obj' appears in SUBDIRS. X-Git-Tag: Release-1-6b~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69ebf1c1edb2ca34855f8341b82d0ef86d56a340;p=thirdparty%2Fautomake.git * automake.in (handle_subdirs): Warn if `obj' appears in SUBDIRS. * tests/subdir7.test: New file. * tests/Makefile.am (TESTS): Add subdir7.test. --- diff --git a/ChangeLog b/ChangeLog index 691b6afa3..0fd6cdded 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2002-07-22 Alexandre Duret-Lutz + * 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 diff --git a/automake.in b/automake.in index b3ac32bbd..2fee6e38e 100755 --- a/automake.in +++ b/automake.in @@ -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 =~ /^\@.*\@$/; diff --git a/tests/Makefile.am b/tests/Makefile.am index 23bfee93d..61b246622 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -337,6 +337,7 @@ subdir3.test \ subdir4.test \ subdir5.test \ subdir6.test \ +subdir7.test \ subdirbuiltsources.test \ subdircond.test \ subobj.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 27e0d978a..3d6abff4e 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 000000000..99c197f45 --- /dev/null +++ b/tests/subdir7.test @@ -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 <stderr && exit 1 +cat stderr +grep 'obj.*BSD' stderr