From 234dce785fe9484bfdc3fef61021982d2f6b4e6d Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Mon, 20 May 2013 16:02:07 +0400 Subject: [PATCH] make: Add scripts/utilities.mak Some features need to be tested on the system where the project is compiled, so instead of drowning into autoconf hell lets try to handle all this with make facility. Signed-off-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- scripts/utilities.mak | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/utilities.mak diff --git a/scripts/utilities.mak b/scripts/utilities.mak new file mode 100644 index 000000000..b2eb430fc --- /dev/null +++ b/scripts/utilities.mak @@ -0,0 +1,15 @@ +# try-cc +# Usage: option = $(call try-cc, source-to-build, cc-options) +try-cc = $(shell sh -c \ + 'TMP="$(OUTPUT)$(TMPOUT).$$$$"; \ + echo "$(1)" | \ + $(CC) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y; \ + rm -f "$$TMP"') + +# try-build +# Usage: option = $(call try-build, source-to-build, cc-options, link-options) +try-build = $(shell sh -c \ + 'TMP="$(OUTPUT)$(TMPOUT).$$$$"; \ + echo "$(1)" | \ + $(CC) -x c - $(2) $(3) -o "$$TMP" > /dev/null 2>&1 && echo y; \ + rm -f "$$TMP"')