help-make
[Top][All Lists]
Advanced

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

Re: gmake creates files that already exist and are up-to-date


From: Ken Smith
Subject: Re: gmake creates files that already exist and are up-to-date
Date: Fri, 7 Jan 2005 10:19:25 -0500
User-agent: Mutt/1.5.6i

Phony targets are not intended to be used as prerequisites.  When you
use a phony target, gmake assumes that there are no output files  Even
if you do use it as a prerequisite, it doesn't add anything to the
dependency graph.  Since you list both the phony target which builds the
files and the files themselves as a prerequisite to the all target, it
seems perfectly natural that gmake would build the files twice.

A solution could be to turn your phony rule into a real rule and only
add the file targets as prerequisites to all.

Phony rules are useful as aliases to collect several real targets.  You
have used this when you made your all target unless you happen to
generate a file called all.  Phony rules are also useful for things like
clean and clobber which have no output files at all.

  HTH,
  Ken

On Fri, Jan 07, 2005 at 09:03:10AM +0100, Simon De Groot wrote:
> 
>    I  have  a phony target that creates multiple files. On top of that, I
>    defined  a  pattern  rule for that type of file. Both the phony target
>    and  the  individual  targets  are in the dependency tree of the 'all'
>    target.  Once I run gmake --debug=a, I can see that it first makes the
>    phony  target,  creating  all  the  files,  which  from then on exist.
>    Afterwards,  the dependency requires these files individually. I would
>    expect  that by then, these will not be remade, since the phony target
>    has created them successfully. But gmake's debug log reports that each
>    individual file does not exist, and makes them individually.
>    Moreover,  if,  before  I  run the commands that create the individual
>    file, I do an 'ls -l $@', it actually shows that it exists!?!
>    Any ideas anyone?
>    Regards,
>    Simon de Groot
>    CAD Engineer
>    National Semiconductor B.V.
>    Het Zuiderkruis 53
>    NL-5215 MV 's-Hertogenbosch
>    The Netherlands
>    Tel. +31(0)73-6408332, Fax +31(0)73-6408823
>    mailto:address@hidden
>    http://www.national.com
>    This  email  may  contain confidential and privileged material for the
>    sole  use  of the intended recipient. Any review, use, distribution or
>    disclosure  by  others  is  prohibited. If you are not the intended or
>    authorized  recipient  please  contact  the  sender by reply email and
>    delete all copies of this message.

> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make





reply via email to

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