diff mbox series

[OpenWrt-Devel] build: rules.mk: allow overriding of HOSTCC and HOSTCXX

Message ID 20190723102252.30420-1-ynezz@true.cz
State Superseded
Delegated to: Petr Štetiar
Headers show
Series [OpenWrt-Devel] build: rules.mk: allow overriding of HOSTCC and HOSTCXX | expand

Commit Message

Petr Štetiar July 23, 2019, 10:22 a.m. UTC
Currently it's not possible to change the host compiler version during
devlopment/test/fixing and one has to always hand edit rules.mk which is
tiresome, so let's allow changing of those variables from make/env vars.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 rules.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Yousong Zhou July 23, 2019, 10:57 a.m. UTC | #1
On Tue, 23 Jul 2019 at 18:23, Petr Štetiar <ynezz@true.cz> wrote:
>
> Currently it's not possible to change the host compiler version during
> devlopment/test/fixing and one has to always hand edit rules.mk which is
> tiresome, so let's allow changing of those variables from make/env vars.
>
> Signed-off-by: Petr Štetiar <ynezz@true.cz>
> ---
>  rules.mk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/rules.mk b/rules.mk
> index 80cb3d63f449..dc8a1bac8d83 100644
> --- a/rules.mk
> +++ b/rules.mk
> @@ -245,8 +245,8 @@ PKG_CONFIG:=$(STAGING_DIR_HOST)/bin/pkg-config
>
>  export PKG_CONFIG
>
> -HOSTCC:=gcc
> -HOSTCXX:=g++
> +HOSTCC?=gcc
> +HOSTCXX?=g++

Variables specified as command arguments can override `:=` assignment.
But the change is still helpful if such HOSTCC and HOSTCXX are from
environment.

Acked-by: Yousong Zhou <yszhou4tech@gmail.com>

                yousong
Petr Štetiar July 23, 2019, 11:13 a.m. UTC | #2
Yousong Zhou <yszhou4tech@gmail.com> [2019-07-23 18:57:32]:

Hi,

> Variables specified as command arguments can override `:=` assignment.

thanks, didn't know about this.

> But the change is still helpful if such HOSTCC and HOSTCXX are from
> environment.

I think, that current default is better, I'm able to override it, so I'm quite
reluctant to change the default behavior just for the case. Anyway, thanks a
lot for review!

Cheers,

Petr
diff mbox series

Patch

diff --git a/rules.mk b/rules.mk
index 80cb3d63f449..dc8a1bac8d83 100644
--- a/rules.mk
+++ b/rules.mk
@@ -245,8 +245,8 @@  PKG_CONFIG:=$(STAGING_DIR_HOST)/bin/pkg-config
 
 export PKG_CONFIG
 
-HOSTCC:=gcc
-HOSTCXX:=g++
+HOSTCC?=gcc
+HOSTCXX?=g++
 HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include $(if $(IS_PACKAGE_BUILD),-I$(STAGING_DIR_HOSTPKG)/include -I$(STAGING_DIR)/host/include)
 HOST_CFLAGS:=-O2 $(HOST_CPPFLAGS)
 HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib $(if $(IS_PACKAGE_BUILD),-L$(STAGING_DIR_HOSTPKG)/lib -L$(STAGING_DIR)/host/lib)