A community's cleaning rule is designed to remove the intermediate files and thereby to isolate the source and result files. A universal cleaning rule attempts to recognize the intermediate files according to the community's naming conventions. Unfortunately, such a rule cannot possibly anticipate all names the author may choose for his intermediate files. Consequently, our laboratory does not supply a fixed, universal clean rule, but a jclean (Jon's clean) rule. jclean removes the files that adhere to our laboratory's naming convention for intermediate files. Every author is responsible to implement his own clean rule. Most authors at our laboratory accept the default cleaning rule by defining clean as:
clean: jclean
Some authors at our laboratory append the default jclean with a command to remove some additional files that do not adhere to the standard naming conventions. Only very few authors ignore the jclean target (and its communal wisdom) and design their own rule.
Since the author of the Frog example adheres strictly to the ReDoc naming conventions for files, the default jclean mechanism suffices to remove the intermediate files:
jclean : klean.usual klean.fort ;
KLEANUSUAL := core a.out paper.log *.o *.x *.H *.ps *.gif
klean.usual :
@-${TOUCH} ${KLEANUSUAL} junk.quiet
@-${RM} ${KLEANUSUAL} junk.*
FORT_FILES = $(patsubst %.f,%,$(wildcard *.f)) junk.quiet
klean.fort:
@\
for name in ${FORT_FILES} ; do \
if ${EXIST} $${name}.r ; then \
${TOUCH} $${name}.f ; \
${RM} $${name}.f ; \
fi ; \
done
The jclean target uses two methods to identify intermediate files. The first method, klean.usual, simply removes files whose names fit one of the rule's name patterns: e.g. the executable frog.x, or the intermediate bitmap files junk.pgm and junk.ppm. The second method, klean.fort, removes FORTRAN files, such as frog.f, if RATFOR versions of the program, such as frog.r, exist.
![]() |
We are currently collaborating with Richard Stallman of the Free Software Foundation to develop an alternative, more reliable cleaning mechanism. This alternative mechanism would free the author from naming the intermediate files according to the community's naming conventions. The anticipated cleaning mechanism analyses the makefile's rules and dependencies to identify the intermediate files. Fastidious authors would have the option of automatically removing all files that are neither source files nor result files.