Re: [PATCH] Kbuild: move extra gcc check flags to the top Makefile

From: Michal Marek
Date: Tue Apr 08 2014 - 11:07:12 EST


On 2014-04-07 05:22, Masahiro Yamada wrote:
> If W=... given to the command line, extra gcc check flags are added
> to KBUILD_CFLAGS.
>
> If we have such code in scripts/Makefile.build, the same flags are
> added to KBUILD_CFLAGS multiple times becuase scripts/Makefile.build
> is invoked every time Kbuild descends into the subdirectories.

Indeed. For three years, nobody has noticed that the gcc commandline is
growing with every subdirectory.

>
> Signed-off-by: Masahiro Yamada <yamada.m@xxxxxxxxxxxxxxxx>
> ---
> Makefile | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
> scripts/Makefile.build | 51 --------------------------------------------------
> 2 files changed, 51 insertions(+), 51 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 00a933b..6588a03 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -579,6 +579,57 @@ endif # $(dot-config)
> # Defaults to vmlinux, but the arch makefile usually adds further targets
> all: vmlinux
>
> +#
> +# make W=... settings

I don't think it's a good idea to add this to the main Makefile. First
of all, this option

> +warning-1 += $(call cc-option, -Wunused-but-set-variable)

gets overridden by

KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)

couple of lines later. This is easily fixed by moving the whole block
down. However, the main Makefile is quite complex already, so please
move this to a new Makefile fragment in scripts/ and include this from
the main Makefile instead.

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