* [Buildroot] [PATCH] package/Makefile.in: remove BR2_TARGET_OPTIMIZATION from TARGET_CFLAGS
@ 2015-10-14 22:19 Arnout Vandecappelle
2015-10-21 18:28 ` Yann E. MORIN
2015-10-29 9:19 ` Peter Korsgaard
0 siblings, 2 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2015-10-14 22:19 UTC (permalink / raw)
To: buildroot
Since the toolchain is always wrapped and the wrapper already passes
BR2_TARGET_OPTIMIZATION (through BR_ADDITIONAL_CFLAGS), there is no longer
any need to pass it in TARGET_CFLAGS as well.
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
Tested with BR2_DEBUG_WRAPPER that BR2_TARGET_OPTIMIZATION and
BR2_OPTIMIZE_* are still called correctly.
---
package/Makefile.in | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/package/Makefile.in b/package/Makefile.in
index 8a592d4..ca34660 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -110,22 +110,20 @@ endif
STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
STAGING_DIR = $(HOST_DIR)/$(STAGING_SUBDIR)
-TARGET_OPTIMIZATION := $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
-
ifeq ($(BR2_OPTIMIZE_0),y)
-TARGET_OPTIMIZATION += -O0
+TARGET_OPTIMIZATION = -O0
endif
ifeq ($(BR2_OPTIMIZE_1),y)
-TARGET_OPTIMIZATION += -O1
+TARGET_OPTIMIZATION = -O1
endif
ifeq ($(BR2_OPTIMIZE_2),y)
-TARGET_OPTIMIZATION += -O2
+TARGET_OPTIMIZATION = -O2
endif
ifeq ($(BR2_OPTIMIZE_3),y)
-TARGET_OPTIMIZATION += -O3
+TARGET_OPTIMIZATION = -O3
endif
ifeq ($(BR2_OPTIMIZE_S),y)
-TARGET_OPTIMIZATION += -Os
+TARGET_OPTIMIZATION = -Os
endif
ifeq ($(BR2_DEBUG_1),y)
TARGET_DEBUGGING = -g1
--
2.6.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH] package/Makefile.in: remove BR2_TARGET_OPTIMIZATION from TARGET_CFLAGS
2015-10-14 22:19 [Buildroot] [PATCH] package/Makefile.in: remove BR2_TARGET_OPTIMIZATION from TARGET_CFLAGS Arnout Vandecappelle
@ 2015-10-21 18:28 ` Yann E. MORIN
2015-10-21 19:28 ` Arnout Vandecappelle
2015-10-29 9:19 ` Peter Korsgaard
1 sibling, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2015-10-21 18:28 UTC (permalink / raw)
To: buildroot
Arnout, All,
On 2015-10-15 00:19 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
> Since the toolchain is always wrapped and the wrapper already passes
> BR2_TARGET_OPTIMIZATION (through BR_ADDITIONAL_CFLAGS), there is no longer
> any need to pass it in TARGET_CFLAGS as well.
>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
On principle:
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
However, I noticed a potential bug in the toolchain-wrapper makefile.
Here's how we currently define BR_ADDITIONAL_CFLAGS:
-DBR_ADDITIONAL_CFLAGS='$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)",)'
Notice the last comma in there? We want to have that comma in the
resulting expansion, so that we transform the option string:
-mfoo -mbar -buz
into:
"-mfoo", "-mbar", "-mbuz",
so that it can be used ina C array definition:
static char *predef_args[] = {
[...]
#ifdef BR_ADDITIONAL_CFLAGS
BR_ADDITIONAL_CFLAGS
#endif
}
However, in Makefile function calls, the comma is used to separate the
arguments passed to the function.
Even though $(foreach ...) only accepts three arguments, and the last
comma in fact correctly ends up in the expanded string, it would be
much safer to use $(comma) instead, like we would have to do in a call
to any other function.
Regards,
Yann E. MORIN.
> ---
> Tested with BR2_DEBUG_WRAPPER that BR2_TARGET_OPTIMIZATION and
> BR2_OPTIMIZE_* are still called correctly.
> ---
> package/Makefile.in | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/package/Makefile.in b/package/Makefile.in
> index 8a592d4..ca34660 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -110,22 +110,20 @@ endif
> STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
> STAGING_DIR = $(HOST_DIR)/$(STAGING_SUBDIR)
>
> -TARGET_OPTIMIZATION := $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
> -
> ifeq ($(BR2_OPTIMIZE_0),y)
> -TARGET_OPTIMIZATION += -O0
> +TARGET_OPTIMIZATION = -O0
> endif
> ifeq ($(BR2_OPTIMIZE_1),y)
> -TARGET_OPTIMIZATION += -O1
> +TARGET_OPTIMIZATION = -O1
> endif
> ifeq ($(BR2_OPTIMIZE_2),y)
> -TARGET_OPTIMIZATION += -O2
> +TARGET_OPTIMIZATION = -O2
> endif
> ifeq ($(BR2_OPTIMIZE_3),y)
> -TARGET_OPTIMIZATION += -O3
> +TARGET_OPTIMIZATION = -O3
> endif
> ifeq ($(BR2_OPTIMIZE_S),y)
> -TARGET_OPTIMIZATION += -Os
> +TARGET_OPTIMIZATION = -Os
> endif
> ifeq ($(BR2_DEBUG_1),y)
> TARGET_DEBUGGING = -g1
> --
> 2.6.1
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH] package/Makefile.in: remove BR2_TARGET_OPTIMIZATION from TARGET_CFLAGS
2015-10-21 18:28 ` Yann E. MORIN
@ 2015-10-21 19:28 ` Arnout Vandecappelle
0 siblings, 0 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2015-10-21 19:28 UTC (permalink / raw)
To: buildroot
On 21-10-15 20:28, Yann E. MORIN wrote:
[snip]
> However, I noticed a potential bug in the toolchain-wrapper makefile.
> Here's how we currently define BR_ADDITIONAL_CFLAGS:
>
> -DBR_ADDITIONAL_CFLAGS='$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)",)'
>
> Notice the last comma in there? We want to have that comma in the
> resulting expansion, so that we transform the option string:
>
> -mfoo -mbar -buz
>
> into:
>
> "-mfoo", "-mbar", "-mbuz",
>
> so that it can be used ina C array definition:
>
> static char *predef_args[] = {
> [...]
> #ifdef BR_ADDITIONAL_CFLAGS
> BR_ADDITIONAL_CFLAGS
> #endif
> }
>
> However, in Makefile function calls, the comma is used to separate the
> arguments passed to the function.
>
> Even though $(foreach ...) only accepts three arguments, and the last
> comma in fact correctly ends up in the expanded string, it would be
> much safer to use $(comma) instead, like we would have to do in a call
> to any other function.
Sure thing. Care to cook a patch?
Regards,
Arnout
[snip]
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH] package/Makefile.in: remove BR2_TARGET_OPTIMIZATION from TARGET_CFLAGS
2015-10-14 22:19 [Buildroot] [PATCH] package/Makefile.in: remove BR2_TARGET_OPTIMIZATION from TARGET_CFLAGS Arnout Vandecappelle
2015-10-21 18:28 ` Yann E. MORIN
@ 2015-10-29 9:19 ` Peter Korsgaard
1 sibling, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2015-10-29 9:19 UTC (permalink / raw)
To: buildroot
>>>>> "Arnout" == Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> writes:
> Since the toolchain is always wrapped and the wrapper already passes
> BR2_TARGET_OPTIMIZATION (through BR_ADDITIONAL_CFLAGS), there is no longer
> any need to pass it in TARGET_CFLAGS as well.
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Committed, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-29 9:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-14 22:19 [Buildroot] [PATCH] package/Makefile.in: remove BR2_TARGET_OPTIMIZATION from TARGET_CFLAGS Arnout Vandecappelle
2015-10-21 18:28 ` Yann E. MORIN
2015-10-21 19:28 ` Arnout Vandecappelle
2015-10-29 9:19 ` Peter Korsgaard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.