[CRIU] [PATCH 1/3] nmk: Provide try-asm build check function

Dmitry Safonov dsafonov at virtuozzo.com
Wed May 31 13:23:38 PDT 2017


I need to add feature test written in assembly to check
if the feature can be compiled.

Add a make function for this purpose.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 scripts/nmk/scripts/utils.mk | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/scripts/nmk/scripts/utils.mk b/scripts/nmk/scripts/utils.mk
index 1736ada90f42..0cf216bc0618 100644
--- a/scripts/nmk/scripts/utils.mk
+++ b/scripts/nmk/scripts/utils.mk
@@ -1,11 +1,19 @@
 ifndef ____nmk_defined__utils
 
 #
-# Usage: option = $(call try-cc,source-to-build,cc-options,cc-defines)
-try-cc = $(shell sh -c 'echo "$(1)" |					\
-        $(CC) $(3) -x c - $(2) -o /dev/null > /dev/null 2>&1 &&		\
+# Usage: option := $(call try-compile,language,source-to-build,cc-options,cc-defines)
+try-compile = $(shell sh -c 'echo "$(2)" |					\
+        $(CC) $(4) -x $(1) - $(3) -o /dev/null > /dev/null 2>&1 &&		\
         echo true || echo false')
 
+#
+# Usage: option := $(call try-cc,source-to-build,cc-options,cc-defines)
+try-cc = $(call try-compile,c,$(1),$(2),$(3))
+
+#
+# Usage: option := $(call try-cc,source-to-build,cc-options,cc-defines)
+try-asm = $(call try-compile,assembler-with-cpp,$(1),$(2),$(3))
+
 # pkg-config-check
 # Usage: ifeq ($(call pkg-config-check, library),y)
 pkg-config-check = $(shell sh -c 'pkg-config $(1) && echo y')
-- 
2.12.2



More information about the CRIU mailing list