help-make
[Top][All Lists]
Advanced

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

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


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

Hello,

I have two goals: goal1 and goal2, and they are both made by the recipe for 
goal2 (goal1 as a side effect).  I know this recipe does not follow Paul's 
rules of makefiles, but I can't change it.

What I need to do, is to efficiently accommodate both goals. That means, 
whether goal1, goal2, or both are given on the command line, there should be 
only one call to the recipe for goal2.

The following is the most intuitive way to me (add one line for goal1)

goal1:  goal2

goal2:
                <recipe>


This works in a simple case, but not always.  Because, if there are also 
various implicit rules that cover things like "goal1", then they take 
precedence over the empty rule for goal1 !!

The only way I see is to do

goal1:
                $(MAKE) goal2


But this is not satisfactory - because there is an unnecessary waste of time 
for the recursive call, completely unneeded.


What to do? I can't change the rest - the rule for goal2, or the implicit 
rules.  I have to add something for goal1, that is as fast as possible in all 
cases.  Do I really have to use recursion??

Mark


reply via email to

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