Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Another (hopefully more robust) attempt to find a usable substitute
for "echo -e" on the host system.
  • Loading branch information
Michael Brown committed Dec 8, 2007
1 parent 2c7a9e8 commit a8bddfe
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
21 changes: 2 additions & 19 deletions src/Makefile
@@ -1,6 +1,6 @@
# Initialise variables that get added to throughout the various Makefiles
#
MAKEDEPS := Makefile .toolcheck
MAKEDEPS := Makefile .toolcheck .echocheck
SRCDIRS :=
SRCS :=
NON_AUTO_SRCS :=
Expand All @@ -9,24 +9,6 @@ ROMS :=
MEDIA :=
NON_AUTO_MEDIA :=

# Find a usable "echo -e" substitute.
#
ifeq ($(shell echo '\101'),A)
ECHO ?= echo
endif
ifeq ($(shell echo -e '\101'),A)
ECHO ?= echo -e
endif
ifeq ($(shell /bin/echo '\101'),A)
ECHO ?= /bin/echo
endif
ifeq ($(shell /bin/echo -e '\101'),A)
ECHO ?= /bin/echo -e
endif
ifndef ECHO
ECHO := echo
endif

# Grab the central Config file.
#
MAKEDEPS += Config
Expand Down Expand Up @@ -90,6 +72,7 @@ RM ?= rm -f
TOUCH ?= touch
MKDIR ?= mkdir
CP ?= cp
ECHO ?= echo
PERL ?= /usr/bin/perl
CC ?= $(CROSS_COMPILE)gcc
AS ?= $(CROSS_COMPILE)as
Expand Down
35 changes: 28 additions & 7 deletions src/Makefile.housekeeping
Expand Up @@ -7,11 +7,6 @@
#
CLEANUP := $(BIN)/*.* # *.* to avoid catching the "CVS" directory

# Show what we're using for "echo -e"
#
echo :
@$(ECHO) Using "$(ECHO)" to echo

# Version number calculations
#
VERSION_MAJOR = 0
Expand Down Expand Up @@ -44,6 +39,32 @@ version :
@$(TOUCH) $@
VERYCLEANUP += .toolcheck

# Find a usable "echo -e" substitute.
#
TAB := $(shell printf "\t")
ifeq ($(shell echo '\t'),$(TAB))
ECHO_E ?= echo
endif
ifeq ($(shell echo -e '\t'),$(TAB))
ECHO_E ?= echo -e
endif
ifeq ($(shell /bin/echo '\t'),$(TAB))
ECHO_E ?= /bin/echo
endif
ifeq ($(shell /bin/echo -e '\t'),$(TAB))
ECHO_E ?= /bin/echo -e
endif
.echocheck :
ifdef ECHO_E
$(TOUCH) $@
else
@echo "No usable \"echo -e\" substitute found"
@exit 1
endif
VERYCLEANUP += .echocheck
echo :
@$(ECHO) "Using \"$(ECHO_E)\" for \"echo -e\""

# Build verbosity
#
ifeq ($(V),1)
Expand Down Expand Up @@ -126,7 +147,7 @@ define obj_template
@$(CPP) $(CFLAGS) $(CFLAGS_$(3)) $(CFLAGS_$(4)) -DOBJECT=$(4) \
-Wno-error -M $(1) -MT "$(4)_DEPS" -MG -MP | \
sed 's/_DEPS\s*:/_DEPS =/' >> $(2)
@$(ECHO) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
@$(ECHO_E) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
'\n\t$$(QM)$(ECHO) " [BUILD] $$@"\n' \
'\n\t$$(RULE_$(3))\n' \
'\nBOBJS += $$(BIN)/$(4).o\n' \
Expand Down Expand Up @@ -373,7 +394,7 @@ define media_template
@$(MKDIR) -p $(dir $(2))
@$(RM) $(2)
@$(TOUCH) $(2)
@$(ECHO) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
@$(ECHO_E) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
'\n\t$$(QM)$(ECHO) " [FINISH] $$@"' \
'\n\t$$(Q)$$(CP) $$< $$@' \
'\n\t$$(Q)$$(FINALISE_$(1))' \
Expand Down

0 comments on commit a8bddfe

Please sign in to comment.