help-make
[Top][All Lists]
Advanced

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

Re: *all* prerequisites must be newer and not any of them when consid er


From: Paul D. Smith
Subject: Re: *all* prerequisites must be newer and not any of them when consid ering the target
Date: Mon, 26 Aug 2002 11:09:28 -0400

%% Beuserie Frédéric (stbrice dsi) <address@hidden> writes:

  bfd> is there a way to change this behavior to have: 
  bfd> A target is out of date if it does not exist or if it is older than
  bfd> *ALL* of the prerequisites (by comparison of last-modification times).
  bfd> ... so if *ALL* of the prerequisites changes, the contents of the
  bfd> existing target file are no longer necessarily valid

You mean, you only want the thing to rebuild when all prerequisites are
newer, and not when just a few of them are?  Weird.

No, there's no way to cause make to not rebuild your target.

  bfd> perhaps i've missing something (possible), but i can't find a solution
  bfd> to this problem. 

But, you can do it yourself, maybe.

The $? automatic variable will contain a list of all the targets which
make found were out-of-date; you can test the contents of that value to
make sure that it has all the prerequisites, and only actually do the
update if so.


For example, assuming you aren't using VPATH/vpath, you should be able
to do something like this (note I didn't test this):


  foo: bar baz biz boz blotz
        @if [ '$(sort $?)' = '$(sort $^)' ]; then \
           # They're equal, so everything is newer; \
         fi

Now make will run this rule every time any prerequisite is newer, but it
won't actually do anything unless they all are newer.

I think this is the best you can do.

-- 
-------------------------------------------------------------------------------
 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]