diff options
| author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-28 05:21:59 -0400 |
|---|---|---|
| committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-28 14:31:19 -0400 |
| commit | e1cfdc0e72fc9ad7c04ad6329acb92876e062849 (patch) | |
| tree | f32ea4e4715c0559bba4d8cb9014b582d76f355e /scripts | |
| parent | 21c54b774744719c386fbdc829b0e7759edb8ece (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.include | 27 |
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 | ||
| 4 | comma := , | ||
| 5 | quote := " | ||
| 6 | squote := ' | ||
| 7 | empty := | ||
| 8 | space := $(empty) $(empty) | ||
| 9 | dollar := $ | ||
| 10 | right_paren := ) | ||
| 11 | left_paren := ( | ||
| 12 | |||
| 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)") | ||
| 16 | |||
| 17 | # $(success,<command>) | ||
| 18 | # Return y if <command> exits with 0, n otherwise | ||
| 19 | success = $(if-success,$(1),y,n) | ||
| 20 | |||
| 21 | # $(cc-option,<flag>) | ||
| 22 | # Return y if the compiler supports <flag>, n otherwise | ||
| 23 | cc-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 | ||
| 27 | ld-option = $(success,$(LD) -v $(1)) | ||
