summaryrefslogtreecommitdiff
path: root/devdocs/gnu_make/force-targets.html
blob: 916d153a17368fdbf74e6efb836adc88698868f0 (plain)
1
2
3
4
5
6
7
8
9
10
  <h1 class="section">Rules without Recipes or Prerequisites</h1>     <p>If a rule has no prerequisites or recipe, and the target of the rule is a nonexistent file, then <code>make</code> imagines this target to have been updated whenever its rule is run. This implies that all targets depending on this one will always have their recipe run. </p> <p>An example will illustrate this: </p> <div class="example"> <pre class="example">clean: FORCE
        rm $(objects)
FORCE:
</pre>
</div> <p>Here the target ‘<samp>FORCE</samp>’ satisfies the special conditions, so the target <samp>clean</samp> that depends on it is forced to run its recipe. There is nothing special about the name ‘<samp>FORCE</samp>’, but that is one name commonly used this way. </p> <p>As you can see, using ‘<samp>FORCE</samp>’ this way has the same results as using ‘<samp>.PHONY: clean</samp>’. </p> <p>Using ‘<samp>.PHONY</samp>’ is more explicit and more efficient. However, other versions of <code>make</code> do not support ‘<samp>.PHONY</samp>’; thus ‘<samp>FORCE</samp>’ appears in many makefiles. See <a href="phony-targets">Phony Targets</a>. </p><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/Force-Targets.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/Force-Targets.html</a>
  </p>
</div>