aboutsummaryrefslogtreecommitdiff
path: root/Common.mk
diff options
context:
space:
mode:
authorJulien Ridoux <julien@synclab.org>2014-03-14 10:42:35 +1100
committerSudar <sudar@sudarmuthu.com>2014-03-20 11:17:14 -0700
commitffde764adaa56cf00296857c8fd4a821b6b2e506 (patch)
tree0913ea822e05d9ac92c91195073edd1c3bdeefae /Common.mk
parent64e90740424226418b2a16a4a241f64c05827664 (diff)
Add phony target to run pre-build hook script
Fix #176
Diffstat (limited to 'Common.mk')
-rw-r--r--Common.mk8
1 files changed, 8 insertions, 0 deletions
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))