1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<h1 class="section">Variables Used by Implicit Rules</h1> <p>The recipes in built-in implicit rules make liberal use of certain predefined variables. You can alter the values of these variables in the makefile, with arguments to <code>make</code>, or in the environment to alter how the implicit rules work without redefining the rules themselves. You can cancel all variables used by implicit rules with the ‘<samp>-R</samp>’ or ‘<samp>--no-builtin-variables</samp>’ option. </p> <p>For example, the recipe used to compile a C source file actually says ‘<samp>$(CC) -c $(CFLAGS) $(CPPFLAGS)</samp>’. The default values of the variables used are ‘<samp>cc</samp>’ and nothing, resulting in the command ‘<samp>cc -c</samp>’. By redefining ‘<samp>CC</samp>’ to ‘<samp>ncc</samp>’, you could cause ‘<samp>ncc</samp>’ to be used for all C compilations performed by the implicit rule. By redefining ‘<samp>CFLAGS</samp>’ to be ‘<samp>-g</samp>’, you could pass the ‘<samp>-g</samp>’ option to each compilation. <em>All</em> implicit rules that do C compilation use ‘<samp>$(CC)</samp>’ to get the program name for the compiler and <em>all</em> include ‘<samp>$(CFLAGS)</samp>’ among the arguments given to the compiler. </p> <p>The variables used in implicit rules fall into two classes: those that are names of programs (like <code>CC</code>) and those that contain arguments for the programs (like <code>CFLAGS</code>). (The “name of a program” may also contain some command arguments, but it must start with an actual executable program name.) If a variable value contains more than one argument, separate them with spaces. </p> <p>The following tables describe of some of the more commonly-used predefined variables. This list is not exhaustive, and the default values shown here may not be what <code>make</code> selects for your environment. To see the complete list of predefined variables for your instance of GNU <code>make</code> you can run ‘<samp>make -p</samp>’ in a directory with no makefiles. </p> <p>Here is a table of some of the more common variables used as names of programs in built-in rules: </p> <dl compact> <dt id="AR"><code>AR</code></dt> <dd>
<p>Archive-maintaining program; default ‘<samp>ar</samp>’. </p> </dd> <dt id="AS"><code>AS</code></dt> <dd>
<p>Program for compiling assembly files; default ‘<samp>as</samp>’. </p> </dd> <dt id="CC"><code>CC</code></dt> <dd>
<p>Program for compiling C programs; default ‘<samp>cc</samp>’. </p> </dd> <dt id="CXX"><code>CXX</code></dt> <dd>
<p>Program for compiling C++ programs; default ‘<samp>g++</samp>’. </p> </dd> <dt id="CPP"><code>CPP</code></dt> <dd>
<p>Program for running the C preprocessor, with results to standard output; default ‘<samp>$(CC) -E</samp>’. </p> </dd> <dt id="FC"><code>FC</code></dt> <dd>
<p>Program for compiling or preprocessing Fortran and Ratfor programs; default ‘<samp>f77</samp>’. </p> </dd> <dt id="M2C"><code>M2C</code></dt> <dd>
<p>Program to use to compile Modula-2 source code; default ‘<samp>m2c</samp>’. </p> </dd> <dt id="PC"><code>PC</code></dt> <dd>
<p>Program for compiling Pascal programs; default ‘<samp>pc</samp>’. </p> </dd> <dt id="CO"><code>CO</code></dt> <dd>
<p>Program for extracting a file from RCS; default ‘<samp>co</samp>’. </p> </dd> <dt id="GET"><code>GET</code></dt> <dd>
<p>Program for extracting a file from SCCS; default ‘<samp>get</samp>’. </p> </dd> <dt id="LEX"><code>LEX</code></dt> <dd>
<p>Program to use to turn Lex grammars into source code; default ‘<samp>lex</samp>’. </p> </dd> <dt id="YACC"><code>YACC</code></dt> <dd>
<p>Program to use to turn Yacc grammars into source code; default ‘<samp>yacc</samp>’. </p> </dd> <dt id="LINT"><code>LINT</code></dt> <dd>
<p>Program to use to run lint on source code; default ‘<samp>lint</samp>’. </p> </dd> <dt id="MAKEINFO"><code>MAKEINFO</code></dt> <dd>
<p>Program to convert a Texinfo source file into an Info file; default ‘<samp>makeinfo</samp>’. </p> </dd> <dt id="TEX"><code>TEX</code></dt> <dd>
<p>Program to make TeX <small>DVI</small> files from TeX source; default ‘<samp>tex</samp>’. </p> </dd> <dt id="TEXI2DVI"><code>TEXI2DVI</code></dt> <dd>
<p>Program to make TeX <small>DVI</small> files from Texinfo source; default ‘<samp>texi2dvi</samp>’. </p> </dd> <dt id="WEAVE"><code>WEAVE</code></dt> <dd>
<p>Program to translate Web into TeX; default ‘<samp>weave</samp>’. </p> </dd> <dt id="CWEAVE"><code>CWEAVE</code></dt> <dd>
<p>Program to translate C Web into TeX; default ‘<samp>cweave</samp>’. </p> </dd> <dt id="TANGLE"><code>TANGLE</code></dt> <dd>
<p>Program to translate Web into Pascal; default ‘<samp>tangle</samp>’. </p> </dd> <dt id="CTANGLE"><code>CTANGLE</code></dt> <dd>
<p>Program to translate C Web into C; default ‘<samp>ctangle</samp>’. </p> </dd> <dt id="RM"><code>RM</code></dt> <dd>
<p>Command to remove a file; default ‘<samp>rm -f</samp>’. </p>
</dd> </dl> <p>Here is a table of variables whose values are additional arguments for the programs above. The default values for all of these is the empty string, unless otherwise noted. </p> <dl compact> <dt id="ARFLAGS"><code>ARFLAGS</code></dt> <dd>
<p>Flags to give the archive-maintaining program; default ‘<samp>rv</samp>’. </p> </dd> <dt id="ASFLAGS"><code>ASFLAGS</code></dt> <dd>
<p>Extra flags to give to the assembler (when explicitly invoked on a ‘<samp>.s</samp>’ or ‘<samp>.S</samp>’ file). </p> </dd> <dt id="CFLAGS"><code>CFLAGS</code></dt> <dd>
<p>Extra flags to give to the C compiler. </p> </dd> <dt id="CXXFLAGS"><code>CXXFLAGS</code></dt> <dd>
<p>Extra flags to give to the C++ compiler. </p> </dd> <dt id="COFLAGS"><code>COFLAGS</code></dt> <dd>
<p>Extra flags to give to the RCS <code>co</code> program. </p> </dd> <dt id="CPPFLAGS"><code>CPPFLAGS</code></dt> <dd>
<p>Extra flags to give to the C preprocessor and programs that use it (the C and Fortran compilers). </p> </dd> <dt id="FFLAGS"><code>FFLAGS</code></dt> <dd>
<p>Extra flags to give to the Fortran compiler. </p> </dd> <dt id="GFLAGS"><code>GFLAGS</code></dt> <dd>
<p>Extra flags to give to the SCCS <code>get</code> program. </p> </dd> <dt id="LDFLAGS"><code>LDFLAGS</code></dt> <dd>
<p>Extra flags to give to compilers when they are supposed to invoke the linker, ‘<samp>ld</samp>’, such as <code>-L</code>. Libraries (<code>-lfoo</code>) should be added to the <code>LDLIBS</code> variable instead. </p> </dd> <dt id="LDLIBS"><code>LDLIBS</code></dt> <dd>
<p>Library flags or names given to compilers when they are supposed to invoke the linker, ‘<samp>ld</samp>’. <code>LOADLIBES</code> is a deprecated (but still supported) alternative to <code>LDLIBS</code>. Non-library linker flags, such as <code>-L</code>, should go in the <code>LDFLAGS</code> variable. </p> </dd> <dt id="LFLAGS"><code>LFLAGS</code></dt> <dd>
<p>Extra flags to give to Lex. </p> </dd> <dt id="YFLAGS"><code>YFLAGS</code></dt> <dd>
<p>Extra flags to give to Yacc. </p> </dd> <dt id="PFLAGS"><code>PFLAGS</code></dt> <dd>
<p>Extra flags to give to the Pascal compiler. </p> </dd> <dt id="RFLAGS"><code>RFLAGS</code></dt> <dd>
<p>Extra flags to give to the Fortran compiler for Ratfor programs. </p> </dd> <dt id="LINTFLAGS"><code>LINTFLAGS</code></dt> <dd>
<p>Extra flags to give to lint. </p>
</dd> </dl><div class="_attribution">
<p class="_attribution-p">
Copyright © 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Free Software Foundation, Inc. <br>Licensed under the GNU Free Documentation License.<br>
<a href="https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html</a>
</p>
</div>
|