[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #63821] Switch -r fails to disable default suffix rules.

From: Dmitry Goncharov
Subject: [bug #63821] Switch -r fails to disable default suffix rules.
Date: Mon, 20 Feb 2023 13:02:44 -0500 (EST)

Follow-up Comment #1, bug #63821 (project make):

Setting -r in MAKEFLAGS in makefile fails to the disable default suffix

$ ls
hello.c  makefile
$ cat makefile
.SUFFIXES: .c .o
all: hello.o
$ make-4.4
cc    -c -o hello.o hello.c
$ rm hello.o 
$ make-4.4 -r
make-4.4: *** No rule to make target 'hello.o', needed by 'all'.  Stop.

This happens, because make install default suffix rules before parsing
makefiles. Once the files are added they stay in hash table "files" and also
in suffix_file->deps. Make then creates pattern rules from them.
The patch moves setup of default suffix rules after parsing makefiles. The
patch also prepends suffix rules defined in the makefile before the default
suffix rules in suffix_file->deps in order to give user defined rules
precedence over the default rules.

This ensures that when built-in rules are disabled in the makefile, but
suffixes are added to .SUFFIXES, make exits with the 'No rule...' error
message. Just like when -r is specified on the command line.
This also relieves make from creating and then destroying file objects for
default suffix rules and keeps hash table "files" free of the related entries
when built-in rules are disabled in the makefile.


Reply to this item at:


Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]