make: Implicit Rules

1 
1 10 Using Implicit Rules
1 ***********************
1 
1 Certain standard ways of remaking target files are used very often.  For
1 example, one customary way to make an object file is from a C source
1 file using the C compiler, 'cc'.
1 
1    "Implicit rules" tell 'make' how to use customary techniques so that
1 you do not have to specify them in detail when you want to use them.
1 For example, there is an implicit rule for C compilation.  File names
1 determine which implicit rules are run.  For example, C compilation
1 typically takes a '.c' file and makes a '.o' file.  So 'make' applies
1 the implicit rule for C compilation when it sees this combination of
1 file name endings.
1 
1    A chain of implicit rules can apply in sequence; for example, 'make'
1 will remake a '.o' file from a '.y' file by way of a '.c' file.
1 
1    The built-in implicit rules use several variables in their recipes so
1 that, by changing the values of the variables, you can change the way
1 the implicit rule works.  For example, the variable 'CFLAGS' controls
1 the flags given to the C compiler by the implicit rule for C
1 compilation.
1 
1    You can define your own implicit rules by writing "pattern rules".
1 
1    "Suffix rules" are a more limited way to define implicit rules.
1 Pattern rules are more general and clearer, but suffix rules are
1 retained for compatibility.
1 

Menu