/[make]/make/doc/make.texi
ViewVC logotype

Diff of /make/doc/make.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by psmith, Sun May 16 19:16:55 2004 UTC revision 1.20 by bosk, Thu Oct 21 17:42:25 2004 UTC
# Line 1239  If a makefile named @code{Makefile} has Line 1239  If a makefile named @code{Makefile} has
1239    
1240  @example  @example
1241  @group  @group
1242  name1 := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))  name1 := $(lastword $(MAKEFILE_LIST))
1243    
1244  include inc.mk  include inc.mk
1245    
1246  name2 := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))  name2 := $(lastword $(MAKEFILE_LIST))
1247    
1248  all:  all:
1249          @@echo name1 = $(name1)          @@echo name1 = $(name1)
# Line 5963  $(firstword foo bar) Line 5963  $(firstword foo bar)
5963  produces the result @samp{foo}.  Although @code{$(firstword  produces the result @samp{foo}.  Although @code{$(firstword
5964  @var{text})} is the same as @code{$(word 1,@var{text})}, the  @var{text})} is the same as @code{$(word 1,@var{text})}, the
5965  @code{firstword} function is retained for its simplicity.@refill  @code{firstword} function is retained for its simplicity.@refill
5966    
5967    
5968    @item $(lastword @var{names}@dots{})
5969    @findex lastword
5970    @cindex words, extracting last
5971    The argument @var{names} is regarded as a series of names, separated
5972    by whitespace.  The value is the last name in the series.
5973    
5974    For example,
5975    
5976    @example
5977    $(lastword foo bar)
5978    @end example
5979    
5980    @noindent
5981    produces the result @samp{bar}.  Although @code{$(lastword
5982    @var{text})} is the same as @code{$(word $(words @var{text}),@var{text})},
5983    the @code{lastword} function was added for its simplicity and better
5984    performance.@refill
5985  @end table  @end table
5986    
5987    
5988  Here is a realistic example of the use of @code{subst} and  Here is a realistic example of the use of @code{subst} and
5989  @code{patsubst}.  Suppose that a makefile uses the @code{VPATH} variable  @code{patsubst}.  Suppose that a makefile uses the @code{VPATH} variable
5990  to specify a list of directories that @code{make} should search for  to specify a list of directories that @code{make} should search for
# Line 9636  Remove all search paths previously speci Line 9656  Remove all search paths previously speci
9656  directive.  directive.
9657  @end table  @end table
9658    
9659  Here is a summary of the text manipulation functions (@pxref{Functions}):  Here is a summary of the built-in functions (@pxref{Functions}):
9660    
9661  @table @code  @table @code
9662  @item $(subst @var{from},@var{to},@var{text})  @item $(subst @var{from},@var{to},@var{text})
# Line 9667  Select words in @var{text} that @emph{do Line 9687  Select words in @var{text} that @emph{do
9687  Sort the words in @var{list} lexicographically, removing duplicates.@*  Sort the words in @var{list} lexicographically, removing duplicates.@*
9688  @xref{Text Functions, , Functions for String Substitution and Analysis}.  @xref{Text Functions, , Functions for String Substitution and Analysis}.
9689    
9690    @item $(word @var{n},@var{text})
9691    Extract the @var{n}th word (one-origin) of @var{text}.@*
9692    @xref{Text Functions, , Functions for String Substitution and Analysis}.
9693    
9694    @item $(words @var{text})
9695    Count the number of words in @var{text}.@*
9696    @xref{Text Functions, , Functions for String Substitution and Analysis}.
9697    
9698    @item $(wordlist @var{s},@var{e},@var{text})
9699    Returns the list of words in @var{text} from @var{s} to @var{e}.@*
9700    @xref{Text Functions, , Functions for String Substitution and Analysis}.
9701    
9702    @item $(firstword @var{names}@dots{})
9703    Extract the first word of @var{names}.@*
9704    @xref{Text Functions, , Functions for String Substitution and Analysis}.
9705    
9706    @item $(lastword @var{names}@dots{})
9707    Extract the last word of @var{names}.@*
9708    @xref{Text Functions, , Functions for String Substitution and Analysis}.
9709    
9710  @item $(dir @var{names}@dots{})  @item $(dir @var{names}@dots{})
9711  Extract the directory part of each file name.@*  Extract the directory part of each file name.@*
9712  @xref{File Name Functions, ,Functions for File Names}.  @xref{File Name Functions, ,Functions for File Names}.
# Line 9695  Prepend @var{prefix} to each word in @va Line 9735  Prepend @var{prefix} to each word in @va
9735  Join two parallel lists of words.@*  Join two parallel lists of words.@*
9736  @xref{File Name Functions, ,Functions for File Names}.  @xref{File Name Functions, ,Functions for File Names}.
9737    
 @item $(word @var{n},@var{text})  
 Extract the @var{n}th word (one-origin) of @var{text}.@*  
 @xref{File Name Functions, ,Functions for File Names}.  
   
 @item $(words @var{text})  
 Count the number of words in @var{text}.@*  
 @xref{File Name Functions, ,Functions for File Names}.  
   
 @item $(wordlist @var{s},@var{e},@var{text})  
 Returns the list of words in @var{text} from @var{s} to @var{e}.@*  
 @xref{File Name Functions, ,Functions for File Names}.  
   
 @item $(firstword @var{names}@dots{})  
 Extract the first word of @var{names}.@*  
 @xref{File Name Functions, ,Functions for File Names}.  
   
9738  @item $(wildcard @var{pattern}@dots{})  @item $(wildcard @var{pattern}@dots{})
9739  Find file names matching a shell file name pattern (@emph{not} a  Find file names matching a shell file name pattern (@emph{not} a
9740  @samp{%} pattern).@*  @samp{%} pattern).@*

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26