[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Chnaging MAKEFLAGS
From: |
John Graham-Cumming |
Subject: |
Re: Chnaging MAKEFLAGS |
Date: |
Fri, 14 Jan 2005 15:02:43 -0500 |
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.
--
John Graham-Cumming
Home: http://www.jgc.org/
Work: http://www.electric-cloud.com/
POPFile: http://getpopfile.org/