]> git.ipfire.org Git - thirdparty/make.git/commitdiff
[SV 62356] If -R is set in the makefile, disable -r
authorDmitry Goncharov <dgoncharov@users.sf.net>
Sun, 24 Apr 2022 00:46:32 +0000 (20:46 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 24 Apr 2022 14:39:32 +0000 (10:39 -0400)
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.

src/main.c
tests/scripts/options/dash-r

index fc94b084601a3049d55cbf2816578a8af0364373..9053935bc668e919e18ffad337165391aff4fdcd 100644 (file)
@@ -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)
       {
index 20dff09941f4a6831880b73144b27fc86a02d044..7157f7157686ad0fad91b4651512e2e481ccc675 100644 (file)
@@ -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;