diff options
Diffstat (limited to 'make.texinfo')
-rw-r--r-- | make.texinfo | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/make.texinfo b/make.texinfo index 1958134..3c7e4d3 100644 --- a/make.texinfo +++ b/make.texinfo @@ -5746,8 +5746,10 @@ The @code{shell} function performs the same function that backquotes (@samp{`}) perform in most shells: it does @dfn{command expansion}. This means that it takes an argument that is a shell command and returns the output of the command. The only processing @code{make} does on the result, -before substituting it into the surrounding text, is to convert newlines to -spaces.@refill +before substituting it into the surrounding text, is to convert each +newline or carriage-return / newline pair to a single space. It also +removes the trailing (carriage-return and) newline, if it's the last +thing in the result.@refill The commands run by calls to the @code{shell} function are run when the function calls are expanded. In most cases, this is when the makefile is @@ -5856,18 +5858,34 @@ You can specify a different goal or goals with arguments to @code{make}. Use the name of the goal as an argument. If you specify several goals, @code{make} processes each of them in turn, in the order you name them. -@cindex @code{MAKECMDGOALS} -@vindex MAKECMDGOALS -@code{Make} will set the special variable @code{MAKECMDGOALS} to the -list of goals you specified on the command line. If no goals were given -on the command line, this variable is empty. - Any target in the makefile may be specified as a goal (unless it starts with @samp{-} or contains an @samp{=}, in which case it will be parsed as a switch or variable definition, respectively). Even targets not in the makefile may be specified, if @code{make} can find implicit rules that say how to make them. +@cindex @code{MAKECMDGOALS} +@vindex MAKECMDGOALS +@code{Make} will set the special variable @code{MAKECMDGOALS} to the +list of goals you specified on the command line. If no goals were given +on the command line, this variable is empty. Note that this variable +should be used only in special circumstances. + +An example of appropriate use is to avoid including @file{.d} files +during @code{clean} rules (@pxref{Automatic Dependencies}), so +@code{make} won't create them only to immediately remove them +again:@refill + +@example +@group +sources = foo.c bar.c + +ifneq ($(MAKECMDGOALS),clean) +include $(sources:.c=.d) +endif +@end group +@end example + One use of specifying a goal is if you want to compile only a part of the program, or only one of several programs. Specify as a goal each file that you wish to remake. For example, consider a directory containing @@ -8797,6 +8815,12 @@ The flags given to @code{make}. You can set this in the environment or a makefile to set flags.@* @xref{Options/Recursion, ,Communicating Options to a Sub-@code{make}}. +@item MAKECMDGOALS + +The targets given to @code{make} on the command line. Setting this +variable has no effect on the operation of @code{make}.@* +@xref{Goals, ,Arguments to Specify the Goals}. + @item SUFFIXES The default list of suffixes before @code{make} reads any makefiles. |