* [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target
@ 2008-01-25 14:18 Ian Jackson
2008-01-25 14:39 ` Paul Brook
0 siblings, 1 reply; 14+ messages in thread
From: Ian Jackson @ 2008-01-25 14:18 UTC (permalink / raw)
To: qemu-devel
Saying CPPFLAGS+= is much more convenient if for any reason the
external build environment would like to pass unusual CPPFLAGS.
Regards,
Ian.
Index: Makefile.target
===================================================================
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.240
diff -u -r1.240 Makefile.target
--- Makefile.target 14 Jan 2008 22:09:11 -0000 1.240
+++ Makefile.target 25 Jan 2008 14:16:24 -0000
@@ -24,7 +24,7 @@
endif
TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
-CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MP -DNEED_CPU_H
+CPPFLAGS+=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MP -DNEED_CPU_H
ifdef CONFIG_DARWIN_USER
VPATH+=:$(SRC_PATH)/darwin-user
CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target
2008-01-25 14:18 [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target Ian Jackson
@ 2008-01-25 14:39 ` Paul Brook
2008-01-25 14:44 ` Ian Jackson
2008-01-28 9:09 ` Ronan Keryell
0 siblings, 2 replies; 14+ messages in thread
From: Paul Brook @ 2008-01-25 14:39 UTC (permalink / raw)
To: qemu-devel; +Cc: Ian Jackson
> Saying CPPFLAGS+= is much more convenient if for any reason the
> external build environment would like to pass unusual CPPFLAGS.
No. This doesn't do what you thing it does.
The most common way of overriding these variables is to pass them on the
commandline, i.e. "make CPPFLAGS=-blah". This overrides all assignments to
that variable including +=.
Paul
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target
2008-01-25 14:39 ` Paul Brook
@ 2008-01-25 14:44 ` Ian Jackson
2008-01-25 14:48 ` Ian Jackson
2008-01-28 9:09 ` Ronan Keryell
1 sibling, 1 reply; 14+ messages in thread
From: Ian Jackson @ 2008-01-25 14:44 UTC (permalink / raw)
To: Paul Brook; +Cc: qemu-devel
Paul Brook writes ("Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target"):
> No. This doesn't do what you thing it does.
> The most common way of overriding these variables is to pass them on the
> commandline, i.e. "make CPPFLAGS=-blah". This overrides all assignments to
> that variable including +=.
Err, yes (and this is annoying behaviour in make), but if
Makefile.target sets CPPFLAGS=-I... then even config.mak cannot
override it.
Ian.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target
2008-01-25 14:44 ` Ian Jackson
@ 2008-01-25 14:48 ` Ian Jackson
2008-01-25 15:36 ` Paul Brook
0 siblings, 1 reply; 14+ messages in thread
From: Ian Jackson @ 2008-01-25 14:48 UTC (permalink / raw)
To: Paul Brook, qemu-devel
iwj writes ("Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target"):
> Paul Brook writes ("Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target"):
> > No. This doesn't do what you thing it does.
> > The most common way of overriding these variables is to pass them on the
> > commandline, i.e. "make CPPFLAGS=-blah". This overrides all assignments to
> > that variable including +=.
>
> Err, yes (and this is annoying behaviour in make), but if
> Makefile.target sets CPPFLAGS=-I... then even config.mak cannot
> override it.
Sorry, perhaps that was less than clear. What I mean is: if you want
for any reason to build qemu in a weird way then you're going to have
to edit config-host.mak (or somewhere similar) in any case. You
probably want to set some CPPFLAGS as well as various other things.
If you do this at the moment then you have to reproduce all of the
CPPFLAGS -I settings and so on from Makefile.target in your own
setting that you add to config-host.mak.
With my change this is no longer needed: if you set CPPFLAGS in
config-host.mak or some target's config.mak then the right -I's are
automatically added later.
Ian.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target
2008-01-25 14:48 ` Ian Jackson
@ 2008-01-25 15:36 ` Paul Brook
2008-01-25 15:37 ` Ian Jackson
0 siblings, 1 reply; 14+ messages in thread
From: Paul Brook @ 2008-01-25 15:36 UTC (permalink / raw)
To: qemu-devel; +Cc: Ian Jackson
> What I mean is: if you want
> for any reason to build qemu in a weird way then you're going to have
> to edit config-host.mak (or somewhere similar) in any case. You
> probably want to set some CPPFLAGS as well as various other things.
> If you do this at the moment then you have to reproduce all of the
> CPPFLAGS -I settings and so on from Makefile.target in your own
> setting that you add to config-host.mak.
In that case you should always provide a definition in config-host.mak.
Under some circumstances make may inherit initial values from elsewhere.
The rules for make variables are sufficiently twisty that it's best to be
explicit, rather than allowing a subset of the ways of defining that
variable.
Paul
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target
2008-01-25 15:36 ` Paul Brook
@ 2008-01-25 15:37 ` Ian Jackson
2008-01-25 15:53 ` Paul Brook
2008-01-25 16:03 ` Paul Brook
0 siblings, 2 replies; 14+ messages in thread
From: Ian Jackson @ 2008-01-25 15:37 UTC (permalink / raw)
To: Paul Brook; +Cc: qemu-devel
Paul Brook writes ("Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target"):
> In that case you should always provide a definition in config-host.mak.
> Under some circumstances make may inherit initial values from elsewhere.
What circumstances ? CPPFLAGS+= overrides (discards) values in the
environment as well as ones from the command line.
Providing a definition in config-host.mak involves duplicating the
value, which can't be right. If there's no other way to do it then
there should be a reference to USER_CPPFLAGS or some such but frankly
that's a pain and overkill.
Ian.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target
2008-01-25 15:37 ` Ian Jackson
@ 2008-01-25 15:53 ` Paul Brook
2008-01-25 16:03 ` Ian Jackson
2008-01-25 16:03 ` Paul Brook
1 sibling, 1 reply; 14+ messages in thread
From: Paul Brook @ 2008-01-25 15:53 UTC (permalink / raw)
To: qemu-devel; +Cc: Ian Jackson
On Friday 25 January 2008, Ian Jackson wrote:
> Paul Brook writes ("Re: [Qemu-devel] [PATCH] CPPFLAGS+= in
Makefile.target"):
> > In that case you should always provide a definition in config-host.mak.
> > Under some circumstances make may inherit initial values from elsewhere.
>
> What circumstances ? CPPFLAGS+= overrides (discards) values in the
> environment as well as ones from the command line.
$ cat Makefile
FOO += World
all:
@echo "$(FOO)"
$ FOO=Hello make
Hello World
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target
2008-01-25 15:53 ` Paul Brook
@ 2008-01-25 16:03 ` Ian Jackson
0 siblings, 0 replies; 14+ messages in thread
From: Ian Jackson @ 2008-01-25 16:03 UTC (permalink / raw)
To: Paul Brook; +Cc: qemu-devel
Paul Brook writes ("Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target"):
> On Friday 25 January 2008, Ian Jackson wrote:
> > What circumstances ? CPPFLAGS+= overrides (discards) values in the
> > environment as well as ones from the command line.
>
> [ demonstration ]
Oh, err, looks like I messed up in my own test. I see what you mean.
We don't want the top-level's CPPFLAGS turning up there.
Still, there ought to be a way to introduce extra compiler options
that doesn't involve duplicating the ones which are essential to find
qemu's own includes etc.
Ian.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target
2008-01-25 15:37 ` Ian Jackson
2008-01-25 15:53 ` Paul Brook
@ 2008-01-25 16:03 ` Paul Brook
2008-01-25 16:12 ` Ian Jackson
1 sibling, 1 reply; 14+ messages in thread
From: Paul Brook @ 2008-01-25 16:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Ian Jackson
> Providing a definition in config-host.mak involves duplicating the
> value, which can't be right.
Huh? No it doesn't. config-host.mak contains
CPPFLAGS=
then Makefile.target contains
CPPFLAGS+=whatever
> If there's no other way to do it then
> there should be a reference to USER_CPPFLAGS or some such but frankly
> that's a pain and overkill.
Why don't you just put your custom flags in CFLAGS, not CPPFLAGS?
The former is deliberately left for the user to override.
Paul
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target
2008-01-25 16:03 ` Paul Brook
@ 2008-01-25 16:12 ` Ian Jackson
2008-01-25 16:22 ` Paul Brook
0 siblings, 1 reply; 14+ messages in thread
From: Ian Jackson @ 2008-01-25 16:12 UTC (permalink / raw)
To: Paul Brook; +Cc: qemu-devel
Paul Brook writes ("Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target"):
> Huh? No it doesn't. config-host.mak contains
> CPPFLAGS=
> then Makefile.target contains
> CPPFLAGS+=whatever
It doesn't seem to on my build.
> Why don't you just put your custom flags in CFLAGS, not CPPFLAGS?
> The former is deliberately left for the user to override.
Several (but not all AFAICT) of the target subdirectory Makefiles set
CFLAGS.
Anyway, I think you're right that I should go away and think about
this some more. Sorry for the inconvenience.
Ian.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target
2008-01-25 14:39 ` Paul Brook
2008-01-25 14:44 ` Ian Jackson
@ 2008-01-28 9:09 ` Ronan Keryell
2008-01-28 11:35 ` Thiemo Seufer
1 sibling, 1 reply; 14+ messages in thread
From: Ronan Keryell @ 2008-01-28 9:09 UTC (permalink / raw)
To: qemu-devel
>>>>> On Fri, 25 Jan 2008 14:39:57 +0000, Paul Brook <paul@codesourcery.com> said:
>> Saying CPPFLAGS+= is much more convenient if for any reason the
>> external build environment would like to pass unusual CPPFLAGS.
Paul> No. This doesn't do what you thing it does. The most common way
Paul> of overriding these variables is to pass them on the
Paul> commandline, i.e. "make CPPFLAGS=-blah". This overrides all
Paul> assignments to that variable including +=.
By the way, it is possible to improve the GNU make weirdness :-) by
playing with stuff like:
override CFLAGS += -g
Cf section 6.7 of the documentation.
Hmmm... GNU make evolves more rapidly than my brain... :-)
--
Ronan KERYELL |\/ Tel: (+33|0) 2.29.00.14.15
Département Informatique |/) Fax: (+33|0) 2.29.00.12.82
TÉLÉCOM Bretagne, CS 83818 K GSM: (+33|0) 6.13.14.37.66
F-29238 PLOUZANÉ CEDEX 3 |\ E-mail: rk@enstb.org
FRANCE | \ http://enstb.org/~keryell
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target
2008-01-28 9:09 ` Ronan Keryell
@ 2008-01-28 11:35 ` Thiemo Seufer
0 siblings, 0 replies; 14+ messages in thread
From: Thiemo Seufer @ 2008-01-28 11:35 UTC (permalink / raw)
To: Ronan Keryell; +Cc: qemu-devel
Ronan Keryell wrote:
> >>>>> On Fri, 25 Jan 2008 14:39:57 +0000, Paul Brook <paul@codesourcery.com> said:
>
> >> Saying CPPFLAGS+= is much more convenient if for any reason the
> >> external build environment would like to pass unusual CPPFLAGS.
>
> Paul> No. This doesn't do what you thing it does. The most common way
> Paul> of overriding these variables is to pass them on the
> Paul> commandline, i.e. "make CPPFLAGS=-blah". This overrides all
> Paul> assignments to that variable including +=.
>
> By the way, it is possible to improve the GNU make weirdness :-) by
> playing with stuff like:
>
> override CFLAGS += -g
>
> Cf section 6.7 of the documentation.
IIRC the documentation warns against careless use of overrides.
> Hmmm... GNU make evolves more rapidly than my brain... :-)
It's only a decade old or so. :-)
Thiemo
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2008-01-28 11:35 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-25 14:18 [Qemu-devel] [PATCH] CPPFLAGS+= in Makefile.target Ian Jackson
2008-01-25 14:39 ` Paul Brook
2008-01-25 14:44 ` Ian Jackson
2008-01-25 14:48 ` Ian Jackson
2008-01-25 15:36 ` Paul Brook
2008-01-25 15:37 ` Ian Jackson
2008-01-25 15:53 ` Paul Brook
2008-01-25 16:03 ` Ian Jackson
2008-01-25 16:03 ` Paul Brook
2008-01-25 16:12 ` Ian Jackson
2008-01-25 16:22 ` Paul Brook
2008-01-25 16:29 ` Ian Jackson
2008-01-28 9:09 ` Ronan Keryell
2008-01-28 11:35 ` Thiemo Seufer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).