help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no prerequisites and no target in command


From: Paul D. Smith
Subject: Re: no prerequisites and no target in command
Date: Tue, 03 Oct 2006 12:49:06 -0400

> According to make if no prerequisites are specified then make must
> interpret this as target always being upto date and do nothing at all

Hm?  No.  Where did you read this?

The rule is, if a target has no prerequisites then it's considered
up-to-date _IF (and only if) THE TARGET FILE EXISTS_.

In this case, if you did "touch clean" then the clean rule would never
run because the target file ("clean") exists and there are no
prerequisites, so it can never be considered out of date.

If the target file does not exist, then it is not up to date and the
commands are run.  If the commands don't create the target file (and
neither does anything else), then it will still be out of date the
next time you run make.


The .PHONY pseudo-target is used to make this more explicit (a phony
target will be rebuilt every time, regardless of whether the target
file exists or not).

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]