help-make
[Top][All Lists]
Advanced

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

Re: only run submake if that submake needs to be run?


From: Noel Yap
Subject: Re: only run submake if that submake needs to be run?
Date: Fri, 20 Aug 2004 13:59:57 -0400
User-agent: Mozilla Thunderbird 0.5 (Windows/20040212)

David Wuertele wrote:

Boris> I think you are trying to solve the wrong problem. Here is some
Boris> background.  There are two ways to write makefiles for a
Boris> project: recursive (your case) and non-recursive.

Your explanation hits the nail on the head.  You are correct about the
speed issues and the parallel make issues inherent in my system.

The reason I chose recursive in the first place was for a couple of
reasons:

1.  I want to be able to run make in the sub-directory and have it
    work

2.  I want to use the same variable namespace for all the makefiles.
    For example, I don't want one of my users to have to create
    variable names like:

      my_program_OBJ := this.o that.o

    I want them to be able to write:

      OBJ := this.o that.o

    This is an oversimplified example for the purposes of making the
    point.  I want them to be able to copy their neighbor's Makefile
    and not have to change all the variable names.

Is there a way to write makefiles in a non-recursive fashion that will
enable me to acheive both goals?

The first one, definitely.  You need to write the rules such that they don't 
care about the current directory.

The second one is a bit more complicated to say the least.  What I've done is 
to:

- define the function include-makefile that defines the __FILE__ variable.
- have makefiles "localize" their variable by prefixing them with $(__FILE__).  
For example, $(__FILE__).OBJ.

I've found that there are still problems with this and have thought that using 
functions to define rules might be a better way since UDF's are the only way in 
GNU make to have local variables.  I haven't implemented anything with this 
idea, yet, though.

HTH,
Noel




reply via email to

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