Question Details

No question body available.

Tags

c makefile gnu-make

Answers (1)

June 7, 2026 Score: 0 Rep: 16,654 Quality: Low Completeness: 50%

%.o: %.c means "build an object file from a C file in the same directory". You need to put the directory variables as part of the pattern.

(Technically it's possible to use vpath instead, but vpath is one of those things that turned out not to be a good idea).

You might (but need not) alternatively choose to use a "static pattern rule" (patterns: patterns: files) to ensure Make is actually using the pattern rule you think it should for the particular files.

There might be other things wrong with the makefile, but this misunderstanding is the main one.