bug-make
[Top][All Lists]
Advanced

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

Re: add order-only-prerequisites example


From: Paul D. Smith
Subject: Re: add order-only-prerequisites example
Date: Sun, 29 Aug 2004 01:35:27 -0400

%% Dan Jacobson <address@hidden> writes:

  dj>      TARGETS : NORMAL-PREREQUISITES | ORDER-ONLY-PREREQUISITES

  dj> Well, you got me there. Without examples, we have trouble grasping
  dj> how to utilize what this Info page is talking about.

Sometimes features are advanced enough that providing a simple example
of when they might be useful is difficult.  There is no common build
setup where this feature is really needed; it is used in more obscure
situations such as when you have a single command that generates lots of
output files that are needed by other parts of the build, maybe header
files, and the list of output files is not easily determinable, and you
can't write any sort of normal prerequisite relationship for the
generated code.

  dj> Obviously the authors must have learned about make from something that
  dj> we can't find on our Debian system. Probably one must buy a book to
  dj> find the full story.

As you're no doubt aware, all GNU software _AND_ books are released
under a public license.

If you're not satisfied, you should consider returning them for a refund.

  dj>    Occasionally, however, you have a situation where you want to impose
  dj>    a specific ordering on the rules to be invoked _without_ forcing the
  dj>    target to be updated if one of those rules is executed.  In that case,
  dj>    you want to define "order-only" prerequisites.

  dj> Sounds just like what I need. Let's print the date before and afterwards,
  dj> a:|date job date
  dj> date:;
  dj> job:;echo $@
  dj> That doesn't work. Double colons don't help either.

Of course not.  Make builds each target exactly one time.  Once its
command script has been invoked, make assumes it's up-to-date.  It won't
run the command script twice, no matter how many times the target
appears in a prerequisites list.


On the off chance you're actually interested in this feature, these
prerequisites have semantics similar to normal prerequisites: all this
says is that all of the order-only prerequisites must be built before
the target that depends on them.  Unlike normal prerequisites, though,
if one of them is updated that does _NOT_ force the target to rebuild.

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