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) $(MKDIR) $(OBJDIR)
pre-build: 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) $(TARGET_ELF): $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS)
$(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) -lc -lm $(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) -lc -lm

View file

@ -5,10 +5,11 @@
dir_if_exists = $(if $(wildcard $(1)$(2)),$(1)) dir_if_exists = $(if $(wildcard $(1)$(2)),$(1))
# Run a shell script if it exists. Stops make on error. # Run a shell script if it exists. Stops make on error.
runscript_if_exists = \ runscript_if_exists = \
$(if $(wildcard $(1)), \ $(if $(wildcard $(1)), \
$(if $(findstring 0, $(lastword $(shell $(1); echo $$?))), \ $(if $(findstring 0, \
$(info Info: $(1) success), \ $(lastword $(shell $(abspath $(wildcard $(1))); echo $$?))), \
$(info Info: $(1) success), \
$(error ERROR: $(1) failed))) $(error ERROR: $(1) failed)))
# For message printing: pad the right side of the first argument with spaces to # For message printing: pad the right side of the first argument with spaces to