Re: [PATCH v4 12/30] tools build: Append extra host cflags

From: Ian Rogers

Date: Wed Mar 11 2026 - 20:30:03 EST


On Wed, Mar 11, 2026 at 1:31 AM Leo Yan <leo.yan@xxxxxxx> wrote:
>
> Append HOST_EXTRACFLAGS to HOSTCFLAGS so that additional flags can be
> applied to the host compiler.
>
> Signed-off-by: Leo Yan <leo.yan@xxxxxxx>
> ---
> tools/build/Makefile | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/build/Makefile b/tools/build/Makefile
> index 3a5a3808ab2a1dedd40f35ea322913e8a0788130..a86ce3d99e2bb1c005942d9c32191e6eaa55cf50 100644
> --- a/tools/build/Makefile
> +++ b/tools/build/Makefile
> @@ -40,14 +40,16 @@ endif
> FIXDEP := $(OUTPUT)fixdep
> FIXDEP_IN := $(OUTPUT)fixdep-in.o
>
> +HOSTCFLAGS := $(HOST_EXTRACFLAGS) $(KBUILD_HOSTCFLAGS)


Hi Leo, should HOST_EXTRACFLAGS appear after KBUILD_HOSTCFLAGS here?
This allows the extra flags to override the build system's flags.

Thanks,
Ian

>
> +
> # To track fixdep's dependencies properly, fixdep needs to run on itself.
> # Build it twice the first time.
> $(FIXDEP_IN): FORCE
> $(Q)if [ ! -f $(FIXDEP) ]; then \
> - $(MAKE) $(build)=fixdep HOSTCFLAGS="$(KBUILD_HOSTCFLAGS)"; \
> + $(MAKE) $(build)=fixdep HOSTCFLAGS="$(HOSTCFLAGS)"; \
> rm -f $(FIXDEP).o; \
> fi
> - $(Q)$(MAKE) $(build)=fixdep HOSTCFLAGS="$(KBUILD_HOSTCFLAGS)"
> + $(Q)$(MAKE) $(build)=fixdep HOSTCFLAGS="$(HOSTCFLAGS)"
>
>
> $(FIXDEP): $(FIXDEP_IN)
>
> --
> 2.34.1
>