]> git.ipfire.org Git - thirdparty/linux.git/blame - scripts/Kconfig.include
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[thirdparty/linux.git] / scripts / Kconfig.include
CommitLineData
ec8f24b7 1# SPDX-License-Identifier: GPL-2.0-only
e1cfdc0e
MY
2# Kconfig helper macros
3
4# Convenient variables
5comma := ,
6quote := "
7squote := '
8empty :=
9space := $(empty) $(empty)
10dollar := $
11right_paren := )
12left_paren := (
13
14# $(if-success,<command>,<then>,<else>)
15# Return <then> if <command> exits with 0, <else> otherwise.
16if-success = $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
17
18# $(success,<command>)
19# Return y if <command> exits with 0, n otherwise
20success = $(if-success,$(1),y,n)
21
902a6898
MY
22# $(failure,<command>)
23# Return n if <command> exits with 0, y otherwise
24failure = $(if-success,$(1),n,y)
25
e1cfdc0e
MY
26# $(cc-option,<flag>)
27# Return y if the compiler supports <flag>, n otherwise
e8de12fb 28cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c /dev/null -o /dev/null)
e1cfdc0e
MY
29
30# $(ld-option,<flag>)
31# Return y if the linker supports <flag>, n otherwise
32ld-option = $(success,$(LD) -v $(1))
59f53855 33
902a6898
MY
34# check if $(CC) and $(LD) exist
35$(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found)
36$(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found)
37
59f53855 38# gcc version including patch level
fa7295ab 39gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))