GNU Make Manual / 10.2 / Linking a single object file, mentions this:
x: y.o z.o
I have three c source files: x.c, y.c, z.c and I name x as the target on left. Can I put x.o in the prerequisites on the right too? Are they the same, with or without x.o in the prerequisites on the right?
x: y.o z.o x.o # with x.o
Is it correct for me to use patsubst function to include all object files?
x: $(patsubst %.c,%.o,$(wildcard *.c))
In my test the rule with patsubst works on most cases. But if my code uses C++20 modules, I need to omit x.o if I want to omit the recipe:
x: y.o z.o # without x.o and recipe
if I include x.o, I can't omit the recipe:
` x: y.o z.o x.o ` # with x.o
` $ (CXX) $ (LDFLAGS) $^ $(LDLIBS) -o $@ ` # with recipe