m68k: Optimize cc-option calls for cpuflags-y
authorMasahiro Yamada <masahiroy@kernel.org>
Tue, 26 May 2020 12:38:09 +0000 (21:38 +0900)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 13 Jul 2020 09:39:13 +0000 (11:39 +0200)
commit2367b0264294a50cd2cd9d4c1270a9393f32038c
tree99afce8b274c8e99e1b8634b44b36dde34f89b11
parentbd3ff3f1b69cdb315d91fef0fb9512af83ae579b
m68k: Optimize cc-option calls for cpuflags-y

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@kernel.org>
Acked-by: Greg Ungerer <gerg@linux-m68k.org>
Link: https://lore.kernel.org/r/20200526123810.301667-3-masahiroy@kernel.org
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
arch/m68k/Makefile