Internal rules for the make program

The internal rules for the make command are located in a file that looks like a description file.

When the -r flag is specified, the make command does not use the internal rules file. You must supply the rules to create the files in your description file. The internal-rules file contains a list of file-name suffixes (such as .o or .a) that the make command understands, and rules that inform the make command how to create a file with one suffix from a file with another suffix. If you do not change the list, the make command understands the following suffixes:

Suffix Description
.a Archive library
.C C++ source file
.C\~ Source Code Control System (SCCS) file containing C++ source file
.c C source file
.c~ SCCS file containing C source file
.f FORTRAN source file
.f~ SCCS file containing FORTRAN source file
.h C language header file.
.h~ SCCS file containing C language header file
.l lex source grammar
.l~ SCCS file containing lex source grammar.
.o Object file.
.s Assembler source file.
.s~ SCCS file containing assembler source file.
.sh Shell-command source file.
.sh~ SCCS file containing shell-command source file.
.y yacc-c source grammar.
.y~ SCCS file containing yacc-c source grammar.

The list of suffixes is similar to a dependency list in a description file and follows the fake target name of .SUFFIXES. Because the make command looks at the suffixes list in left-to-right order, the order of the entries is important.

The make command uses the first entry in the list that satisfies the following equirements:

  • The entry matches input and output suffix requirements for the current target and dependency files.
  • The entry has a rule assigned to it.

The make command creates the name of the rule from the two suffixes of the files that the rule defines. For example, the name of the rule to transform a .c file to an .o file is .c.o.

To add more suffixes to the list, add an entry for the fake target name of .SUFFIXES in the description file. For a .SUFFIXES line without any suffixes following the target name in the description file, the make command erases the current list. To change the order of the names in the list, erase the current list and then assign a new set of values to .SUFFIXES.