help-make
[Top][All Lists]
Advanced

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

RE: do I have to use recursive make to make one target fall on another?


From: Mark Galeck (CW)
Subject: RE: do I have to use recursive make to make one target fall on another?
Date: Fri, 2 Mar 2012 01:46:28 -0800

Yes, thank you, so what you are saying, translated to my situation, is

Goal1 goal2: phony
        <recipe for goal2>


This is still inefficient, because, if the user wants to make both goals: goal1 
and goal2, the recipe will be attempted twice.  I only want one attempt.  I 
want make to know goal1 will be made as a side effect of goal2.

Basically, we have everything working with goal2.  But now, I want to add the 
knowledge to make, that there is a file "goal1", which is made as a side effect 
of goal2, and that make smoothly incorporate that new goal, without any 
inefficiencies.

The simple solution:

goal1: goal2

is exactly perfect, exactly what I need.


Except...  other implicit rule of the kind:

goal%: ...
        ...  

mess everything up because they take precedence.  I guess I want to complain 
that the implicit rules can take precedence over an rule that redirects to 
another target.  I don't like that.

Is there a way around this?  

Like I said, the best I can come up with is to artificially make up a recipe 
for goal1, like this:

goal1: phony
        $(MAKE) goal2


just so that I can avoid those implicit recipes to kick in.  Very ugly.  

-----Original Message-----
From: Eli Zaretskii [mailto:address@hidden 


If goal1 and goal2 have something common in their names, you can use
pattern rules.  This is from the GNU Make manual:

     This pattern rule has two targets:

       %.tab.c %.tab.h: %.y
               bison -d $<



reply via email to

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