Makefile Built In Rules
Merely reprinting from http://www.mail-archive.com/bug-make@gnu.org/msg07036.html
It’s not completely true that -p
shows “the rules as if they were there”. Recall that there are two types of implicit rules in GNU make: suffix
rules and pattern rules.
If you use MAKEFLAGS+=-r
then the pattern rules will not be present in the -p
output.
However, MAKEFLAGS+=-r
is not the same as make -r
because the latter ALSO prevents suffix rules from being defined, while the former does not.
The former only applies to pattern rules.
That’s why in the makefile you need BOTH the .SUFFIXES:
special target AND the MAKEFLAGS+=-r
. Having the .SUFFIXES:
special target set to empty
ensures that no suffix rules are searched but it does NOT remove all the suffix rules from the database. So they still show up with -p
, but they
don’t have any impact on the algorithms make uses to build targets.