savannah bug30723: expand makeflags beforereexec
authorAnas Nashif <anas.nashif@intel.com>
Mon, 5 Nov 2012 19:20:03 +0000 (11:20 -0800)
committerAnas Nashif <anas.nashif@intel.com>
Mon, 5 Nov 2012 19:20:03 +0000 (11:20 -0800)
ChangeLog
main.c
tests/ChangeLog
tests/scripts/features/reinvoke

index d135d1cddbe57a7c1070b8e4eb59f2ac66600369..bfccc03d87113f93709538e040f80346b7f3cd97 100644 (file)
--- 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-07-28  Paul Smith  <psmith@gnu.org>
 
        Version 3.82 released.
diff --git a/main.c b/main.c
index c6989e31ffe084befd01f02da3ec7f804421682f..9fe80909493f42f8602211cd2e166f00bd2c2db2 100644 (file)
--- 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))
index d036568e10430d67427a371510abaa06f1e0912d..650d8d448958fa899ac391e7ab131452d768470c 100644 (file)
@@ -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
index 9952ced1a5a97e293b48448a03509cf7c5b3851d..eb1a34920bf0b2a7c785c0d7800b46eda7b517a7 100644 (file)
@@ -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;