Skip to content

Commit 2367b02

Browse files
masahir0ygeertu
authored andcommitted
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 <[email protected]> Acked-by: Greg Ungerer <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent bd3ff3f commit 2367b02

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

arch/m68k/Makefile

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,33 @@ endif
3232
# compiler cpu type flag.
3333
#
3434
ifndef CONFIG_M68040
35-
cpuflags-$(CONFIG_M68060) := -m68060
35+
cpuflags-$(CONFIG_M68060) = -m68060
3636
endif
3737
ifndef CONFIG_M68060
38-
cpuflags-$(CONFIG_M68040) := -m68040
38+
cpuflags-$(CONFIG_M68040) = -m68040
3939
endif
40-
cpuflags-$(CONFIG_M68030) :=
41-
cpuflags-$(CONFIG_M68020) :=
42-
cpuflags-$(CONFIG_M68000) := -m68000
43-
cpuflags-$(CONFIG_M5441x) := $(call cc-option,-mcpu=54455,-mcfv4e)
44-
cpuflags-$(CONFIG_M54xx) := $(call cc-option,-mcpu=5475,-m5200)
45-
cpuflags-$(CONFIG_M5407) := $(call cc-option,-mcpu=5407,-m5200)
46-
cpuflags-$(CONFIG_M532x) := $(call cc-option,-mcpu=532x,-m5307)
47-
cpuflags-$(CONFIG_M537x) := $(call cc-option,-mcpu=537x,-m5307)
48-
cpuflags-$(CONFIG_M5307) := $(call cc-option,-mcpu=5307,-m5200)
49-
cpuflags-$(CONFIG_M528x) := $(call cc-option,-mcpu=528x,-m5307)
50-
cpuflags-$(CONFIG_M5275) := $(call cc-option,-mcpu=5275,-m5307)
51-
cpuflags-$(CONFIG_M5272) := $(call cc-option,-mcpu=5272,-m5307)
52-
cpuflags-$(CONFIG_M5271) := $(call cc-option,-mcpu=5271,-m5307)
53-
cpuflags-$(CONFIG_M523x) := $(call cc-option,-mcpu=523x,-m5307)
54-
cpuflags-$(CONFIG_M525x) := $(call cc-option,-mcpu=5253,-m5200)
55-
cpuflags-$(CONFIG_M5249) := $(call cc-option,-mcpu=5249,-m5200)
56-
cpuflags-$(CONFIG_M520x) := $(call cc-option,-mcpu=5208,-m5200)
57-
cpuflags-$(CONFIG_M5206e) := $(call cc-option,-mcpu=5206e,-m5200)
58-
cpuflags-$(CONFIG_M5206) := $(call cc-option,-mcpu=5206,-m5200)
40+
cpuflags-$(CONFIG_M68030) =
41+
cpuflags-$(CONFIG_M68020) =
42+
cpuflags-$(CONFIG_M68000) = -m68000
43+
cpuflags-$(CONFIG_M5441x) = $(call cc-option,-mcpu=54455,-mcfv4e)
44+
cpuflags-$(CONFIG_M54xx) = $(call cc-option,-mcpu=5475,-m5200)
45+
cpuflags-$(CONFIG_M5407) = $(call cc-option,-mcpu=5407,-m5200)
46+
cpuflags-$(CONFIG_M532x) = $(call cc-option,-mcpu=532x,-m5307)
47+
cpuflags-$(CONFIG_M537x) = $(call cc-option,-mcpu=537x,-m5307)
48+
cpuflags-$(CONFIG_M5307) = $(call cc-option,-mcpu=5307,-m5200)
49+
cpuflags-$(CONFIG_M528x) = $(call cc-option,-mcpu=528x,-m5307)
50+
cpuflags-$(CONFIG_M5275) = $(call cc-option,-mcpu=5275,-m5307)
51+
cpuflags-$(CONFIG_M5272) = $(call cc-option,-mcpu=5272,-m5307)
52+
cpuflags-$(CONFIG_M5271) = $(call cc-option,-mcpu=5271,-m5307)
53+
cpuflags-$(CONFIG_M523x) = $(call cc-option,-mcpu=523x,-m5307)
54+
cpuflags-$(CONFIG_M525x) = $(call cc-option,-mcpu=5253,-m5200)
55+
cpuflags-$(CONFIG_M5249) = $(call cc-option,-mcpu=5249,-m5200)
56+
cpuflags-$(CONFIG_M520x) = $(call cc-option,-mcpu=5208,-m5200)
57+
cpuflags-$(CONFIG_M5206e) = $(call cc-option,-mcpu=5206e,-m5200)
58+
cpuflags-$(CONFIG_M5206) = $(call cc-option,-mcpu=5206,-m5200)
59+
60+
# Evaluate tune cc-option calls now
61+
cpuflags-y := $(cpuflags-y)
5962

6063
KBUILD_AFLAGS += $(cpuflags-y)
6164
KBUILD_CFLAGS += $(cpuflags-y)

0 commit comments

Comments
 (0)