From 9da68030b06608b33865f49459f23c3a0c83b329 Mon Sep 17 00:00:00 2001 From: Julien Ridoux Date: Mon, 17 Mar 2014 10:53:06 +1100 Subject: [PATCH] Stop make if external script fails. --- Common.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Common.mk b/Common.mk index 8131dba..d7aee9a 100644 --- a/Common.mk +++ b/Common.mk @@ -4,8 +4,12 @@ # (directory and optional filename) exists dir_if_exists = $(if $(wildcard $(1)$(2)),$(1)) -# Run a shell script if it exists. -runscript_if_exists = $(if $(wildcard $(1)), $(shell $(1))) +# Run a shell script if it exists. Stops make on error. +runscript_if_exists = \ + $(if $(wildcard $(1)), \ + $(if $(findstring 0, $(lastword $(shell $(1); echo $$?))), \ + $(info Info: $(1) success), \ + $(error ERROR: $(1) failed))) # For message printing: pad the right side of the first argument with spaces to # the number of bytes indicated by the second argument.