Blame view

scripts/Kconfig.include 1.31 KB
ec8f24b7f   Thomas Gleixner   treewide: Add SPD...
1
  # SPDX-License-Identifier: GPL-2.0-only
e1cfdc0e7   Masahiro Yamada   kconfig: add basi...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  # Kconfig helper macros
  
  # Convenient variables
  comma       := ,
  quote       := "
  squote      := '
  empty       :=
  space       := $(empty) $(empty)
  dollar      := $
  right_paren := )
  left_paren  := (
  
  # $(if-success,<command>,<then>,<else>)
  # Return <then> if <command> exits with 0, <else> otherwise.
  if-success = $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
  
  # $(success,<command>)
  # Return y if <command> exits with 0, n otherwise
  success = $(if-success,$(1),y,n)
902a6898b   Masahiro Yamada   kbuild: terminate...
21
22
23
  # $(failure,<command>)
  # Return n if <command> exits with 0, y otherwise
  failure = $(if-success,$(1),n,y)
e1cfdc0e7   Masahiro Yamada   kconfig: add basi...
24
25
  # $(cc-option,<flag>)
  # Return y if the compiler supports <flag>, n otherwise
59e2355bd   Masahiro Yamada   kbuild: use -S in...
26
  cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -S -x c /dev/null -o /dev/null)
e1cfdc0e7   Masahiro Yamada   kconfig: add basi...
27
28
29
30
  
  # $(ld-option,<flag>)
  # Return y if the linker supports <flag>, n otherwise
  ld-option = $(success,$(LD) -v $(1))
59f53855b   Masahiro Yamada   gcc-plugins: test...
31

902a6898b   Masahiro Yamada   kbuild: terminate...
32
33
34
  # check if $(CC) and $(LD) exist
  $(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found)
  $(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found)
75959d44f   Thomas Gleixner   kbuild: Fail if g...
35
36
  # Fail if the linker is gold as it's not capable of linking the kernel proper
  $(error-if,$(success, $(LD) -v | grep -q gold), gold linker '$(LD)' not supported)
59f53855b   Masahiro Yamada   gcc-plugins: test...
37
  # gcc version including patch level
fa7295ab6   Masahiro Yamada   kbuild: clean up ...
38
  gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))