aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-05-28 05:21:59 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-05-28 14:31:19 -0400
commite1cfdc0e72fc9ad7c04ad6329acb92876e062849 (patch)
treef32ea4e4715c0559bba4d8cb9014b582d76f355e /scripts
parent21c54b774744719c386fbdc829b0e7759edb8ece (diff)
kconfig: add basic helper macros to scripts/Kconfig.include
Kconfig got text processing tools like we see in Make. Add Kconfig helper macros to scripts/Kconfig.include like we collect Makefile macros in scripts/Kbuild.include. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kconfig.include27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
new file mode 100644
index 000000000000..bf7c0c9fa3a4
--- /dev/null
+++ b/scripts/Kconfig.include
@@ -0,0 +1,27 @@
1# 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
23cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null)
24
25# $(ld-option,<flag>)
26# Return y if the linker supports <flag>, n otherwise
27ld-option = $(success,$(LD) -v $(1))