Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>By default, Makefile targets are "file targets" - they are used to build files from other files. Make assumes its target is a file, and this makes writing Makefiles relatively easy:</p> <pre><code>foo: bar create_one_from_the_other foo bar </code></pre> <p>However, sometimes you want your Makefile to run commands that do not represent physical files in the file system. Good examples for this are the common targets "clean" and "all". Chances are this isn't the case, but you <em>may</em> potentially have a file named <code>clean</code> in your main directory. In such a case Make will be confused because by default the <code>clean</code> target would be associated with this file and Make will only run it when the file doesn't appear to be up-to-date with regards to its dependencies.</p> <p>These special targets are called <em>phony</em> and you can explicitly tell Make they're not associated with files, e.g.:</p> <pre><code>.PHONY: clean clean: rm -rf *.o </code></pre> <p>Now <code>make clean</code> will run as expected even if you do have a file named <code>clean</code>.</p> <p>In terms of Make, a phony target is simply a target that is always out-of-date, so whenever you ask <code>make &lt;phony_target&gt;</code>, it will run, independent from the state of the file system. Some common <code>make</code> targets that are often phony are: <code>all</code>, <code>install</code>, <code>clean</code>, <code>distclean</code>, <code>TAGS</code>, <code>info</code>, <code>check</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload