-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmpty-Targets.html
More file actions
48 lines (40 loc) · 1.94 KB
/
Empty-Targets.html
File metadata and controls
48 lines (40 loc) · 1.94 KB
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
45
46
47
<html lang="en">
<head>
<title>GNU `make'</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU `make'">
<meta name="generator" content="makeinfo 4.3">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
</head>
<body>
<div class="node">
<p>
Node:<a name="Empty%20Targets">Empty Targets</a>,
Next:<a rel="next" accesskey="n" href="Special-Targets.html#Special%20Targets">Special Targets</a>,
Previous:<a rel="previous" accesskey="p" href="Force-Targets.html#Force%20Targets">Force Targets</a>,
Up:<a rel="up" accesskey="u" href="Rules.html#Rules">Rules</a>
<hr><br>
</div>
<h3 class="section">Empty Target Files to Record Events</h3>
<p>The <dfn>empty target</dfn> is a variant of the phony target; it is used to hold
commands for an action that you request explicitly from time to time.
Unlike a phony target, this target file can really exist; but the file's
contents do not matter, and usually are empty.
<p>The purpose of the empty target file is to record, with its
last-modification time, when the rule's commands were last executed. It
does so because one of the commands is a <code>touch</code> command to update the
target file.
<p>The empty target file should have some prerequisites (otherwise it
doesn't make sense). When you ask to remake the empty target, the
commands are executed if any prerequisite is more recent than the target;
in other words, if a prerequisite has changed since the last time you
remade the target. Here is an example:
<pre class="example"> print: foo.c bar.c
lpr -p $?
touch print
</pre>
<p>With this rule, <code>make print</code> will execute the <code>lpr</code> command if
either source file has changed since the last <code>make print</code>. The
automatic variable <code>$?</code> is used to print only those files that have
changed (see <a href="Automatic.html#Automatic">Automatic Variables</a>).
</body></html>