help-make
[Top][All Lists]
Advanced

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

Re: Chnaging MAKEFLAGS


From: Greg Kilfoyle
Subject: Re: Chnaging MAKEFLAGS
Date: Fri, 14 Jan 2005 12:49:04 -0800

I tried += too. I've had problems with +=, so I tend to avoid it, but
that's another story.

What I'm showing is exactly what I'm trying to do. I have a directory
which contains a bunch of make include files and I want to add that as a
search directory to the existing execution of make. (The real directory
is a number of levels deep so I don't want to add the directory prefix
to every include directive.)

The text in section 5.6.3 states: "You can also set MAKEFLAGS in a
makefile, to specify additional flags that should also be in effect for
that makefile.", thus I'm expecting this to work.

The make version is 3.80.

Cheers, Greg.


On Fri, 2005-01-14 at 12:02, John Graham-Cumming wrote:
> On Fri, 2005-01-14 at 14:32, Greg Kilfoyle wrote:
> > The manual (section 5.6.3) suggests that I can change the value of
> > variable MAKEFLAGS such that the current make file will refer to the new
> > setting. I can't get this to work. I have the following Makefile:
> > 
> > MAKEFLAGS := $(MAKEFLAGS) -Imk
> > include util.mk
> > $(warning done)
> > 
> > ...there is a file called util.mk in directory mk, but the include line
> > fails:
> > 
> > guitar:gregk ~ {1558} make
> > Makefile:3: util.mk: No such file or directory
> > Makefile:5: done
> 
> That's not going to work because MAKEFLAGS is used for communication to
> sub-makes: i.e. MAKEFLAGS is read when you do $(MAKE) in a rule.  So you
> can change MAKEFLAGS in a Makefile and it will affect any $(MAKE) calls
> that you make, but it will not affect the current Makefile.
> 
> BTW, you should probably use GNU Make's += operator instead of the :=
> form in your Makefile.  I would change
> 
> MAKEFLAGS := $(MAKEFLAGS) -Imk
> 
> to
> 
> MAKEFLAGS += -Imk
> 
> for two reasons: firstly it's neater and secondly += takes into account
> with its LHS is a simply defined or recursively defined variable and
> does the right thing without you needing to worry.  Note that += adds a
> space before the thing it's appending.
> 
> What are you trying to achieve with the dynamic setting of -Imk?
> 
> John.
-- 
Greg Kilfoyle <address@hidden>





reply via email to

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