From: Dmitry Goncharov Date: Sun, 24 Apr 2022 00:46:32 +0000 (-0400) Subject: [SV 62356] If -R is set in the makefile, disable -r X-Git-Tag: 4.3.90~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f14824878d3e60c11bdbb4c192d72c97efe753bc;p=thirdparty%2Fmake.git [SV 62356] If -R is set in the makefile, disable -r If -R is given on the command line it implies -r as well; make this same assumption if -R is provided in MAKEFLAGS set in the makefile. * src/main.c (main): Check no_builtin_variables_flag after reading makefiles. * tests/scripts/options/dash-r: Add a test. --- diff --git a/src/main.c b/src/main.c index fc94b084..9053935b 100644 --- a/src/main.c +++ b/src/main.c @@ -2014,6 +2014,10 @@ main (int argc, char **argv, char **envp) make_sync.syncout = syncing; OUTPUT_SET (&make_sync); + /* If -R was given, set -r too (doesn't make sense otherwise!) */ + if (no_builtin_variables_flag) + no_builtin_rules_flag = 1; + /* If we've disabled builtin rules, get rid of them. */ if (no_builtin_rules_flag && ! old_builtin_rules_flag) { diff --git a/tests/scripts/options/dash-r b/tests/scripts/options/dash-r index 20dff099..7157f715 100644 --- a/tests/scripts/options/dash-r +++ b/tests/scripts/options/dash-r @@ -33,4 +33,12 @@ all:;$(info CC='$(CC)') !, '-s', "CC=''"); +# sv 62356. +# Setting -R in MAKEFLAGS sets -r. +run_make_test(q! +MAKEFLAGS := -R +.PHONY: hello.c +all: hello.o +!, '', "#MAKE#: *** No rule to make target 'hello.o', needed by 'all'. Stop.", 512); + 1;