Re: [PATCH 3/4] m68k: optimize cc-option calls for cpuflags-y

From: Geert Uytterhoeven
Date: Mon Jun 29 2020 - 15:08:55 EST


On Tue, May 26, 2020 at 2:38 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> arch/m68k/Makefile computes lots of unneeded cc-option calls.
>
> For example, if CONFIG_M5441x is not defined, there is not point in
> evaluating the following compiler flag.
>
> cpuflags-$(CONFIG_M5441x) := $(call cc-option,-mcpu=54455,-mcfv4e)
>
> The result is set to cpuflags-, then thrown away.
>
> The right hand side of ':=' is immediately expanded. Hence, all of the
> 16 calls for cc-option are evaluated. This is expensive since cc-option
> invokes the compiler. This occurs even if you are not attempting to
> build anything, like 'make ARCH=m68k help'.
>
> Use '=' to expand the value _lazily_. The evaluation for cc-option is
> delayed until $(cpuflags-y) is expanded. So, the cc-option test happens
> just once at most.
>
> This commit mimics tune-y of arch/arm/Makefile.
>
> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>

Reviewed-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
i.e. will queue in the m68k for-v5.9 branch.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds