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