1 # Kconfig helper macros
8 space := $(empty) $(empty)
13 # $(if-success,<command>,<then>,<else>)
14 # Return <then> if <command> exits with 0, <else> otherwise.
15 if-success = $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
17 # $(success,<command>)
18 # Return y if <command> exits with 0, n otherwise
19 success = $(if-success,$(1),y,n)
21 # $(failure,<command>)
22 # Return n if <command> exits with 0, y otherwise
23 failure = $(if-success,$(1),n,y)
26 # Return y if the compiler supports <flag>, n otherwise
27 cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null)
30 # Return y if the linker supports <flag>, n otherwise
31 ld-option = $(success,$(LD) -v $(1))
33 # check if $(CC) and $(LD) exist
34 $(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found)
35 $(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found)
37 # gcc version including patch level
38 gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))