From 287d38270479e485e7fb2292c80f0952aa72839b Mon Sep 17 00:00:00 2001 From: Julien Ridoux Date: Wed, 19 Mar 2014 16:34:23 +1100 Subject: [PATCH] Fix invocation to PRE_BUILD_HOOK to accept absolute, relative and expanded paths --- Arduino.mk | 2 +- Common.mk | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index 5d7e266..c7a0363 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1113,7 +1113,7 @@ $(OBJDIR): pre-build $(MKDIR) $(OBJDIR) pre-build: - $(call runscript_if_exists,$(CURDIR)/$(PRE_BUILD_HOOK)) + $(call runscript_if_exists,$(PRE_BUILD_HOOK)) $(TARGET_ELF): $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) $(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) -lc -lm diff --git a/Common.mk b/Common.mk index d7aee9a..9aa36b8 100644 --- a/Common.mk +++ b/Common.mk @@ -5,10 +5,11 @@ 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 $(1); echo $$?))), \ - $(info Info: $(1) success), \ +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