I have a makefile that works with pmake, but not GNU make. I am just moving it from a trivial makefile to a bit more complex, the issue cropped up with making the src and include directores.
I can't use GNU make specific syntax, it needs to be portable.
The issue is that .c.o is never dealt with, so the .c files are never compiled to .o.
gcc -o hello main.o display.o
/usr/bin/ld: cannot find main.o: No such file or directory
/usr/bin/ld: cannot find display.o: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [makefile4:13: hello] Error 1
The makefile looks like this:
.SUFFIXES:
OBJECTS=main.o display.o
BINARY=hello
CC=gcc
CFLAGS_ALL=$(CFLAGS) -Iinclude -std=c17 -Wall -Wextra -Wpedantic
.PHONY: all
all: $(BINARY)
hello: $(OBJECTS)
$(CC) -o $(BINARY) $(OBJECTS) $(LDFLAGS) $(LIBRARIES)
main.o: src/main.c include/display.h
display.o: src/display.c include/display.h
.SUFFIXES: .o .c
.c.o:
$(CC) $(CFLAGS_ALL) -o $# -c $<
.PHONY: clean
clean:
rm -rf $(OBJECTS) $(BINARY) $(DOCS)
Any thoughts on the syntax that will convince GNU make to work, while still having pmake work?
The output with -d is:
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'makefile4'...
Updating makefiles....
Considering target file 'makefile4'.
Looking for an implicit rule for 'makefile4'.
Trying pattern rule with stem 'makefile4'.
Trying implicit prerequisite 'makefile4.o'.
Trying pattern rule with stem 'makefile4'.
Trying implicit prerequisite 'makefile4.c'.
Trying pattern rule with stem 'makefile4'.
Trying implicit prerequisite 'makefile4,v'.
Trying pattern rule with stem 'makefile4'.
Trying implicit prerequisite 'RCS/makefile4,v'.
Trying pattern rule with stem 'makefile4'.
Trying implicit prerequisite 'RCS/makefile4'.
Trying pattern rule with stem 'makefile4'.
Trying implicit prerequisite 's.makefile4'.
Trying pattern rule with stem 'makefile4'.
Trying implicit prerequisite 'SCCS/s.makefile4'.
Trying pattern rule with stem 'makefile4'.
Trying implicit prerequisite 'makefile4.o'.
Looking for a rule with intermediate file 'makefile4.o'.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'makefile4'.
Trying implicit prerequisite 'makefile4.c'.
Trying pattern rule with stem 'makefile4.o'.
Trying implicit prerequisite 'makefile4.o,v'.
Trying pattern rule with stem 'makefile4.o'.
Trying implicit prerequisite 'RCS/makefile4.o,v'.
Trying pattern rule with stem 'makefile4.o'.
Trying implicit prerequisite 'RCS/makefile4.o'.
Trying pattern rule with stem 'makefile4.o'.
Trying implicit prerequisite 's.makefile4.o'.
Trying pattern rule with stem 'makefile4.o'.
Trying implicit prerequisite 'SCCS/s.makefile4.o'.
Trying pattern rule with stem 'makefile4'.
Trying implicit prerequisite 'makefile4.c'.
Looking for a rule with intermediate file 'makefile4.c'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'makefile4'.
Trying implicit prerequisite 'makefile4.w'.
Trying pattern rule with stem 'makefile4.c'.
Trying implicit prerequisite 'makefile4.c,v'.
Trying pattern rule with stem 'makefile4.c'.
Trying implicit prerequisite 'RCS/makefile4.c,v'.
Trying pattern rule with stem 'makefile4.c'.
Trying implicit prerequisite 'RCS/makefile4.c'.
Trying pattern rule with stem 'makefile4.c'.
Trying implicit prerequisite 's.makefile4.c'.
Trying pattern rule with stem 'makefile4.c'.
Trying implicit prerequisite 'SCCS/s.makefile4.c'.
Trying pattern rule with stem 'makefile4'.
Trying implicit prerequisite 'makefile4.w'.
Looking for a rule with intermediate file 'makefile4.w'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'makefile4.w'.
Trying implicit prerequisite 'makefile4.w,v'.
Trying pattern rule with stem 'makefile4.w'.
Trying implicit prerequisite 'RCS/makefile4.w,v'.
Trying pattern rule with stem 'makefile4.w'.
Trying implicit prerequisite 'RCS/makefile4.w'.
Trying pattern rule with stem 'makefile4.w'.
Trying implicit prerequisite 's.makefile4.w'.
Trying pattern rule with stem 'makefile4.w'.
Trying implicit prerequisite 'SCCS/s.makefile4.w'.
Trying pattern rule with stem 'makefile4'.
Rejecting impossible implicit prerequisite 'makefile4.c'.
No implicit rule found for 'makefile4'.
Finished prerequisites of target file 'makefile4'.
No need to remake target 'makefile4'.
Updating goal targets....
Considering target file 'all'.
File 'all' does not exist.
Considering target file 'hello'.
File 'hello' does not exist.
Considering target file 'main.o'.
File 'main.o' does not exist.
Looking for an implicit rule for 'main.o'.
Trying pattern rule with stem 'main'.
Trying implicit prerequisite 'main.c'.
Trying pattern rule with stem 'main.o'.
Trying implicit prerequisite 'main.o,v'.
Trying pattern rule with stem 'main.o'.
Trying implicit prerequisite 'RCS/main.o,v'.
Trying pattern rule with stem 'main.o'.
Trying implicit prerequisite 'RCS/main.o'.
Trying pattern rule with stem 'main.o'.
Trying implicit prerequisite 's.main.o'.
Trying pattern rule with stem 'main.o'.
Trying implicit prerequisite 'SCCS/s.main.o'.
Trying pattern rule with stem 'main'.
Trying implicit prerequisite 'main.c'.
Looking for a rule with intermediate file 'main.c'.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'main'.
Trying implicit prerequisite 'main.w'.
Trying pattern rule with stem 'main.c'.
Trying implicit prerequisite 'main.c,v'.
Trying pattern rule with stem 'main.c'.
Trying implicit prerequisite 'RCS/main.c,v'.
Trying pattern rule with stem 'main.c'.
Trying implicit prerequisite 'RCS/main.c'.
Trying pattern rule with stem 'main.c'.
Trying implicit prerequisite 's.main.c'.
Trying pattern rule with stem 'main.c'.
Trying implicit prerequisite 'SCCS/s.main.c'.
Trying pattern rule with stem 'main'.
Trying implicit prerequisite 'main.w'.
Looking for a rule with intermediate file 'main.w'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'main.w'.
Trying implicit prerequisite 'main.w,v'.
Trying pattern rule with stem 'main.w'.
Trying implicit prerequisite 'RCS/main.w,v'.
Trying pattern rule with stem 'main.w'.
Trying implicit prerequisite 'RCS/main.w'.
Trying pattern rule with stem 'main.w'.
Trying implicit prerequisite 's.main.w'.
Trying pattern rule with stem 'main.w'.
Trying implicit prerequisite 'SCCS/s.main.w'.
No implicit rule found for 'main.o'.
Considering target file 'src/main.c'.
Looking for an implicit rule for 'src/main.c'.
Trying pattern rule with stem 'main'.
Trying implicit prerequisite 'src/main.w'.
Trying pattern rule with stem 'main.c'.
Trying implicit prerequisite 'src/main.c,v'.
Trying pattern rule with stem 'main.c'.
Trying implicit prerequisite 'src/RCS/main.c,v'.
Trying pattern rule with stem 'main.c'.
Trying implicit prerequisite 'src/RCS/main.c'.
Trying pattern rule with stem 'main.c'.
Trying implicit prerequisite 'src/s.main.c'.
Trying pattern rule with stem 'main.c'.
Trying implicit prerequisite 'src/SCCS/s.main.c'.
Trying pattern rule with stem 'main'.
Trying implicit prerequisite 'src/main.w'.
Looking for a rule with intermediate file 'src/main.w'.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'main.w'.
Trying implicit prerequisite 'src/main.w,v'.
Trying pattern rule with stem 'main.w'.
Trying implicit prerequisite 'src/RCS/main.w,v'.
Trying pattern rule with stem 'main.w'.
Trying implicit prerequisite 'src/RCS/main.w'.
Trying pattern rule with stem 'main.w'.
Trying implicit prerequisite 'src/s.main.w'.
Trying pattern rule with stem 'main.w'.
Trying implicit prerequisite 'src/SCCS/s.main.w'.
No implicit rule found for 'src/main.c'.
Finished prerequisites of target file 'src/main.c'.
No need to remake target 'src/main.c'.
Considering target file 'include/display.h'.
Looking for an implicit rule for 'include/display.h'.
Trying pattern rule with stem 'display.h'.
Trying implicit prerequisite 'include/display.h.o'.
Trying pattern rule with stem 'display.h'.
Trying implicit prerequisite 'include/display.h.c'.
Trying pattern rule with stem 'display.h'.
Trying implicit prerequisite 'include/display.h,v'.
Trying pattern rule with stem 'display.h'.
Trying implicit prerequisite 'include/RCS/display.h,v'.
Trying pattern rule with stem 'display.h'.
Trying implicit prerequisite 'include/RCS/display.h'.
Trying pattern rule with stem 'display.h'.
Trying implicit prerequisite 'include/s.display.h'.
Trying pattern rule with stem 'display.h'.
Trying implicit prerequisite 'include/SCCS/s.display.h'.
Trying pattern rule with stem 'display.h'.
Trying implicit prerequisite 'include/display.h.o'.
Looking for a rule with intermediate file 'include/display.h.o'.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'display.h'.
Trying implicit prerequisite 'include/display.h.c'.
Trying pattern rule with stem 'display.h.o'.
Trying implicit prerequisite 'include/display.h.o,v'.
Trying pattern rule with stem 'display.h.o'.
Trying implicit prerequisite 'include/RCS/display.h.o,v'.
Trying pattern rule with stem 'display.h.o'.
Trying implicit prerequisite 'include/RCS/display.h.o'.
Trying pattern rule with stem 'display.h.o'.
Trying implicit prerequisite 'include/s.display.h.o'.
Trying pattern rule with stem 'display.h.o'.
Trying implicit prerequisite 'include/SCCS/s.display.h.o'.
Trying pattern rule with stem 'display.h'.
Trying implicit prerequisite 'include/display.h.c'.
Looking for a rule with intermediate file 'include/display.h.c'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'display.h'.
Trying implicit prerequisite 'include/display.h.w'.
Trying pattern rule with stem 'display.h.c'.
Trying implicit prerequisite 'include/display.h.c,v'.
Trying pattern rule with stem 'display.h.c'.
Trying implicit prerequisite 'include/RCS/display.h.c,v'.
Trying pattern rule with stem 'display.h.c'.
Trying implicit prerequisite 'include/RCS/display.h.c'.
Trying pattern rule with stem 'display.h.c'.
Trying implicit prerequisite 'include/s.display.h.c'.
Trying pattern rule with stem 'display.h.c'.
Trying implicit prerequisite 'include/SCCS/s.display.h.c'.
Trying pattern rule with stem 'display.h'.
Trying implicit prerequisite 'include/display.h.w'.
Looking for a rule with intermediate file 'include/display.h.w'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'display.h.w'.
Trying implicit prerequisite 'include/display.h.w,v'.
Trying pattern rule with stem 'display.h.w'.
Trying implicit prerequisite 'include/RCS/display.h.w,v'.
Trying pattern rule with stem 'display.h.w'.
Trying implicit prerequisite 'include/RCS/display.h.w'.
Trying pattern rule with stem 'display.h.w'.
Trying implicit prerequisite 'include/s.display.h.w'.
Trying pattern rule with stem 'display.h.w'.
Trying implicit prerequisite 'include/SCCS/s.display.h.w'.
Trying pattern rule with stem 'display.h'.
Rejecting impossible implicit prerequisite 'include/display.h.c'.
No implicit rule found for 'include/display.h'.
Finished prerequisites of target file 'include/display.h'.
No need to remake target 'include/display.h'.
Finished prerequisites of target file 'main.o'.
Must remake target 'main.o'.
Successfully remade target file 'main.o'.
Considering target file 'display.o'.
File 'display.o' does not exist.
Looking for an implicit rule for 'display.o'.
Trying pattern rule with stem 'display'.
Trying implicit prerequisite 'display.c'.
Trying pattern rule with stem 'display.o'.
Trying implicit prerequisite 'display.o,v'.
Trying pattern rule with stem 'display.o'.
Trying implicit prerequisite 'RCS/display.o,v'.
Trying pattern rule with stem 'display.o'.
Trying implicit prerequisite 'RCS/display.o'.
Trying pattern rule with stem 'display.o'.
Trying implicit prerequisite 's.display.o'.
Trying pattern rule with stem 'display.o'.
Trying implicit prerequisite 'SCCS/s.display.o'.
Trying pattern rule with stem 'display'.
Trying implicit prerequisite 'display.c'.
Looking for a rule with intermediate file 'display.c'.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'display'.
Trying implicit prerequisite 'display.w'.
Trying pattern rule with stem 'display.c'.
Trying implicit prerequisite 'display.c,v'.
Trying pattern rule with stem 'display.c'.
Trying implicit prerequisite 'RCS/display.c,v'.
Trying pattern rule with stem 'display.c'.
Trying implicit prerequisite 'RCS/display.c'.
Trying pattern rule with stem 'display.c'.
Trying implicit prerequisite 's.display.c'.
Trying pattern rule with stem 'display.c'.
Trying implicit prerequisite 'SCCS/s.display.c'.
Trying pattern rule with stem 'display'.
Trying implicit prerequisite 'display.w'.
Looking for a rule with intermediate file 'display.w'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'display.w'.
Trying implicit prerequisite 'display.w,v'.
Trying pattern rule with stem 'display.w'.
Trying implicit prerequisite 'RCS/display.w,v'.
Trying pattern rule with stem 'display.w'.
Trying implicit prerequisite 'RCS/display.w'.
Trying pattern rule with stem 'display.w'.
Trying implicit prerequisite 's.display.w'.
Trying pattern rule with stem 'display.w'.
Trying implicit prerequisite 'SCCS/s.display.w'.
No implicit rule found for 'display.o'.
Considering target file 'src/display.c'.
Looking for an implicit rule for 'src/display.c'.
Trying pattern rule with stem 'display'.
Trying implicit prerequisite 'src/display.w'.
Trying pattern rule with stem 'display.c'.
Trying implicit prerequisite 'src/display.c,v'.
Trying pattern rule with stem 'display.c'.
Trying implicit prerequisite 'src/RCS/display.c,v'.
Trying pattern rule with stem 'display.c'.
Trying implicit prerequisite 'src/RCS/display.c'.
Trying pattern rule with stem 'display.c'.
Trying implicit prerequisite 'src/s.display.c'.
Trying pattern rule with stem 'display.c'.
Trying implicit prerequisite 'src/SCCS/s.display.c'.
Trying pattern rule with stem 'display'.
Trying implicit prerequisite 'src/display.w'.
Looking for a rule with intermediate file 'src/display.w'.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'display.w'.
Trying implicit prerequisite 'src/display.w,v'.
Trying pattern rule with stem 'display.w'.
Trying implicit prerequisite 'src/RCS/display.w,v'.
Trying pattern rule with stem 'display.w'.
Trying implicit prerequisite 'src/RCS/display.w'.
Trying pattern rule with stem 'display.w'.
Trying implicit prerequisite 'src/s.display.w'.
Trying pattern rule with stem 'display.w'.
Trying implicit prerequisite 'src/SCCS/s.display.w'.
No implicit rule found for 'src/display.c'.
Finished prerequisites of target file 'src/display.c'.
No need to remake target 'src/display.c'.
Pruning file 'include/display.h'.
Finished prerequisites of target file 'display.o'.
Must remake target 'display.o'.
Successfully remade target file 'display.o'.
Finished prerequisites of target file 'hello'.
Must remake target 'hello'.
gcc -o hello main.o display.o
Putting child 0x55f5c3999ea0 (hello) PID 167980 on the chain.
Live child 0x55f5c3999ea0 (hello) PID 167980
/usr/bin/ld: cannot find main.o: No such file or directory
/usr/bin/ld: cannot find display.o: No such file or directory
collect2: error: ld returned 1 exit status
Reaping losing child 0x55f5c3999ea0 PID 167980
make: *** [makefile4:15: hello] Error 1
Removing child 0x55f5c3999ea0 PID 167980 from chain.
My unhappy solution is:
OBJECTS=$(SRC)/main.o $(SRC)/display.o
Related
I'm trying to use the following Makefile to create the target foo.a with foo.foo.b as a prerequisite, using the stem character (%) as shown.
%.a: %.%.b
touch $#
However running touch foo.foo.b; make foo.a doesn't work with No rule to make target. The debug output below shows that the stem % is only expanded once. How to get the desired behavior of replacing all % in the prerequisite?
Considering target file 'sdf.a'.
File 'sdf.a' does not exist.
Looking for an implicit rule for 'sdf.a'.
Trying implicit prerequisite 'sdf.%.b'.
Looking for a rule with intermediate file 'sdf.%.b'.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'sdf.%.b'.
Trying implicit prerequisite 'sdf.%.b,v'.
(..)
No implicit rule found for 'sdf.a'.
Finished prerequisites of target file 'sdf.a'.
Must remake target 'sdf.a'.
make: *** No rule to make target 'sdf.a'. Stop.
Side note: this seems like a trivial question but for some reason I can't find the answer, maybe I'm using the wrong search terms or overlooking something simple, sorry if that is the case.
The stem is only replaced once. If you wish to have stem contents inserted more than once, you would need to use secondary expansion, i.e.:
$ cat Makefile
.SECONDEXPANSION:
%.a: $$*.$$*.b
echo Making $# from $<
Output:
$ touch foo.foo.b
$ make -s foo.a
Making foo.a from foo.foo.b
Consider the following makefile (and any hi.c):
.PHONY: analyze-%
hi: hi.c
gcc -o $# $<
%.json: %
touch $# # actually created by analysis-tool
analyze-%: %.json # why does this not work?
As my comment in the makefile points out, the implicit rule does not work:
$ make analyze-hi
make: *** No rule to make target 'analyze-hi'. Stop.
It only works after transforming it into a static pattern rule:
...
analyze-hi: analyze-%: %.json
Why is this the case? Shouldn't make be able to figure this out on its own, without me having to explicitly write the full target name? There is no ambiguity or anything (as far as I'm aware).
Pattern rules must have recipes. If they don't have a recipe then they're not creating a pattern rule, they're canceling one.
See https://www.gnu.org/software/make/manual/html_node/Canceling-Rules.html
A static pattern rule, contrary to what's implied by its name, is not actually creating an implicit rule (pattern or suffix rule). It's creating explicit rules, just based on a pattern. Explicit rules don't have to have recipes.
So, I have a Makefile with 2 pattern rules, one of them is a terminal Match-Anything; the target is about.html (for example):
vpath %.md $(SOURCE_DIR)
HEADER := assets/navbar.part
%.html : %.md $(HEADER)
pandoc [...] $< -o $#
%::
cp $(SOURCE_DIR)/$# $#
If I execute make assets/navbar.part, and then make about.html (for example), everything works fine (navbar.part uses the match anything, and about.html uses the first rule). But if I try to make about.html without having navbar.part present, make does:
Find the prerequisite about.md
?? Gives up on fulfilling $(HEADER)
Tries to use the match anything rule to generate about.html
I was expecting that make would:
Find the prerequisite about.md
Make the prerequisite $(HEADER) using the match-anything rule
With all the prerequisites fulfilled, finally execute the first rule
From reading the debug trace, it seems like Make never really tries to fulfill the $(HEADER) prerequisite:
Considering target file 'about.html'.
File 'about.html' does not exist.
Looking for an implicit rule for 'about.html'.
Trying pattern rule with stem 'about'.
Trying implicit prerequisite 'about.md'.
Found prerequisite 'about.md' as VPATH '../website/about.md'
Trying rule prerequisite 'assets/navbar.part'.
Trying pattern rule with stem 'about.html'.
Found an implicit rule for 'about.html'.
Considering target file 'about.md'.
Finished prerequisites of target file 'about.md'.
No need to remake target 'about.md'; using VPATH name '../website/about.md'.
Finished prerequisites of target file 'about.html'.
Must remake target 'about.html'.
cp -f ../website/about.html about.html
Any ideas?
After digging the manual, I found section 10.8 that states:
For each pattern rule in the list:
Find the stem s, which is the nonempty part of t or n matched by the ‘%’ in the target pattern.
Compute the prerequisite names by substituting s for ‘%’; if the target pattern does not contain a slash, append d to the front of each prerequisite name.
Test whether all the prerequisites exist or ought to exist. (If a file name is mentioned in the makefile as a target or as an explicit prerequisite, then we say it ought to exist.)
Because the $(HEADER) does not meet the definition of ought to exist:
No file exists when the rule is tried
No rule with that explicit target exists
it fails; however, it suceeds if we try to make specifically $(HEADER), and then try to make about.html it suceeds, because by then $(HEADER) is an existing file.
From make --help Its status:
-r, --no-builtin-rules Disable the built-in implicit rules.
-R, --no-builtin-variables Disable the built-in variable settings.
when would I need to use these option? Sometime I do see people using both -rR
Disabling the built-in rules and variables is mostly for debugging purposes, although disabling the rules might improve performance in some cases.
Most "serious" makefiles out in the wild tend to declare their own rules and recipes for everything so the built-in rules are often superfluous. Disabling them may speed up execution of the makefile depending on how it's been written.
Say you have the following makefile along with a single file called foo.cpp
foo: foo.o
Make's debug dump for this is
Reading makefiles...
Reading makefile 'Makefile'...
Updating makefiles....
Considering target file 'Makefile'.
Looking for an implicit rule for 'Makefile'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.o'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.c'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.cc'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.C'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.cpp'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.p'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.f'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.F'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.m'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.r'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.s'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.S'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.mod'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.sh'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile,v'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'RCS/Makefile,v'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'RCS/Makefile'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 's.Makefile'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'SCCS/s.Makefile'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.o'.
Looking for a rule with intermediate file 'Makefile.o'.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.c'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.cc'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.C'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.cpp'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.p'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.f'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.F'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.m'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.r'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.s'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.S'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.mod'.
Trying pattern rule with stem 'Makefile.o'.
Trying implicit prerequisite 'Makefile.o,v'.
Trying pattern rule with stem 'Makefile.o'.
Trying implicit prerequisite 'RCS/Makefile.o,v'.
Trying pattern rule with stem 'Makefile.o'.
Trying implicit prerequisite 'RCS/Makefile.o'.
Trying pattern rule with stem 'Makefile.o'.
Trying implicit prerequisite 's.Makefile.o'.
Trying pattern rule with stem 'Makefile.o'.
Trying implicit prerequisite 'SCCS/s.Makefile.o'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.c'.
Looking for a rule with intermediate file 'Makefile.c'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.y'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.l'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.w'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.w'.
Trying pattern rule with stem 'Makefile.c'.
Trying implicit prerequisite 'Makefile.c,v'.
Trying pattern rule with stem 'Makefile.c'.
Trying implicit prerequisite 'RCS/Makefile.c,v'.
Trying pattern rule with stem 'Makefile.c'.
Trying implicit prerequisite 'RCS/Makefile.c'.
Trying pattern rule with stem 'Makefile.c'.
Trying implicit prerequisite 's.Makefile.c'.
Trying pattern rule with stem 'Makefile.c'.
Trying implicit prerequisite 'SCCS/s.Makefile.c'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.y'.
Looking for a rule with intermediate file 'Makefile.y'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile.y'.
Trying implicit prerequisite 'Makefile.y,v'.
Trying pattern rule with stem 'Makefile.y'.
Trying implicit prerequisite 'RCS/Makefile.y,v'.
Trying pattern rule with stem 'Makefile.y'.
Trying implicit prerequisite 'RCS/Makefile.y'.
Trying pattern rule with stem 'Makefile.y'.
Trying implicit prerequisite 's.Makefile.y'.
Trying pattern rule with stem 'Makefile.y'.
Trying implicit prerequisite 'SCCS/s.Makefile.y'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.l'.
Looking for a rule with intermediate file 'Makefile.l'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile.l'.
Trying implicit prerequisite 'Makefile.l,v'.
Trying pattern rule with stem 'Makefile.l'.
Trying implicit prerequisite 'RCS/Makefile.l,v'.
Trying pattern rule with stem 'Makefile.l'.
Trying implicit prerequisite 'RCS/Makefile.l'.
Trying pattern rule with stem 'Makefile.l'.
Trying implicit prerequisite 's.Makefile.l'.
Trying pattern rule with stem 'Makefile.l'.
Trying implicit prerequisite 'SCCS/s.Makefile.l'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.w'.
Looking for a rule with intermediate file 'Makefile.w'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile.w'.
Trying implicit prerequisite 'Makefile.w,v'.
Trying pattern rule with stem 'Makefile.w'.
Trying implicit prerequisite 'RCS/Makefile.w,v'.
Trying pattern rule with stem 'Makefile.w'.
Trying implicit prerequisite 'RCS/Makefile.w'.
Trying pattern rule with stem 'Makefile.w'.
Trying implicit prerequisite 's.Makefile.w'.
Trying pattern rule with stem 'Makefile.w'.
Trying implicit prerequisite 'SCCS/s.Makefile.w'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.w'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.cc'.
Looking for a rule with intermediate file 'Makefile.cc'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile.cc'.
Trying implicit prerequisite 'Makefile.cc,v'.
Trying pattern rule with stem 'Makefile.cc'.
Trying implicit prerequisite 'RCS/Makefile.cc,v'.
Trying pattern rule with stem 'Makefile.cc'.
Trying implicit prerequisite 'RCS/Makefile.cc'.
Trying pattern rule with stem 'Makefile.cc'.
Trying implicit prerequisite 's.Makefile.cc'.
Trying pattern rule with stem 'Makefile.cc'.
Trying implicit prerequisite 'SCCS/s.Makefile.cc'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.C'.
Looking for a rule with intermediate file 'Makefile.C'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile.C'.
Trying implicit prerequisite 'Makefile.C,v'.
Trying pattern rule with stem 'Makefile.C'.
Trying implicit prerequisite 'RCS/Makefile.C,v'.
Trying pattern rule with stem 'Makefile.C'.
Trying implicit prerequisite 'RCS/Makefile.C'.
Trying pattern rule with stem 'Makefile.C'.
Trying implicit prerequisite 's.Makefile.C'.
Trying pattern rule with stem 'Makefile.C'.
Trying implicit prerequisite 'SCCS/s.Makefile.C'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.cpp'.
Looking for a rule with intermediate file 'Makefile.cpp'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile.cpp'.
Trying implicit prerequisite 'Makefile.cpp,v'.
Trying pattern rule with stem 'Makefile.cpp'.
Trying implicit prerequisite 'RCS/Makefile.cpp,v'.
Trying pattern rule with stem 'Makefile.cpp'.
Trying implicit prerequisite 'RCS/Makefile.cpp'.
Trying pattern rule with stem 'Makefile.cpp'.
Trying implicit prerequisite 's.Makefile.cpp'.
Trying pattern rule with stem 'Makefile.cpp'.
Trying implicit prerequisite 'SCCS/s.Makefile.cpp'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.p'.
Looking for a rule with intermediate file 'Makefile.p'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.web'.
Trying pattern rule with stem 'Makefile.p'.
Trying implicit prerequisite 'Makefile.p,v'.
Trying pattern rule with stem 'Makefile.p'.
Trying implicit prerequisite 'RCS/Makefile.p,v'.
Trying pattern rule with stem 'Makefile.p'.
Trying implicit prerequisite 'RCS/Makefile.p'.
Trying pattern rule with stem 'Makefile.p'.
Trying implicit prerequisite 's.Makefile.p'.
Trying pattern rule with stem 'Makefile.p'.
Trying implicit prerequisite 'SCCS/s.Makefile.p'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.web'.
Looking for a rule with intermediate file 'Makefile.web'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile.web'.
Trying implicit prerequisite 'Makefile.web,v'.
Trying pattern rule with stem 'Makefile.web'.
Trying implicit prerequisite 'RCS/Makefile.web,v'.
Trying pattern rule with stem 'Makefile.web'.
Trying implicit prerequisite 'RCS/Makefile.web'.
Trying pattern rule with stem 'Makefile.web'.
Trying implicit prerequisite 's.Makefile.web'.
Trying pattern rule with stem 'Makefile.web'.
Trying implicit prerequisite 'SCCS/s.Makefile.web'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.f'.
Looking for a rule with intermediate file 'Makefile.f'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.F'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.r'.
Trying pattern rule with stem 'Makefile.f'.
Trying implicit prerequisite 'Makefile.f,v'.
Trying pattern rule with stem 'Makefile.f'.
Trying implicit prerequisite 'RCS/Makefile.f,v'.
Trying pattern rule with stem 'Makefile.f'.
Trying implicit prerequisite 'RCS/Makefile.f'.
Trying pattern rule with stem 'Makefile.f'.
Trying implicit prerequisite 's.Makefile.f'.
Trying pattern rule with stem 'Makefile.f'.
Trying implicit prerequisite 'SCCS/s.Makefile.f'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.F'.
Looking for a rule with intermediate file 'Makefile.F'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile.F'.
Trying implicit prerequisite 'Makefile.F,v'.
Trying pattern rule with stem 'Makefile.F'.
Trying implicit prerequisite 'RCS/Makefile.F,v'.
Trying pattern rule with stem 'Makefile.F'.
Trying implicit prerequisite 'RCS/Makefile.F'.
Trying pattern rule with stem 'Makefile.F'.
Trying implicit prerequisite 's.Makefile.F'.
Trying pattern rule with stem 'Makefile.F'.
Trying implicit prerequisite 'SCCS/s.Makefile.F'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.r'.
Looking for a rule with intermediate file 'Makefile.r'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.l'.
Trying pattern rule with stem 'Makefile.r'.
Trying implicit prerequisite 'Makefile.r,v'.
Trying pattern rule with stem 'Makefile.r'.
Trying implicit prerequisite 'RCS/Makefile.r,v'.
Trying pattern rule with stem 'Makefile.r'.
Trying implicit prerequisite 'RCS/Makefile.r'.
Trying pattern rule with stem 'Makefile.r'.
Trying implicit prerequisite 's.Makefile.r'.
Trying pattern rule with stem 'Makefile.r'.
Trying implicit prerequisite 'SCCS/s.Makefile.r'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.F'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.m'.
Looking for a rule with intermediate file 'Makefile.m'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.ym'.
Trying pattern rule with stem 'Makefile.m'.
Trying implicit prerequisite 'Makefile.m,v'.
Trying pattern rule with stem 'Makefile.m'.
Trying implicit prerequisite 'RCS/Makefile.m,v'.
Trying pattern rule with stem 'Makefile.m'.
Trying implicit prerequisite 'RCS/Makefile.m'.
Trying pattern rule with stem 'Makefile.m'.
Trying implicit prerequisite 's.Makefile.m'.
Trying pattern rule with stem 'Makefile.m'.
Trying implicit prerequisite 'SCCS/s.Makefile.m'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.ym'.
Looking for a rule with intermediate file 'Makefile.ym'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile.ym'.
Trying implicit prerequisite 'Makefile.ym,v'.
Trying pattern rule with stem 'Makefile.ym'.
Trying implicit prerequisite 'RCS/Makefile.ym,v'.
Trying pattern rule with stem 'Makefile.ym'.
Trying implicit prerequisite 'RCS/Makefile.ym'.
Trying pattern rule with stem 'Makefile.ym'.
Trying implicit prerequisite 's.Makefile.ym'.
Trying pattern rule with stem 'Makefile.ym'.
Trying implicit prerequisite 'SCCS/s.Makefile.ym'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.r'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.s'.
Looking for a rule with intermediate file 'Makefile.s'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.S'.
Trying pattern rule with stem 'Makefile.s'.
Trying implicit prerequisite 'Makefile.s,v'.
Trying pattern rule with stem 'Makefile.s'.
Trying implicit prerequisite 'RCS/Makefile.s,v'.
Trying pattern rule with stem 'Makefile.s'.
Trying implicit prerequisite 'RCS/Makefile.s'.
Trying pattern rule with stem 'Makefile.s'.
Trying implicit prerequisite 's.Makefile.s'.
Trying pattern rule with stem 'Makefile.s'.
Trying implicit prerequisite 'SCCS/s.Makefile.s'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.S'.
Looking for a rule with intermediate file 'Makefile.S'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile.S'.
Trying implicit prerequisite 'Makefile.S,v'.
Trying pattern rule with stem 'Makefile.S'.
Trying implicit prerequisite 'RCS/Makefile.S,v'.
Trying pattern rule with stem 'Makefile.S'.
Trying implicit prerequisite 'RCS/Makefile.S'.
Trying pattern rule with stem 'Makefile.S'.
Trying implicit prerequisite 's.Makefile.S'.
Trying pattern rule with stem 'Makefile.S'.
Trying implicit prerequisite 'SCCS/s.Makefile.S'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.S'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.mod'.
Looking for a rule with intermediate file 'Makefile.mod'.
Avoiding implicit rule recursion.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile.mod'.
Trying implicit prerequisite 'Makefile.mod,v'.
Trying pattern rule with stem 'Makefile.mod'.
Trying implicit prerequisite 'RCS/Makefile.mod,v'.
Trying pattern rule with stem 'Makefile.mod'.
Trying implicit prerequisite 'RCS/Makefile.mod'.
Trying pattern rule with stem 'Makefile.mod'.
Trying implicit prerequisite 's.Makefile.mod'.
Trying pattern rule with stem 'Makefile.mod'.
Trying implicit prerequisite 'SCCS/s.Makefile.mod'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.c'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.cc'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.C'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.cpp'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.p'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.f'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.F'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.m'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.r'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.s'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.S'.
Trying pattern rule with stem 'Makefile'.
Rejecting impossible implicit prerequisite 'Makefile.mod'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite 'Makefile.sh'.
Looking for a rule with intermediate file 'Makefile.sh'.
Avoiding implicit rule recursion.
Trying pattern rule with stem 'Makefile.sh'.
Trying implicit prerequisite 'Makefile.sh,v'.
Trying pattern rule with stem 'Makefile.sh'.
Trying implicit prerequisite 'RCS/Makefile.sh,v'.
Trying pattern rule with stem 'Makefile.sh'.
Trying implicit prerequisite 'RCS/Makefile.sh'.
Trying pattern rule with stem 'Makefile.sh'.
Trying implicit prerequisite 's.Makefile.sh'.
Trying pattern rule with stem 'Makefile.sh'.
Trying implicit prerequisite 'SCCS/s.Makefile.sh'.
No implicit rule found for 'Makefile'.
Finished prerequisites of target file 'Makefile'.
No need to remake target 'Makefile'.
Updating goal targets....
Considering target file 'foo'.
File 'foo' does not exist.
Looking for an implicit rule for 'foo'.
Trying pattern rule with stem 'foo'.
Trying implicit prerequisite 'foo.o'.
Found an implicit rule for 'foo'.
Considering target file 'foo.o'.
Looking for an implicit rule for 'foo.o'.
Trying pattern rule with stem 'foo'.
Trying implicit prerequisite 'foo.c'.
Trying pattern rule with stem 'foo'.
Trying implicit prerequisite 'foo.cc'.
Trying pattern rule with stem 'foo'.
Trying implicit prerequisite 'foo.C'.
Trying pattern rule with stem 'foo'.
Trying implicit prerequisite 'foo.cpp'.
Found an implicit rule for 'foo.o'.
Considering target file 'foo.cpp'.
Looking for an implicit rule for 'foo.cpp'.
Trying pattern rule with stem 'foo.cpp'.
Trying implicit prerequisite 'foo.cpp,v'.
Trying pattern rule with stem 'foo.cpp'.
Trying implicit prerequisite 'RCS/foo.cpp,v'.
Trying pattern rule with stem 'foo.cpp'.
Trying implicit prerequisite 'RCS/foo.cpp'.
Trying pattern rule with stem 'foo.cpp'.
Trying implicit prerequisite 's.foo.cpp'.
Trying pattern rule with stem 'foo.cpp'.
Trying implicit prerequisite 'SCCS/s.foo.cpp'.
No implicit rule found for 'foo.cpp'.
Finished prerequisites of target file 'foo.cpp'.
No need to remake target 'foo.cpp'.
Finished prerequisites of target file 'foo.o'.
Prerequisite 'foo.cpp' is older than target 'foo.o'.
No need to remake target 'foo.o'.
Pruning file 'foo.o'.
Finished prerequisites of target file 'foo'.
Must remake target 'foo'.
cc foo.o -o foo
Putting child 0x7fc4d94124c0 (foo) PID 1581 on the chain.
Live child 0x7fc4d94124c0 (foo) PID 1581
Reaping winning child 0x7fc4d94124c0 PID 1581
Removing child 0x7fc4d94124c0 PID 1581 from chain.
Successfully remade target file 'foo'.
Seems like a lot of work for something so trivial, although most of it is related to remaking the makefile and not the targets themselves. Still, this can all add up in a big project with lots of source files and makefiles.
Now have a look at the debug output for this file
foo: foo.o
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $#
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(OUTPUT_OPTION) $<
invoked with make -r
Reading makefiles...
Reading makefile 'Makefile'...
Updating makefiles....
Considering target file 'Makefile'.
Looking for an implicit rule for 'Makefile'.
No implicit rule found for 'Makefile'.
Finished prerequisites of target file 'Makefile'.
No need to remake target 'Makefile'.
Updating goal targets....
Considering target file 'foo'.
File 'foo' does not exist.
Considering target file 'foo.o'.
File 'foo.o' does not exist.
Looking for an implicit rule for 'foo.o'.
Trying pattern rule with stem 'foo'.
Trying implicit prerequisite 'foo.cpp'.
Found an implicit rule for 'foo.o'.
Considering target file 'foo.cpp'.
Looking for an implicit rule for 'foo.cpp'.
No implicit rule found for 'foo.cpp'.
Finished prerequisites of target file 'foo.cpp'.
No need to remake target 'foo.cpp'.
Finished prerequisites of target file 'foo.o'.
Must remake target 'foo.o'.
g++ -c -o foo.o foo.cpp
Putting child 0x7fe1c0503520 (foo.o) PID 1614 on the chain.
Live child 0x7fe1c0503520 (foo.o) PID 1614
Reaping winning child 0x7fe1c0503520 PID 1614
Removing child 0x7fe1c0503520 PID 1614 from chain.
Successfully remade target file 'foo.o'.
Finished prerequisites of target file 'foo'.
Must remake target 'foo'.
g++ foo.o -o foo
Putting child 0x7fe1c05038b0 (foo) PID 1618 on the chain.
Live child 0x7fe1c05038b0 (foo) PID 1618
Reaping winning child 0x7fe1c05038b0 PID 1618
Removing child 0x7fe1c05038b0 PID 1618 from chain.
Successfully remade target file 'foo'.
Not only do you now have complete control over the recipes, but you're also making things more efficient by specifying exactly what you need.
That said, if you find yourself cloning the built in rules exactly, you might consider instead simply disabling the rules you don't need with something like
$(MAKEFILE_LIST): ;
%.o: %.c
%.o: %.cc
%.o: %.C
%.cpp: ;
%: ;
As for the built-in variables I can't say I've found a use for -R other than debugging, keep in mind that -R already implies -r as the built-in rules are useless without the variables.
I have the following rule in my makefile:
$(TESTDIR)/%.test.out:$(TESTDIR)/%.test $(TESTDIR)/%.in
$< < $(patsubst %.out, %.in, $#) 2>&1 > $#
I expect that, when I invoke make
make testing/Candidate.test.out
(where TESTDIR=testing in the makefile), make should respond with
testing/Candidate.test < Candidate.test.in 2>&1 >Candidate.test.out
Instead, make responds with
cp testing/Candidate.test testing/Candidate.test.out
and make -d yields:
Considering target file 'testing/Candidate.test.out'.
File 'testing/Candidate.test.out' does not exist.
Looking for an implicit rule for 'testing/Candidate.test.out'.
Trying pattern rule with stem 'Candidate'.
Trying implicit prerequisite 'testing/Candidate.test'.
Trying implicit prerequisite 'testing/Candidate.in'.
Trying pattern rule with stem 'Candidate.test'.
Trying implicit prerequisite 'testing/Candidate.test'.
Found an implicit rule for 'testing/Candidate.test.out'.
Building with make -r:
make -r testing/Candidate.test.out
make: *** No rule to make target 'testing/Candidate.test.out'. Stop.
indicates that make is decidedly not recognizing my rule, but I can't see why not. Clearly make believes $(TESTDIR)=testing, based on the cp output. Clearly it also recognizes testing/Candidate.test.out as a valid target, because it attempts to build it (whereas it fails for testing/blah.test.out).
Is there something obvious I'm missing here?
One of the targets in the rule (%.in) is incorrect (should be %.test.in).