From ffde764adaa56cf00296857c8fd4a821b6b2e506 Mon Sep 17 00:00:00 2001 From: Julien Ridoux Date: Fri, 14 Mar 2014 10:42:35 +1100 Subject: Add phony target to run pre-build hook script Fix #176 --- Common.mk | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Common.mk') diff --git a/Common.mk b/Common.mk index a94c37f..9aa36b8 100644 --- a/Common.mk +++ b/Common.mk @@ -4,6 +4,14 @@ # (directory and optional filename) exists dir_if_exists = $(if $(wildcard $(1)$(2)),$(1)) +# Run a shell script if it exists. Stops make on error. +runscript_if_exists = \ + $(if $(wildcard $(1)), \ + $(if $(findstring 0, \ + $(lastword $(shell $(abspath $(wildcard $(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. space_pad_to = $(shell echo $(1) " " | head -c$(2)) -- cgit v1.2.3