summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2010-08-10 07:35:34 +0000
committerPaul Smith <psmith@gnu.org>2010-08-10 07:35:34 +0000
commit036760a9fdb11849b6a43feec7ce294e7f77db2a (patch)
tree1d4800ea686fd439fd5857e2dc18a7671b411282
parent91be5155674c296bd7ea0faa4ecdc9477eb7ea13 (diff)
downloadgunmake-036760a9fdb11849b6a43feec7ce294e7f77db2a.tar.gz
Fix Savannah bug #30723: expand MAKEFLAGS before we re-exec after
rebuilding makefiles.
-rw-r--r--ChangeLog5
-rw-r--r--main.c2
-rw-r--r--tests/ChangeLog5
-rw-r--r--tests/scripts/features/reinvoke17
4 files changed, 27 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0ae0700..fc69777 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-10 Paul Smith <psmith@gnu.org>
+
+ * main.c (main): Expand MAKEFLAGS before adding it to the
+ environment when re-exec'ing. Fixes Savannah bug #30723.
+
2010-08-07 Eli Zaretskii <eliz@gnu.org>
* w32/subproc/build.bat: Make all 3 cl.exe compile command lines
diff --git a/main.c b/main.c
index c6989e3..9fe8090 100644
--- a/main.c
+++ b/main.c
@@ -2093,7 +2093,7 @@ main (int argc, char **argv, char **envp)
const char *pv = define_makeflags (1, 1);
char *p = alloca (sizeof ("MAKEFLAGS=") + strlen (pv) + 1);
sprintf (p, "MAKEFLAGS=%s", pv);
- putenv (p);
+ putenv (allocated_variable_expand (p));
}
if (ISDB (DB_BASIC))
diff --git a/tests/ChangeLog b/tests/ChangeLog
index d036568..650d8d4 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-10 Paul Smith <psmith@gnu.org>
+
+ * scripts/features/reinvoke: Ensure command line variable settings
+ are preserved across make re-exec. Tests Savannah bug #30723.
+
2010-07-28 Paul Smith <psmith@gnu.org>
* scripts/targets/POSIX: Compatibility issues with Solaris (and
diff --git a/tests/scripts/features/reinvoke b/tests/scripts/features/reinvoke
index 9952ced..eb1a349 100644
--- a/tests/scripts/features/reinvoke
+++ b/tests/scripts/features/reinvoke
@@ -57,9 +57,24 @@ include $(F)',
# Now try with the file we're not updating being the actual file we're
# including: this and the previous one test different parts of the code.
-run_make_test(undef, "F=b", "[ -f b ] || echo >> b\nhello\n")
+run_make_test(undef, 'F=b', "[ -f b ] || echo >> b\nhello\n")
&rmfiles('a','b','c');
+# Ensure command line variables are preserved properly across re-exec
+# Tests for Savannah bug #30723
+
+run_make_test('
+ifdef RECURSE
+-include foo30723
+endif
+recurse: ; @$(MAKE) -f $(MAKEFILE_LIST) RECURSE=1 test
+test: ; @echo F.O=$(F.O)
+foo30723: ; @touch $@
+',
+ '--no-print-directory F.O=bar', "F.O=bar\n");
+
+unlink('foo30723');
+
# This tells the test driver that the perl test script executed properly.
1;