help-make
[Top][All Lists]
Advanced

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

Re: Communicating Variables to a Sub-make


From: Paul D. Smith
Subject: Re: Communicating Variables to a Sub-make
Date: Wed, 18 Sep 2002 14:16:01 -0400

%% "Martin d'Anjou" <address@hidden> writes:

  md> On Tue, 17 Sep 2002, Paul D. Smith wrote:

  >> The section of the GNU make manual entitled "Communicating Options
  >> to a Sub-make" will help; in particular read the description of
  >> MAKEFLAGS and MAKEOVERRIDES.

  md> MAKEOVERRIDES is what I need. First I thought I would have to
  md> parse MAKEFLAGS but I realized MAKEOVERRIDES was what I needed. So
  md> passing command line variables to a sub-make (not sure it's really
  md> a sub-make per say) is done like this in my application:

  md> bsub "make $(MAKEOVERRIDES)"

Just note: if the override value contains quoting and whitespace it's
somewhat likely that this will not work the way you want.

  md> Using $(MAKE) has the unpleasant effect of calling make even when
  md> -n is passed.

Unpleasant in this one specific case, maybe, but this effect is
extremely important in general.  Otherwise -n would be virtually useless
in a large, recursive make structure.

A better way to achieve this is something like:

  MYMAKE = $(MAKE)

    ...

       bsub "$(MYMAKE) $(MAKEOVERRIDES)"

This preserves the proper value of MAKE while avoiding the invocation
of the command during -n.

However, note both of these methods will cause parallel builds to not
work correctly.

  md> bsub is a command that picks the least loaded machine on my
  md> network.

If it works for you, that's good.  However, note that GNU make can be
built with support for distributed builds, and I think you'd get much
better behavior from using one of those methods than trying to "roll
your own".

There are two ways to do this that I know of:

 1) Read the README.customs file that comes with the GNU make source

 2) Check out the PVM integration of GNU make, at:

    http://sourceforge.net/projects/pvmgmake

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