Fix invocation to PRE_BUILD_HOOK to accept absolute, relative and expanded paths

This commit is contained in:
Julien Ridoux 2014-03-19 16:34:23 +11:00
parent 9da68030b0
commit 287d382704
2 changed files with 6 additions and 5 deletions

View file

@ -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

View file

@ -7,7 +7,8 @@ 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 $$?))), \
$(if $(findstring 0, \
$(lastword $(shell $(abspath $(wildcard $(1))); echo $$?))), \
$(info Info: $(1) success), \
$(error ERROR: $(1) failed)))