diff mbox

[RFC,1/2] Makefile: Make HOSTCFLAGS and HOSTCXXFLAGS user modifyable

Message ID 1403289089-11299-2-git-send-email-markus.mayer@linaro.org
State New
Headers show

Commit Message

Markus Mayer June 20, 2014, 6:31 p.m. UTC
In order to allow the user to pass extra arguments to the host
compiler, we no longer overwrite the host compiler flags in the
makefile, but append them to what was passed in.

Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sam Ravnborg June 20, 2014, 6:44 p.m. UTC | #1
On Fri, Jun 20, 2014 at 11:31:28AM -0700, Markus Mayer wrote:
> In order to allow the user to pass extra arguments to the host
> compiler, we no longer overwrite the host compiler flags in the
> makefile, but append them to what was passed in.
> 
> Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
> ---
>  Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 97b2861..5795eea 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -251,8 +251,8 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
>  
>  HOSTCC       = gcc
>  HOSTCXX      = g++
> -HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
> -HOSTCXXFLAGS = -O2
> +HOSTCFLAGS   += -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
> +HOSTCXXFLAGS += -O2
>  
>  ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
>  HOSTCFLAGS  += -Wno-unused-value -Wno-unused-parameter \

With this patch you can only override HOSTCFLAGS.
In many cases appending to the falgs is actually what you want.

Please take a look at how we have implemented it for the kernel with KCFLAGS.
And notice that this is also described in Documentation/kbuild

	Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Markus Mayer June 20, 2014, 7:35 p.m. UTC | #2
On 20 June 2014 11:44, Sam Ravnborg <sam@ravnborg.org> wrote:
> On Fri, Jun 20, 2014 at 11:31:28AM -0700, Markus Mayer wrote:
>> In order to allow the user to pass extra arguments to the host
>> compiler, we no longer overwrite the host compiler flags in the
>> makefile, but append them to what was passed in.
>>
>> Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
>> ---
>>  Makefile | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 97b2861..5795eea 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -251,8 +251,8 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
>>
>>  HOSTCC       = gcc
>>  HOSTCXX      = g++
>> -HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
>> -HOSTCXXFLAGS = -O2
>> +HOSTCFLAGS   += -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
>> +HOSTCXXFLAGS += -O2
>>
>>  ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
>>  HOSTCFLAGS  += -Wno-unused-value -Wno-unused-parameter \
>
> With this patch you can only override HOSTCFLAGS.
> In many cases appending to the falgs is actually what you want.
>
> Please take a look at how we have implemented it for the kernel with KCFLAGS.
> And notice that this is also described in Documentation/kbuild

Thanks. I am able to do what I need using HOST_EXTRACFLAGS and HOST_LOADLIBES.

-Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 97b2861..5795eea 100644
--- a/Makefile
+++ b/Makefile
@@ -251,8 +251,8 @@  CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 
 HOSTCC       = gcc
 HOSTCXX      = g++
-HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
-HOSTCXXFLAGS = -O2
+HOSTCFLAGS   += -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
+HOSTCXXFLAGS += -O2
 
 ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
 HOSTCFLAGS  += -Wno-unused-value -Wno-unused-parameter \