summaryrefslogtreecommitdiff
path: root/devdocs/gnu_make/make-control-functions.html
blob: b45d21ea0676b69c1742ff60b4fa2642be032f80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  <h1 class="section">Functions That Control Make</h1>   <p>These functions control the way make runs. Generally, they are used to provide information to the user of the makefile or to cause make to stop if some sort of environmental error is detected. </p> <dl compact> <dt id="$(error text…)"><code>$(error <var>text</var>…)</code></dt> <dd>
   <p>Generates a fatal error where the message is <var>text</var>. Note that the error is generated whenever this function is evaluated. So, if you put it inside a recipe or on the right side of a recursive variable assignment, it won’t be evaluated until later. The <var>text</var> will be expanded before the error is generated. </p> <p>For example, </p> <div class="example"> <pre class="example">ifdef ERROR1
$(error error is $(ERROR1))
endif
</pre>
</div> <p>will generate a fatal error during the read of the makefile if the <code>make</code> variable <code>ERROR1</code> is defined. Or, </p> <div class="example"> <pre class="example">ERR = $(error found an error!)

.PHONY: err
err: ; $(ERR)
</pre>
</div> <p>will generate a fatal error while <code>make</code> is running, if the <code>err</code> target is invoked. </p> </dd> <dt id="$(warning text…)"><code>$(warning <var>text</var>…)</code></dt> <dd>
   <p>This function works similarly to the <code>error</code> function, above, except that <code>make</code> doesn’t exit. Instead, <var>text</var> is expanded and the resulting message is displayed, but processing of the makefile continues. </p> <p>The result of the expansion of this function is the empty string. </p> </dd> <dt id="$(info text…)"><code>$(info <var>text</var>…)</code></dt> <dd>
  <p>This function does nothing more than print its (expanded) argument(s) to standard output. No makefile name or line number is added. The result of the expansion of this function is the empty string. </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/Make-Control-Functions.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/Make-Control-Functions.html</a>
  </p>
</div>