424 lines
14 KiB
HTML
424 lines
14 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<!-- This HTML file has been created by texi2html 1.54
|
|
from ../texi/make.texinfo on 19 July 2000 -->
|
|
|
|
<TITLE>GNU make - Quick Reference</TITLE>
|
|
<link href="make_16.html" rel=Next>
|
|
<link href="make_14.html" rel=Previous>
|
|
<link href="make_toc.html" rel=ToC>
|
|
|
|
</HEAD>
|
|
<BODY>
|
|
<p>Go to the <A HREF="make_1.html">first</A>, <A HREF="make_14.html">previous</A>, <A HREF="make_16.html">next</A>, <A HREF="make_19.html">last</A> section, <A HREF="make_toc.html">table of contents</A>.
|
|
<P><HR><P>
|
|
|
|
|
|
<H1><A NAME="SEC123" HREF="make_toc.html#TOC123">Quick Reference</A></H1>
|
|
|
|
<P>
|
|
This appendix summarizes the directives, text manipulation functions,
|
|
and special variables which GNU <CODE>make</CODE> understands.
|
|
See section <A HREF="make_4.html#SEC36">Special Built-in Target Names</A>, section <A HREF="make_10.html#SEC95">Catalogue of Implicit Rules</A>,
|
|
and section <A HREF="make_9.html#SEC92">Summary of Options</A>,
|
|
for other summaries.
|
|
|
|
</P>
|
|
<P>
|
|
Here is a summary of the directives GNU <CODE>make</CODE> recognizes:
|
|
|
|
</P>
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>define <VAR>variable</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>endef</CODE>
|
|
<DD>
|
|
Define a multi-line, recursively-expanded variable.<BR>
|
|
See section <A HREF="make_5.html#SEC55">Defining Canned Command Sequences</A>.
|
|
|
|
<DT><CODE>ifdef <VAR>variable</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>ifndef <VAR>variable</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>ifeq (<VAR>a</VAR>,<VAR>b</VAR>)</CODE>
|
|
<DD>
|
|
<DT><CODE>ifeq "<VAR>a</VAR>" "<VAR>b</VAR>"</CODE>
|
|
<DD>
|
|
<DT><CODE>ifeq '<VAR>a</VAR>' '<VAR>b</VAR>'</CODE>
|
|
<DD>
|
|
<DT><CODE>ifneq (<VAR>a</VAR>,<VAR>b</VAR>)</CODE>
|
|
<DD>
|
|
<DT><CODE>ifneq "<VAR>a</VAR>" "<VAR>b</VAR>"</CODE>
|
|
<DD>
|
|
<DT><CODE>ifneq '<VAR>a</VAR>' '<VAR>b</VAR>'</CODE>
|
|
<DD>
|
|
<DT><CODE>else</CODE>
|
|
<DD>
|
|
<DT><CODE>endif</CODE>
|
|
<DD>
|
|
Conditionally evaluate part of the makefile.<BR>
|
|
See section <A HREF="make_7.html#SEC71">Conditional Parts of Makefiles</A>.
|
|
|
|
<DT><CODE>include <VAR>file</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>-include <VAR>file</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>sinclude <VAR>file</VAR></CODE>
|
|
<DD>
|
|
Include another makefile.<BR>
|
|
See section <A HREF="make_3.html#SEC15">Including Other Makefiles</A>.
|
|
|
|
<DT><CODE>override <VAR>variable</VAR> = <VAR>value</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>override <VAR>variable</VAR> := <VAR>value</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>override <VAR>variable</VAR> += <VAR>value</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>override <VAR>variable</VAR> ?= <VAR>value</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>override define <VAR>variable</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>endef</CODE>
|
|
<DD>
|
|
Define a variable, overriding any previous definition, even one from
|
|
the command line.<BR>
|
|
See section <A HREF="make_6.html#SEC66">The <CODE>override</CODE> Directive</A>.
|
|
|
|
<DT><CODE>export</CODE>
|
|
<DD>
|
|
Tell <CODE>make</CODE> to export all variables to child processes by default.<BR>
|
|
See section <A HREF="make_5.html#SEC52">Communicating Variables to a Sub-<CODE>make</CODE></A>.
|
|
|
|
<DT><CODE>export <VAR>variable</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>export <VAR>variable</VAR> = <VAR>value</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>export <VAR>variable</VAR> := <VAR>value</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>export <VAR>variable</VAR> += <VAR>value</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>export <VAR>variable</VAR> ?= <VAR>value</VAR></CODE>
|
|
<DD>
|
|
<DT><CODE>unexport <VAR>variable</VAR></CODE>
|
|
<DD>
|
|
Tell <CODE>make</CODE> whether or not to export a particular variable to child
|
|
processes.<BR>
|
|
See section <A HREF="make_5.html#SEC52">Communicating Variables to a Sub-<CODE>make</CODE></A>.
|
|
|
|
<DT><CODE>vpath <VAR>pattern</VAR> <VAR>path</VAR></CODE>
|
|
<DD>
|
|
Specify a search path for files matching a <SAMP>`%'</SAMP> pattern.<BR>
|
|
See section <A HREF="make_4.html#SEC28">The <CODE>vpath</CODE> Directive</A>.
|
|
|
|
<DT><CODE>vpath <VAR>pattern</VAR></CODE>
|
|
<DD>
|
|
Remove all search paths previously specified for <VAR>pattern</VAR>.
|
|
|
|
<DT><CODE>vpath</CODE>
|
|
<DD>
|
|
Remove all search paths previously specified in any <CODE>vpath</CODE>
|
|
directive.
|
|
</DL>
|
|
|
|
<P>
|
|
Here is a summary of the text manipulation functions (see section <A HREF="make_8.html#SEC75">Functions for Transforming Text</A>):
|
|
|
|
</P>
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>$(subst <VAR>from</VAR>,<VAR>to</VAR>,<VAR>text</VAR>)</CODE>
|
|
<DD>
|
|
Replace <VAR>from</VAR> with <VAR>to</VAR> in <VAR>text</VAR>.<BR>
|
|
See section <A HREF="make_8.html#SEC77">Functions for String Substitution and Analysis</A>.
|
|
|
|
<DT><CODE>$(patsubst <VAR>pattern</VAR>,<VAR>replacement</VAR>,<VAR>text</VAR>)</CODE>
|
|
<DD>
|
|
Replace words matching <VAR>pattern</VAR> with <VAR>replacement</VAR> in <VAR>text</VAR>.<BR>
|
|
See section <A HREF="make_8.html#SEC77">Functions for String Substitution and Analysis</A>.
|
|
|
|
<DT><CODE>$(strip <VAR>string</VAR>)</CODE>
|
|
<DD>
|
|
Remove excess whitespace characters from <VAR>string</VAR>.<BR>
|
|
See section <A HREF="make_8.html#SEC77">Functions for String Substitution and Analysis</A>.
|
|
|
|
<DT><CODE>$(findstring <VAR>find</VAR>,<VAR>text</VAR>)</CODE>
|
|
<DD>
|
|
Locate <VAR>find</VAR> in <VAR>text</VAR>.<BR>
|
|
See section <A HREF="make_8.html#SEC77">Functions for String Substitution and Analysis</A>.
|
|
|
|
<DT><CODE>$(filter <VAR>pattern</VAR>...,<VAR>text</VAR>)</CODE>
|
|
<DD>
|
|
Select words in <VAR>text</VAR> that match one of the <VAR>pattern</VAR> words.<BR>
|
|
See section <A HREF="make_8.html#SEC77">Functions for String Substitution and Analysis</A>.
|
|
|
|
<DT><CODE>$(filter-out <VAR>pattern</VAR>...,<VAR>text</VAR>)</CODE>
|
|
<DD>
|
|
Select words in <VAR>text</VAR> that <EM>do not</EM> match any of the <VAR>pattern</VAR> words.<BR>
|
|
See section <A HREF="make_8.html#SEC77">Functions for String Substitution and Analysis</A>.
|
|
|
|
<DT><CODE>$(sort <VAR>list</VAR>)</CODE>
|
|
<DD>
|
|
Sort the words in <VAR>list</VAR> lexicographically, removing duplicates.<BR>
|
|
See section <A HREF="make_8.html#SEC77">Functions for String Substitution and Analysis</A>.
|
|
|
|
<DT><CODE>$(dir <VAR>names</VAR>...)</CODE>
|
|
<DD>
|
|
Extract the directory part of each file name.<BR>
|
|
See section <A HREF="make_8.html#SEC78">Functions for File Names</A>.
|
|
|
|
<DT><CODE>$(notdir <VAR>names</VAR>...)</CODE>
|
|
<DD>
|
|
Extract the non-directory part of each file name.<BR>
|
|
See section <A HREF="make_8.html#SEC78">Functions for File Names</A>.
|
|
|
|
<DT><CODE>$(suffix <VAR>names</VAR>...)</CODE>
|
|
<DD>
|
|
Extract the suffix (the last <SAMP>`.'</SAMP> and following characters) of each file name.<BR>
|
|
See section <A HREF="make_8.html#SEC78">Functions for File Names</A>.
|
|
|
|
<DT><CODE>$(basename <VAR>names</VAR>...)</CODE>
|
|
<DD>
|
|
Extract the base name (name without suffix) of each file name.<BR>
|
|
See section <A HREF="make_8.html#SEC78">Functions for File Names</A>.
|
|
|
|
<DT><CODE>$(addsuffix <VAR>suffix</VAR>,<VAR>names</VAR>...)</CODE>
|
|
<DD>
|
|
Append <VAR>suffix</VAR> to each word in <VAR>names</VAR>.<BR>
|
|
See section <A HREF="make_8.html#SEC78">Functions for File Names</A>.
|
|
|
|
<DT><CODE>$(addprefix <VAR>prefix</VAR>,<VAR>names</VAR>...)</CODE>
|
|
<DD>
|
|
Prepend <VAR>prefix</VAR> to each word in <VAR>names</VAR>.<BR>
|
|
See section <A HREF="make_8.html#SEC78">Functions for File Names</A>.
|
|
|
|
<DT><CODE>$(join <VAR>list1</VAR>,<VAR>list2</VAR>)</CODE>
|
|
<DD>
|
|
Join two parallel lists of words.<BR>
|
|
See section <A HREF="make_8.html#SEC78">Functions for File Names</A>.
|
|
|
|
<DT><CODE>$(word <VAR>n</VAR>,<VAR>text</VAR>)</CODE>
|
|
<DD>
|
|
Extract the <VAR>n</VAR>th word (one-origin) of <VAR>text</VAR>.<BR>
|
|
See section <A HREF="make_8.html#SEC78">Functions for File Names</A>.
|
|
|
|
<DT><CODE>$(words <VAR>text</VAR>)</CODE>
|
|
<DD>
|
|
Count the number of words in <VAR>text</VAR>.<BR>
|
|
See section <A HREF="make_8.html#SEC78">Functions for File Names</A>.
|
|
|
|
<DT><CODE>$(wordlist <VAR>s</VAR>,<VAR>e</VAR>,<VAR>text</VAR>)</CODE>
|
|
<DD>
|
|
Returns the list of words in <VAR>text</VAR> from <VAR>s</VAR> to <VAR>e</VAR>.<BR>
|
|
See section <A HREF="make_8.html#SEC78">Functions for File Names</A>.
|
|
|
|
<DT><CODE>$(firstword <VAR>names</VAR>...)</CODE>
|
|
<DD>
|
|
Extract the first word of <VAR>names</VAR>.<BR>
|
|
See section <A HREF="make_8.html#SEC78">Functions for File Names</A>.
|
|
|
|
<DT><CODE>$(wildcard <VAR>pattern</VAR>...)</CODE>
|
|
<DD>
|
|
Find file names matching a shell file name pattern (<EM>not</EM> a
|
|
<SAMP>`%'</SAMP> pattern).<BR>
|
|
See section <A HREF="make_4.html#SEC25">The Function <CODE>wildcard</CODE></A>.
|
|
|
|
<DT><CODE>$(error <VAR>text</VAR>...)</CODE>
|
|
<DD>
|
|
When this function is evaluated, <CODE>make</CODE> generates a fatal error
|
|
with the message <VAR>text</VAR>.<BR>
|
|
See section <A HREF="make_8.html#SEC84">Functions That Control Make</A>.
|
|
|
|
<DT><CODE>$(warning <VAR>text</VAR>...)</CODE>
|
|
<DD>
|
|
When this function is evaluated, <CODE>make</CODE> generates a warning with
|
|
the message <VAR>text</VAR>.<BR>
|
|
See section <A HREF="make_8.html#SEC84">Functions That Control Make</A>.
|
|
|
|
<DT><CODE>$(shell <VAR>command</VAR>)</CODE>
|
|
<DD>
|
|
Execute a shell command and return its output.<BR>
|
|
See section <A HREF="make_8.html#SEC83">The <CODE>shell</CODE> Function</A>.
|
|
|
|
<DT><CODE>$(origin <VAR>variable</VAR>)</CODE>
|
|
<DD>
|
|
Return a string describing how the <CODE>make</CODE> variable <VAR>variable</VAR> was
|
|
defined.<BR>
|
|
See section <A HREF="make_8.html#SEC82">The <CODE>origin</CODE> Function</A>.
|
|
|
|
<DT><CODE>$(foreach <VAR>var</VAR>,<VAR>words</VAR>,<VAR>text</VAR>)</CODE>
|
|
<DD>
|
|
Evaluate <VAR>text</VAR> with <VAR>var</VAR> bound to each word in <VAR>words</VAR>,
|
|
and concatenate the results.<BR>
|
|
See section <A HREF="make_8.html#SEC79">The <CODE>foreach</CODE> Function</A>.
|
|
|
|
<DT><CODE>$(call <VAR>var</VAR>,<VAR>param</VAR>,...)</CODE>
|
|
<DD>
|
|
Evaluate the variable <VAR>var</VAR> replacing any references to <CODE>$(1)</CODE>,
|
|
<CODE>$(2)</CODE> with the first, second, etc. <VAR>param</VAR> values.<BR>
|
|
See section <A HREF="make_8.html#SEC81">The <CODE>call</CODE> Function</A>.
|
|
</DL>
|
|
|
|
<P>
|
|
Here is a summary of the automatic variables.
|
|
See section <A HREF="make_10.html#SEC101">Automatic Variables</A>,
|
|
for full information.
|
|
|
|
</P>
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>$@</CODE>
|
|
<DD>
|
|
The file name of the target.
|
|
|
|
<DT><CODE>$%</CODE>
|
|
<DD>
|
|
The target member name, when the target is an archive member.
|
|
|
|
<DT><CODE>$<</CODE>
|
|
<DD>
|
|
The name of the first prerequisite.
|
|
|
|
<DT><CODE>$?</CODE>
|
|
<DD>
|
|
The names of all the prerequisites that are
|
|
newer than the target, with spaces between them.
|
|
For prerequisites which are archive members, only
|
|
the member named is used (see section <A HREF="make_11.html#SEC108">Using <CODE>make</CODE> to Update Archive Files</A>).
|
|
|
|
<DT><CODE>$^</CODE>
|
|
<DD>
|
|
<DT><CODE>$+</CODE>
|
|
<DD>
|
|
The names of all the prerequisites, with spaces between them. For
|
|
prerequisites which are archive members, only the member named is used
|
|
(see section <A HREF="make_11.html#SEC108">Using <CODE>make</CODE> to Update Archive Files</A>). The value of <CODE>$^</CODE> omits duplicate
|
|
prerequisites, while <CODE>$+</CODE> retains them and preserves their order.
|
|
|
|
<DT><CODE>$*</CODE>
|
|
<DD>
|
|
The stem with which an implicit rule matches
|
|
(see section <A HREF="make_10.html#SEC102">How Patterns Match</A>).
|
|
|
|
<DT><CODE>$(@D)</CODE>
|
|
<DD>
|
|
<DT><CODE>$(@F)</CODE>
|
|
<DD>
|
|
The directory part and the file-within-directory part of <CODE>$@</CODE>.
|
|
|
|
<DT><CODE>$(*D)</CODE>
|
|
<DD>
|
|
<DT><CODE>$(*F)</CODE>
|
|
<DD>
|
|
The directory part and the file-within-directory part of <CODE>$*</CODE>.
|
|
|
|
<DT><CODE>$(%D)</CODE>
|
|
<DD>
|
|
<DT><CODE>$(%F)</CODE>
|
|
<DD>
|
|
The directory part and the file-within-directory part of <CODE>$%</CODE>.
|
|
|
|
<DT><CODE>$(<D)</CODE>
|
|
<DD>
|
|
<DT><CODE>$(<F)</CODE>
|
|
<DD>
|
|
The directory part and the file-within-directory part of <CODE>$<</CODE>.
|
|
|
|
<DT><CODE>$(^D)</CODE>
|
|
<DD>
|
|
<DT><CODE>$(^F)</CODE>
|
|
<DD>
|
|
The directory part and the file-within-directory part of <CODE>$^</CODE>.
|
|
|
|
<DT><CODE>$(+D)</CODE>
|
|
<DD>
|
|
<DT><CODE>$(+F)</CODE>
|
|
<DD>
|
|
The directory part and the file-within-directory part of <CODE>$+</CODE>.
|
|
|
|
<DT><CODE>$(?D)</CODE>
|
|
<DD>
|
|
<DT><CODE>$(?F)</CODE>
|
|
<DD>
|
|
The directory part and the file-within-directory part of <CODE>$?</CODE>.
|
|
</DL>
|
|
|
|
<P>
|
|
These variables are used specially by GNU <CODE>make</CODE>:
|
|
|
|
</P>
|
|
<DL COMPACT>
|
|
|
|
<DT><CODE>MAKEFILES</CODE>
|
|
<DD>
|
|
Makefiles to be read on every invocation of <CODE>make</CODE>.<BR>
|
|
See section <A HREF="make_3.html#SEC16">The Variable <CODE>MAKEFILES</CODE></A>.
|
|
|
|
<DT><CODE>VPATH</CODE>
|
|
<DD>
|
|
Directory search path for files not found in the current directory.<BR>
|
|
See section <A HREF="make_4.html#SEC27"><CODE>VPATH</CODE>: Search Path for All Prerequisites</A>.
|
|
|
|
<DT><CODE>SHELL</CODE>
|
|
<DD>
|
|
The name of the system default command interpreter, usually <TT>`/bin/sh'</TT>.
|
|
You can set <CODE>SHELL</CODE> in the makefile to change the shell used to run
|
|
commands. See section <A HREF="make_5.html#SEC46">Command Execution</A>.
|
|
|
|
<DT><CODE>MAKESHELL</CODE>
|
|
<DD>
|
|
On MS-DOS only, the name of the command interpreter that is to be used
|
|
by <CODE>make</CODE>. This value takes precedence over the value of
|
|
<CODE>SHELL</CODE>. See section <A HREF="make_5.html#SEC46">Command Execution</A>.
|
|
|
|
<DT><CODE>MAKE</CODE>
|
|
<DD>
|
|
The name with which <CODE>make</CODE> was invoked.
|
|
Using this variable in commands has special meaning.
|
|
See section <A HREF="make_5.html#SEC51">How the <CODE>MAKE</CODE> Variable Works</A>.
|
|
|
|
<DT><CODE>MAKELEVEL</CODE>
|
|
<DD>
|
|
The number of levels of recursion (sub-<CODE>make</CODE>s).<BR>
|
|
See section <A HREF="make_5.html#SEC52">Communicating Variables to a Sub-<CODE>make</CODE></A>.
|
|
|
|
<DT><CODE>MAKEFLAGS</CODE>
|
|
<DD>
|
|
The flags given to <CODE>make</CODE>. You can set this in the environment or
|
|
a makefile to set flags.<BR>
|
|
See section <A HREF="make_5.html#SEC53">Communicating Options to a Sub-<CODE>make</CODE></A>.
|
|
|
|
It is <EM>never</EM> appropriate to use <CODE>MAKEFLAGS</CODE> directly on a
|
|
command line: its contents may not be quoted correctly for use in the
|
|
shell. Always allow recursive <CODE>make</CODE>'s to obtain these values
|
|
through the environment from its parent.
|
|
|
|
<DT><CODE>MAKECMDGOALS</CODE>
|
|
<DD>
|
|
The targets given to <CODE>make</CODE> on the command line. Setting this
|
|
variable has no effect on the operation of <CODE>make</CODE>.<BR>
|
|
See section <A HREF="make_9.html#SEC87">Arguments to Specify the Goals</A>.
|
|
|
|
<DT><CODE>CURDIR</CODE>
|
|
<DD>
|
|
Set to the pathname of the current working directory (after all
|
|
<CODE>-C</CODE> options are processed, if any). Setting this variable has no
|
|
effect on the operation of <CODE>make</CODE>.<BR>
|
|
See section <A HREF="make_5.html#SEC50">Recursive Use of <CODE>make</CODE></A>.
|
|
|
|
<DT><CODE>SUFFIXES</CODE>
|
|
<DD>
|
|
The default list of suffixes before <CODE>make</CODE> reads any makefiles.
|
|
|
|
<DT><CODE>.LIBPATTERNS</CODE>
|
|
<DD>
|
|
Defines the naming of the libraries <CODE>make</CODE> searches for, and their
|
|
order.<BR>
|
|
See section <A HREF="make_4.html#SEC32">Directory Search for Link Libraries</A>.
|
|
</DL>
|
|
|
|
<P><HR><P>
|
|
<p>Go to the <A HREF="make_1.html">first</A>, <A HREF="make_14.html">previous</A>, <A HREF="make_16.html">next</A>, <A HREF="make_19.html">last</A> section, <A HREF="make_toc.html">table of contents</A>.
|
|
</BODY>
|
|
</HTML>
|