summaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.compiler
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2022-12-11 11:46:47 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2022-12-13 22:21:14 +0900
commitfccb3d3eda8d19b893e1fd18e8c70b78784b2a72 (patch)
treec7685ee943ebd45f5ce0b34c720393ab3311fca8 /scripts/Makefile.compiler
parente4412739472b743e18860ad8d979a7ceb3071652 (diff)
downloadlinux-fccb3d3eda8d19b893e1fd18e8c70b78784b2a72.tar.bz2
kbuild: add test-{ge,gt,le,lt} macros
GNU Make 4.4 introduced $(intcmp ...), which is useful to compare two integers without forking a new process. Add test-{ge,gt,le,lt} macros, which work more efficiently with GNU Make >= 4.4. For older Make versions, they fall back to the 'test' shell command. The first two parameters to $(intcmp ...) must not be empty. To avoid the syntax error, I appended '0' to them. Fortunately, '00' is treated as '0'. This is needed because CONFIG options may expand to an empty string when the kernel configuration is not included. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Palmer Dabbelt <palmer@rivosinc.com> # RISC-V Reviewed-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Diffstat (limited to 'scripts/Makefile.compiler')
-rw-r--r--scripts/Makefile.compiler4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
index 20d353dcabfb..3d8adfd34af1 100644
--- a/scripts/Makefile.compiler
+++ b/scripts/Makefile.compiler
@@ -63,11 +63,11 @@ cc-disable-warning = $(call try-run,\
# gcc-min-version
# Usage: cflags-$(call gcc-min-version, 70100) += -foo
-gcc-min-version = $(shell [ $(CONFIG_GCC_VERSION)0 -ge $(1)0 ] && echo y)
+gcc-min-version = $(call test-ge, $(CONFIG_GCC_VERSION), $1)
# clang-min-version
# Usage: cflags-$(call clang-min-version, 110000) += -foo
-clang-min-version = $(shell [ $(CONFIG_CLANG_VERSION)0 -ge $(1)0 ] && echo y)
+clang-min-version = $(call test-ge, $(CONFIG_CLANG_VERSION), $1)
# ld-option
# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)