summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-01-08 16:40:55 -0500
committerPaul Smith <psmith@gnu.org>2023-01-08 16:40:55 -0500
commita275f4e9ab14a2ff827b67b46dd3bc746cdba328 (patch)
treec3b0ad2b7de5e6548197aa3b580f94796e71871a /tests
parent11444fb001cf57f32fb5022cd934c3cf489e66b2 (diff)
downloadmake-git-a275f4e9ab14a2ff827b67b46dd3bc746cdba328.tar.gz
[SV 61218] Ensure MAKEFLAGS is expanded even with -e
If -e was given we weren't expanding MAKEFLAGS before passing it through the environment to jobs: we don't expand variables we receive from the environment and when -e is given we set the origin of MAKEFLAGS to "environment override". Check for MAKEFLAGS specifically, which seems like a hack but I don't have a better idea offhand. * src/main.c (main): Drive-by: use o_default for MAKEOVERRIDES. * src/variable.c (target_environment): Always expand MAKEFLAGS regardless of the origin type. * tests/scripts/options/dash-e: Create a test.
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/options/dash-e15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/scripts/options/dash-e b/tests/scripts/options/dash-e
index 944c39df..e4659fb2 100644
--- a/tests/scripts/options/dash-e
+++ b/tests/scripts/options/dash-e
@@ -1,8 +1,6 @@
# -*-perl-*-
-$description = "The following test creates a makefile to ...";
-
-$details = "";
+$description = "Test the -e (environment overrides) option";
$ENV{GOOGLE} = 'boggle';
@@ -12,4 +10,15 @@ all:; @echo "$(GOOGLE)"
!,
'-e', "boggle\n");
+# Ensure variables set on the command line have the origin correct
+# See SV 61218
+
+run_make_test(q!
+$(info FOO [$(origin FOO)]: $(value FOO))
+all: ;
+recurse: ; @$(MAKE) -f #MAKEFILE#
+!,
+ '-e --no-print-directory FOO=1 recurse',
+ "FOO [command line]: 1\nFOO [command line]: 1\n#MAKE#[1]: 'all' is up to date.");
+
1;