next up previous
Next: Using libraries Up: A simple Makefile Previous: Using patterns

Removing targets

  
Figure 11: An alternate target clean.

The most useful property of make is that we can automatically create object files and executables. Another useful property is that we can easily tell make how to clean them up. In order to do this, we need to specify an alternate target clean, as shown in Figure 11. We need not give a definition of RM, because make expands it to rm -f by default. The alternate rule may be placed anywhere, as long as it is after the rule for facfib. If we place it before facfib and we type ``make'', make picks the first target, which will be clean instead of facfib.

clean has no dependencies, so if we type ``make clean'', make executes the command at the next linegif. It is good practice to provide a target clean to clean up all generated files.



Megens SA
Thu Jun 20 11:26:28 MET DST 1996