Suffixes and transformation rules

The make program uses an internal table of rules to learn how to transform a file with one suffix into a file with another suffix. If the -r option is used on the make command line, the internal table is not used.

The list of suffixes is actually the dependency list for the name .SUFFIXES. The make program searches for a file with any of the suffixes on the list. If one is found, make transforms it into a file with another suffix. The transformation rule names are the concatenation of the before and after suffixes. Thus, the name of the rule to transform a .r file to a .o file is .r.o. If the rule is present and no explicit command sequence has been given in the user's makefiles, the command sequence for the rule .r.o is used. If a command is generated by using one of these suffixing rules, the macro $* is given the value of the stem (everything but the suffix) of the name of the file to be made, and the macro $< is the full name of the dependent line that caused the action.

The order of the suffix list is significant because the list is scanned from left to right. The first name formed that has both a file and a rule associated with it is used. If new names are to be appended, the user can add an entry for .SUFFIXES in the makefile. The dependents lines are added to the usual list. A .SUFFIXES line without any dependents deletes the current list. It is necessary to clear the current list if the order of names is to be changed.

Next topic: Implicit rules
Previous topic: Output translations

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003