[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Don't let an envvar setting of "$fail" cause build failure.
From: |
Ralf Wildenhues |
Subject: |
Re: [PATCH] Don't let an envvar setting of "$fail" cause build failure. |
Date: |
Sat, 31 Oct 2009 17:52:51 +0100 |
User-agent: |
Mutt/1.5.20 (2009-08-09) |
Hi Jim,
* Jim Meyering wrote on Fri, Oct 30, 2009 at 12:15:45PM CET:
> While fixing similar problems in coreutils' test suite, I found
> that with an automake-generated Makefile, "make" always fails
> when I set e.g, fail=1 in the environment.
Thanks for the report and patch. I'm adding a tests and committing the
following to maint, intended for master and branch-1.11.
Cheers,
Ralf
2009-10-31 Jim Meyering <address@hidden>
Ralf Wildenhues <address@hidden>
Don't let an envvar setting of "$fail" cause build failure.
Without this change, in a project using an automake-generated
Makefile, "make fail=anything" would fail inappropriately,
due to the `test -z "$$fail"' at the end of this emitted rule:
* lib/am/subdirs.am ($(RECURSIVE_TARGETS)): Initialize "fail=" to keep
an envvar setting of that variable from causing unwarranted failure.
($(RECURSIVE_CLEAN_TARGETS)): Likewise.
* tests/subdir10.test: New test.
* tests/Makefile.am: Update.
diff --git a/lib/am/subdirs.am b/lib/am/subdirs.am
index b86e674..9c01a8c 100644
--- a/lib/am/subdirs.am
+++ b/lib/am/subdirs.am
@@ -36,7 +36,7 @@ AM_RECURSIVE_TARGETS += $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_TARGETS):
## Using $failcom allows "-k" to keep its natural meaning when running a
## recursive rule.
- @failcom='exit 1'; \
+ @fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
@@ -75,7 +75,7 @@ maintainer-clean: maintainer-clean-recursive
$(RECURSIVE_CLEAN_TARGETS):
## Using $failcom allows "-k" to keep its natural meaning when running a
## recursive rule.
- @failcom='exit 1'; \
+ @fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 98829c9..2c2e89a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -617,6 +617,7 @@ subdir6.test \
subdir7.test \
subdir8.test \
subdir9.test \
+subdir10.test \
subdirbuiltsources.test \
subcond.test \
subcond2.test \
diff --git a/tests/subdir10.test b/tests/subdir10.test
new file mode 100755
index 0000000..c71216b
--- /dev/null
+++ b/tests/subdir10.test
@@ -0,0 +1,39 @@
+#! /bin/sh
+# Copyright (C) 2009 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# SUDBIRS with $fail set in the environment.
+
+. ./defs || Exit 1
+
+set -e
+
+mkdir sub
+
+cat >> configure.in <<'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+echo SUBDIRS = sub >Makefile.am
+: > sub/Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+env fail=1 $MAKE all clean
+
+Exit 0