Chapter 5. Adding an external dependency

Suppose you change your Makefile. For example you add -O2 to the CFLAGS variable, because finally it's release time. Of course all object files have to be regenerated. The classical way to do that is

make clean

But isn't it easier to let all .o files depend on the Makefile itself? So that once you touch the makefile, all objects are immediatly out of date and thus regenerated. That's what the --extraremakedep= option is for.

Example 5-1. Adding an extra dependency to all targets

	fastdep --extraremakedep=Makefile \
			  --remakedeptarget=.depend $(SOURCES) > .depend

-include .depend

Here is a possible result

file1.o: \
	header1.h \
	header2.h \
file2.o: \
	header1.h \
	header3.h \
	header4.h \
.depend: \ \
	header1.h \
	header2.h \
	header3.h \ \
	header4.h \