help-make
[Top][All Lists]
Advanced

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

RE: Fixing a Target Order based on the requested target?


From: Dave Korn
Subject: RE: Fixing a Target Order based on the requested target?
Date: Wed, 21 Mar 2007 23:12:11 -0000

On 21 March 2007 13:27, Yannick Koehler wrote:

> Hello,
> 
>   I have a project where I can generated 5 targets.  All of them are
> PHONY targets.  Those targets can all be generated individually except
> one which require at least 1 of the other to be done before itself.

> I can do
> 
> make a
> make b
> make c
> make d
> 
> but I cannot do
> 
> make e
> 
> without having built at least one of a,b,c or d... but not necessarily
> all of them.  Considering that it takes 1 hour to build a,b,c and d...
> I'd like to tell GNU make that if I someone do "make a e", "make b e"
> or "make a b e" it's fine, but "make e" alone is bad...
> 
> I have not found a way to do this...

  Use a sentinel?

.PHONY: a b c d e
a:
  @echo "Target $@ is Done"
  @touch .e-ok

b:
  @echo "Target $@ is Done"
  @touch .e-ok

c:
  @echo "Target $@ is Done"
  @touch .e-ok

d:
  @echo "Target $@ is Done"
  @touch .e-ok

e: .e-ok
  @echo "Target $@ is Done"

.e-ok:
  @echo "You must build one of a-d before you can build e"
  @exit -1

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....





reply via email to

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