blob: 3b2861f47709b46aa6f50218a8cf644e9423bf82 [file] [log] [blame]
Masahiro Yamadae1cfdc02018-05-28 18:21:59 +09001# Kconfig helper macros
2
3# Convenient variables
4comma := ,
5quote := "
6squote := '
7empty :=
8space := $(empty) $(empty)
9dollar := $
10right_paren := )
11left_paren := (
12
13# $(if-success,<command>,<then>,<else>)
14# Return <then> if <command> exits with 0, <else> otherwise.
15if-success = $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
16
17# $(success,<command>)
18# Return y if <command> exits with 0, n otherwise
19success = $(if-success,$(1),y,n)
20
21# $(cc-option,<flag>)
22# Return y if the compiler supports <flag>, n otherwise
Stephen Boyd48522282019-07-30 09:48:03 -070023cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c /dev/null -o /dev/null)
Masahiro Yamadae1cfdc02018-05-28 18:21:59 +090024
25# $(ld-option,<flag>)
26# Return y if the linker supports <flag>, n otherwise
27ld-option = $(success,$(LD) -v $(1))
Masahiro Yamada59f53852018-05-28 18:22:06 +090028
29# gcc version including patch level
30gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//')