All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] tools: Makefile: improve cross_tools target usability
@ 2016-10-31 13:15 Stefan Müller-Klieser
  2016-10-31 13:27 ` Marek Vasut
  2016-11-05 17:41 ` Masahiro Yamada
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Müller-Klieser @ 2016-10-31 13:15 UTC (permalink / raw)
  To: u-boot

When building the cross_tools target, HOSTCFLAGS and HOSTLDFLAGS will
propagate to the target build. This should not happen and is easy to
prevent.

Signed-off-by: Stefan M?ller-Klieser <s.mueller-klieser@phytec.de>
---
 tools/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/Makefile b/tools/Makefile
index 400588c..305336c 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -263,6 +263,8 @@ subdir- += env
 
 ifneq ($(CROSS_BUILD_TOOLS),)
 HOSTCC = $(CC)
+HOSTCFLAGS = $(CFLAGS)
+HOSTLDFLAGS = $(LDFLAGS)
 
 quiet_cmd_crosstools_strip = STRIP   $^
       cmd_crosstools_strip = $(STRIP) $^; touch $@
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] tools: Makefile: improve cross_tools target usability
  2016-10-31 13:15 [U-Boot] [PATCH] tools: Makefile: improve cross_tools target usability Stefan Müller-Klieser
@ 2016-10-31 13:27 ` Marek Vasut
  2016-11-05 17:41 ` Masahiro Yamada
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2016-10-31 13:27 UTC (permalink / raw)
  To: u-boot

On 10/31/2016 02:15 PM, Stefan M?ller-Klieser wrote:
> When building the cross_tools target, HOSTCFLAGS and HOSTLDFLAGS will
> propagate to the target build. This should not happen and is easy to
> prevent.
> 
> Signed-off-by: Stefan M?ller-Klieser <s.mueller-klieser@phytec.de>

+CC Masahiro Yamada-san .

> ---
>  tools/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/Makefile b/tools/Makefile
> index 400588c..305336c 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -263,6 +263,8 @@ subdir- += env
>  
>  ifneq ($(CROSS_BUILD_TOOLS),)
>  HOSTCC = $(CC)
> +HOSTCFLAGS = $(CFLAGS)
> +HOSTLDFLAGS = $(LDFLAGS)
>  
>  quiet_cmd_crosstools_strip = STRIP   $^
>        cmd_crosstools_strip = $(STRIP) $^; touch $@
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] tools: Makefile: improve cross_tools target usability
  2016-10-31 13:15 [U-Boot] [PATCH] tools: Makefile: improve cross_tools target usability Stefan Müller-Klieser
  2016-10-31 13:27 ` Marek Vasut
@ 2016-11-05 17:41 ` Masahiro Yamada
  2016-11-07 12:05   ` Stefan Müller-Klieser
  1 sibling, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2016-11-05 17:41 UTC (permalink / raw)
  To: u-boot

Hi.

2016-10-31 22:15 GMT+09:00 Stefan M?ller-Klieser <s.mueller-klieser@phytec.de>:
> When building the cross_tools target, HOSTCFLAGS and HOSTLDFLAGS will
> propagate to the target build. This should not happen and is easy to
> prevent.
>
> Signed-off-by: Stefan M?ller-Klieser <s.mueller-klieser@phytec.de>
> ---
>  tools/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/Makefile b/tools/Makefile
> index 400588c..305336c 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -263,6 +263,8 @@ subdir- += env
>
>  ifneq ($(CROSS_BUILD_TOOLS),)
>  HOSTCC = $(CC)
> +HOSTCFLAGS = $(CFLAGS)
> +HOSTLDFLAGS = $(LDFLAGS)


In the current U-Boot build system (= Kbuild),
CFLAGS is never set, never referenced.

For the target build, KBUILD_CFLAGS is used instead.


So, $(CFLAGS) is always empty unless your environment
explicitly sets it.
Likewise for LDFLAGS.


Did you mean

HOSTCFLAGS =
HOSTLDFLAGS =

or

HOSTCFLAGS = $(KBUILD_CFLAGS)
HOSTLDFLAGS =

?


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] tools: Makefile: improve cross_tools target usability
  2016-11-05 17:41 ` Masahiro Yamada
@ 2016-11-07 12:05   ` Stefan Müller-Klieser
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Müller-Klieser @ 2016-11-07 12:05 UTC (permalink / raw)
  To: u-boot

On 05.11.2016 18:41, Masahiro Yamada wrote:
> Hi.
Hi!

> 
> 2016-10-31 22:15 GMT+09:00 Stefan M?ller-Klieser <s.mueller-klieser@phytec.de>:
>> When building the cross_tools target, HOSTCFLAGS and HOSTLDFLAGS will
>> propagate to the target build. This should not happen and is easy to
>> prevent.
>>
>> Signed-off-by: Stefan M?ller-Klieser <s.mueller-klieser@phytec.de>
>> ---
>>  tools/Makefile | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/tools/Makefile b/tools/Makefile
>> index 400588c..305336c 100644
>> --- a/tools/Makefile
>> +++ b/tools/Makefile
>> @@ -263,6 +263,8 @@ subdir- += env
>>
>>  ifneq ($(CROSS_BUILD_TOOLS),)
>>  HOSTCC = $(CC)
>> +HOSTCFLAGS = $(CFLAGS)
>> +HOSTLDFLAGS = $(LDFLAGS)
> 
> 
> In the current U-Boot build system (= Kbuild),
> CFLAGS is never set, never referenced.
> 
> For the target build, KBUILD_CFLAGS is used instead.

Well, having the cross_tools target, Kbuild actually creates binaries
for two different runtime environments. First we have the u-boot, which
is a bare metal app controlled by e.g. the KBUILD_CFLAGS, and then
we have the cross tools which are linux userspace binaries. The compilation
of the userspace binaries can be very different and kbuild cannot know about
it, e.g. it does not make much sense to set compiler defaults, in my opinion,

> 
> 
> So, $(CFLAGS) is always empty unless your environment
> explicitly sets it.
> Likewise for LDFLAGS.

As intended.

> 
> 
> Did you mean
> 
> HOSTCFLAGS =
> HOSTLDFLAGS =

That would certainly fix the current bug. Reading your comments make me
think that I should have created two different patches, and I even have
one more queued.

> 
> or
> 
> HOSTCFLAGS = $(KBUILD_CFLAGS)
> HOSTLDFLAGS =

That being said, no I think that would create even more confusion.


> 
> ?

Thanks for the review. Looking at the kbuild documentation, the case for CFLAGS
and LDFLAGS is actually different, as LDFLAGS are well defined and CFLAGS are not.
The case for cross tools is not specified, to my understanding, please correct me.
So another proposal would be:

HOSTCFLAGS = $(TARGETCFLAGS)
HOSTLDFLAGS = $(TARGETLDFLAGS)

?

Regards, Stefan

> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-07 12:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-31 13:15 [U-Boot] [PATCH] tools: Makefile: improve cross_tools target usability Stefan Müller-Klieser
2016-10-31 13:27 ` Marek Vasut
2016-11-05 17:41 ` Masahiro Yamada
2016-11-07 12:05   ` Stefan Müller-Klieser

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.