[CRIU] [PATCH 5/9] build/nmk: simplify try-cc and return true/false

Dmitry Safonov dsafonov at virtuozzo.com
Thu Aug 4 07:49:46 PDT 2016


- simplify: don't use temporary file -- use /dev/null instead
- return 'true' or 'false' -- this way we can use it inside rules
without external call to bash to compare return with 'y', see
the next patch for a use case.

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 scripts/nmk/scripts/utils.mk | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/scripts/nmk/scripts/utils.mk b/scripts/nmk/scripts/utils.mk
index 01f69d074174..ec72a1c0158a 100644
--- a/scripts/nmk/scripts/utils.mk
+++ b/scripts/nmk/scripts/utils.mk
@@ -2,11 +2,9 @@ ifndef ____nmk_defined__utils
 
 #
 # Usage: option = $(call try-cc,source-to-build,cc-options,cc-defines)
-try-cc = $(shell sh -c                                                          \
-                'TMP="$(OUTPUT)$(TMPOUT).$$$$";                                 \
-                 echo "$(1)" |                                                  \
-                 $(CC) $(3) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y;  \
-                 rm -f "$$TMP"')
+try-cc = $(shell sh -c 'echo "$(1)" |					\
+        $(CC) $(3) -x c - $(2) -o /dev/null > /dev/null 2>&1 &&		\
+        echo true || echo false')
 
 # pkg-config-check
 # Usage: ifeq ($(call pkg-config-check, library),y)
-- 
2.9.0



More information about the CRIU mailing list