[PATCH v2 10/21] kconfig: add 'success' and 'cc-option' macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'cc-option' will be the most frequently used macro.  It evaluates to 'y'
if the given argument is supported by the compiler, or 'n' otherwise.

Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
---

Changes in v2:
  - Implement 'success' as a macro

 init/Kconfig | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/init/Kconfig b/init/Kconfig
index 0d6fe20..c456030 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -8,6 +8,12 @@ config DEFCONFIG_LIST
 	default ARCH_DEFCONFIG
 	default "arch/$ARCH/defconfig"
 
+# expanded to y if the command exits with 0, n otherwise
+macro success $(shell ($(1) && echo y) || echo n)
+
+# expanded to y if the given compiler flag is supported, n otherwise
+macro cc-option $(success $CC -Werror $(1) -c -x c /dev/null -o /dev/null)
+
 config CONSTRUCTORS
 	bool
 	depends on !UML
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux