One method of simplifying makefiles, while providing a consistent compilation environment, is to use the make:
include filename
This directive reads in the contents of a named makefile; if the named file is not present, make checks for a file by that name in /etc/default.
For instance, there is no need to duplicate the pattern-matching rule for processing troff sources in each makefile, when you can include its target entry, as shown below.
SOURCES= doc.ms spec.ms ... clean: $(SOURCES) include ../pm.rules.mk
Here, make reads in the contents of the ../pm.rules.mk file:
# pm.rules.mk # # Simple "include" makefile for pattern-matching # rules. %.tr: %.ms troff -t -ms $< > $@ %.nr: %.ms nroff -ms $< > $@