Scripsit Paul D. Smith > Anyway, you can easily split the current MAKE_VERSION already, like this: > > $(subst ., ,$(MAKE_VERSION))
Oops. Major communications foul-up detected. Backtrack to my original request and change it to: The existence of $(MAKE_VERSION) should be better documented. I needed it, and did not find it when I searched for "version" in the manual's index or followed crossreferences from node "Values". A patch that does this is attached. -- Henning Makholm "... det kan ikke blive fortalt med hans egne ord, for efter den 11. september glemte han at føre dagbog i lang tid."
--- make-3.80.orig/doc/make.texi Wed Sep 18 22:51:58 2002 +++ make-3.80/doc/make.texi Wed Oct 30 21:54:06 2002 @@ -156,7 +156,6 @@ * Include:: How one makefile can use another makefile. * MAKEFILES Variable:: The environment can specify extra makefiles. * MAKEFILE_LIST Variable:: Discover which makefiles have been read. -* Special Variables:: Other special variables. * Remaking Makefiles:: How makefiles get remade. * Overriding Makefiles:: How to override part of one makefile with another makefile. @@ -247,6 +246,7 @@ basis. * Pattern-specific:: Target-specific variable values can be applied to a group of targets that match a pattern. +* Specials:: Miscellaneous variables with special values. Advanced Features for Reference to Variables @@ -949,7 +949,6 @@ * Include:: How one makefile can use another makefile. * MAKEFILES Variable:: The environment can specify extra makefiles. * MAKEFILE_LIST Variable:: Discover which makefiles have been read. -* Special Variables:: Other special variables. * Remaking Makefiles:: How makefiles get remade. * Overriding Makefiles:: How to override part of one makefile with another makefile. @@ -1217,7 +1216,7 @@ anyone else. It is much better to write explicit @code{include} directives in the makefiles. @xref{Include, , Including Other Makefiles}. -@node MAKEFILE_LIST Variable, Special Variables, MAKEFILES Variable, Makefiles +@node MAKEFILE_LIST Variable, Remaking Makefiles, MAKEFILES Variable, Makefiles @comment node-name, next, previous, up @section The Variable @code{MAKEFILE_LIST} @cindex makefiles, and @code{MAKEFILE_LIST} variable @@ -1265,37 +1264,7 @@ Variables}, for more information on simply-expanded (@code{:=}) variable definitions. -@node Special Variables, Remaking Makefiles, MAKEFILE_LIST Variable, Makefiles -@comment node-name, next, previous, up -@section Other Special Variables -@cindex makefiles, and special variables -@cindex special variables - -GNU @code{make} also supports a special variable. Note that any value -you assign to this variable will be ignored; it will always return its -special value. - -@vindex $(.VARIABLES) -@vindex .VARIABLES @r{(list of variables)} -The first special variable is @code{.VARIABLES}. When expanded, the -value consists of a list of the @emph{names} of all global variables -defined in all makefiles read up until that point. This includes -variables which have empty values, as well as built-in variables -(@pxref{Implicit Variables, , Variables Used by Implicit Rules}), but -does not include any variables which are only defined in a -target-specific context. - -@c @vindex $(.TARGETS) -@c @vindex .TARGETS @r{(list of targets)} -@c The second special variable is @code{.TARGETS}. When expanded, the -@c value consists of a list of all targets defined in all makefiles read -@c up until that point. Note it's not enough for a file to be simply -@c mentioned in the makefile to be listed in this variable, even if it -@c would match an implicit rule and become an ``implicit target''. The -@c file must appear as a target, on the left-hand side of a ``:'', to be -@c considered a target for the purposes of this variable. - -@node Remaking Makefiles, Overriding Makefiles, Special Variables, Makefiles +@node Remaking Makefiles, Overriding Makefiles, MAKEFILE_LIST Variable, Makefiles @section How Makefiles Are Remade @cindex updating makefiles @@ -3356,6 +3325,7 @@ directory along your @code{PATH}. @cindex environment, @code{SHELL} in +@vindex MAKESHELL @r{(MS-DOS alternative to @code{SHELL})} Unlike most variables, the variable @code{SHELL} is never set from the environment. This is because the @code{SHELL} environment variable is used to specify your personal choice of shell program for interactive @@ -3627,6 +3597,8 @@ @code{make} commands as @samp{.PHONY} (for more discussion on when this is useful, see @ref{Phony Targets}). +@vindex CURDIR +@vindex $(CURDIR) For your convenience, GNU @code{make} sets the variable @code{CURDIR} to the pathname of the current working directory for you. If @code{-C} is in effect, it will contain the path of the new directory, not the @@ -4253,6 +4225,7 @@ basis. * Pattern-specific:: Target-specific variable values can be applied to a group of targets that match a pattern. +* Specials:: Miscellaneous variables with special values. @end menu @node Reference, Flavors, Using Variables, Using Variables @@ -4792,6 +4765,11 @@ @item Several variables have constant initial values. @xref{Implicit Variables, ,Variables Used by Implicit Rules}. + +@item +Several variables have their values set in special ways that defy +classification. +@xref{Specials, ,Special Variables}. @end itemize @node Setting, Appending, Values, Using Variables @@ -5229,7 +5207,7 @@ command scripts that create @file{prog.o}, @file{foo.o}, and @file{bar.o}, and any command scripts which create their prerequisites. -@node Pattern-specific, , Target-specific, Using Variables +@node Pattern-specific, Specials, Target-specific, Using Variables @section Pattern-specific Variable Values @cindex pattern-specific variables @cindex variables, pattern-specific @@ -5272,6 +5250,102 @@ will assign @code{CFLAGS} the value of @samp{-O} for all targets matching the pattern @code{%.o}. +@node Specials, , Pattern-specific, Using Variables +@section Special Variables + +There are several variables that get their values in special ways. +They are collected here for easy reference: + +@table @code +@item CURDIR +The pathname of the current working directory. +@xref{Recursion, ,Recursive Use of @code{make}}. + +@item .LIBPATTERNS +Defines the naming of the libraries @code{make} searches for, and their +order. The default value depends on the operating system.@* +@xref{Libraries/Search, ,Directory Search for Link Libraries}. + +@item MAKE +The command to use for recursive @code{make} commands. This variable +also has some magic properties when it is @emph{used}; +@ref{MAKE Variable, ,How the @code{MAKE} Variable Works} + +@item MAKECMDGOALS +The list of goals specified on the command line +@xref{Goals, ,Arguments to Specify the Goals}. + +@item MAKE_COMMAND +@vindex MAKE_COMMAND +@vindex $(MAKE_COMMAND) +Equivalent to @code{MAKE}. In fact, @code{$(MAKE)} unfolds to +@code{$(MAKE_COMMAND)} which is what is actually has a special +value. This is for historical compatibility; you should not depend on +this set-up. + +@item MAKEOVERRIDES +@itemx MFLAGS +@itemx MAKEFLAGS +Used for passing options to recursive invocations of @code{make}. +@xref{Options/Recursion, ,Communicating Options to a Sub-@code{make}}. + +@item MAKEFILE_LIST +The names of makefiles that @code{make} has begun reading yet. +@xref{MAKEFILE_LIST Variable, ,The Variable @code{MAKEFILE_LIST}}. + +@c @item MAKEFILES +@c (This is set automatically, but to the empty string, so it might +@c as well not be set. Certainly we need not mention it here.) + +@item MAKELEVEL +The number of levels of recursion (sub-@code{make}s). +@xref{Variables/Recursion, ,Communicating Variables to a Sub-@code{make}}. + +@item MAKE_VERSION +@vindex $(MAKE_VERSION) +@vindex MAKE_VERSION +Set to the version number of @code{make}. + +@item SHELL +Used for executing commands. Defaults to @file{/bin/sh} on Unix, but +with variations on other operating systems. +@xref{Execution, ,Command Execution}. + +@item SUFFIXES +@vindex $(SUFFIXES) +@vindex SUFFIXES @r{(default list of suffixes)} +The default list of suffixes recognised for suffix rules. +@xref{Suffix Rules, ,Old-Fashioned Suffix Rules}. + +@c @item .TARGETS +@c @vindex $(.TARGETS) +@c @vindex .TARGETS @r{(list of targets)} +@c The second special variable is @code{.TARGETS}. When expanded, the +@c value consists of a list of all targets defined in all makefiles read +@c up until that point. Note it's not enough for a file to be simply +@c mentioned in the makefile to be listed in this variable, even if it +@c would match an implicit rule and become an ``implicit target''. The +@c file must appear as a target, on the left-hand side of a ``:'', to be +@c considered a target for the purposes of this variable. +@c +@c @code{.TARGETS} is so special that any value you assign to it will be +@c ignored; it will always return its special value. + +@item .VARIABLES +@vindex $(.VARIABLES) +@vindex .VARIABLES @r{(list of variables)} +When expanded, the value of @code{VARIABLES} consists of a list of the +@emph{names} of all global variables +defined in all makefiles read up until that point. This includes +variables which have empty values, as well as built-in variables +(@pxref{Implicit Variables, , Variables Used by Implicit Rules}), but +does not include any variables which are only defined in a +target-specific context. + +@code{.VARIABLES} is so special that any value you assign to it will be +ignored; it will always return its special value. +@end table + @node Conditionals, Functions, Using Variables, Top @chapter Conditional Parts of Makefiles @@ -9770,7 +9844,7 @@ The directory part and the file-within-directory part of @code{$?}. @end table -These variables are used specially by GNU @code{make}: +These variables are used or set specially by GNU @code{make}: @table @code @item MAKEFILES @@ -9778,6 +9852,11 @@ Makefiles to be read on every invocation of @code{make}.@* @xref{MAKEFILES Variable, ,The Variable @code{MAKEFILES}}. +@item MAKEFILE_LIST + +Makefiles that @code{make} has actually started parsing yet. +@xref{MAKEFILE_LIST Variable, ,The Variable @code{MAKEFILE_LIST}}. + @item VPATH Directory search path for files not found in the current directory.@* @@ -9823,6 +9902,10 @@ variable has no effect on the operation of @code{make}.@* @xref{Goals, ,Arguments to Specify the Goals}. +@item MAKE_VERSION + +The version number of @code{make}. + @item CURDIR Set to the pathname of the current working directory (after all @@ -9838,6 +9921,11 @@ Defines the naming of the libraries @code{make} searches for, and their order.@* @xref{Libraries/Search, ,Directory Search for Link Libraries}. + +@item .VARIABLES + +A list of all currently defined variables. +@xref{Specials, ,Special Variables}. @end table @node Error Messages, Complex Makefile, Quick Reference, Top