How to trace Makefile targets for troubleshooting?

Use make -d or make –debug[=flags] options: ‘-d’ Print debugging information in addition to normal processing. The debugging information says which files are being considered for remaking, which file-times are being compared and with what results, which files actually need to be remade, which implicit rules are considered and which are applied—everything interesting about how … Read more

Function “patsubst” in Makefile

In fact all is explained in the doc: Finds whitespace-separated words in TEXT … means that one or more spaces have to separate the words. … that match PATTERN … means that it select only words that match a pattern (which can include some spaces). … and replaces them with REPLACEMENT. means that the selected … Read more

gnu make “Removing intermediate files”

Since you’re using GNU Make, you can make the following adjustment to your Makefile: .PRECIOUS: $(BUILD)/%.pp # ADD THIS LINE $(BUILD)/%.pp: %.c $(ECHO) “PreProcess $<” $(Q)$(CC) $(CFLAGS) -E -Wp,-C,-dD,-dI -o $@ $< The documentation has this to say about .PRECIOUS directives: The targets which .PRECIOUS depends on are given the following special treatment: if make … Read more