mirror of
https://github.com/xcat2/xNBA.git
synced 2025-01-05 19:15:05 +00:00
Yet another attempt to autodetect an appropriate "echo -e".
This commit is contained in:
parent
27b414da81
commit
3ab571006e
@ -73,6 +73,7 @@ TOUCH ?= touch
|
||||
MKDIR ?= mkdir
|
||||
CP ?= cp
|
||||
ECHO ?= echo
|
||||
PRINTF ?= printf
|
||||
PERL ?= /usr/bin/perl
|
||||
CC ?= $(CROSS_COMPILE)gcc
|
||||
AS ?= $(CROSS_COMPILE)as
|
||||
|
@ -41,27 +41,47 @@ VERYCLEANUP += .toolcheck
|
||||
|
||||
# Find a usable "echo -e" substitute.
|
||||
#
|
||||
TAB := $(shell printf "\t")
|
||||
ifeq ($(shell echo '\t'),$(TAB))
|
||||
ECHO_E ?= echo
|
||||
TAB := $(shell $(PRINTF) '\t')
|
||||
ECHO_E_ECHO := $(ECHO)
|
||||
ECHO_E_ECHO_E := $(ECHO) -e
|
||||
ECHO_E_BIN_ECHO := /bin/echo
|
||||
ECHO_E_BIN_ECHO_E := /bin/echo -e
|
||||
ECHO_E_ECHO_TAB := $(shell $(ECHO_E_ECHO) '\t' | cat)
|
||||
ECHO_E_ECHO_E_TAB := $(shell $(ECHO_E_ECHO_E) '\t' | cat)
|
||||
ECHO_E_BIN_ECHO_TAB := $(shell $(ECHO_E_BIN_ECHO) '\t')
|
||||
ECHO_E_BIN_ECHO_E_TAB := $(shell $(ECHO_E_BIN_ECHO_E) '\t')
|
||||
|
||||
ifeq ($(ECHO_E_ECHO_TAB),$(TAB))
|
||||
ECHO_E ?= $(ECHO_E_ECHO)
|
||||
endif
|
||||
ifeq ($(shell echo -e '\t'),$(TAB))
|
||||
ECHO_E ?= echo -e
|
||||
ifeq ($(ECHO_E_ECHO_E_TAB),$(TAB))
|
||||
ECHO_E ?= $(ECHO_E_ECHO_E)
|
||||
endif
|
||||
ifeq ($(shell /bin/echo '\t'),$(TAB))
|
||||
ECHO_E ?= /bin/echo
|
||||
ifeq ($(ECHO_E_BIN_ECHO_TAB),$(TAB))
|
||||
ECHO_E ?= $(ECHO_E_BIN_ECHO)
|
||||
endif
|
||||
ifeq ($(shell /bin/echo -e '\t'),$(TAB))
|
||||
ECHO_E ?= /bin/echo -e
|
||||
ifeq ($(ECHO_E_BIN_ECHO_E_TAB),$(TAB))
|
||||
ECHO_E ?= $(ECHO_E_BIN_ECHO_E)
|
||||
endif
|
||||
|
||||
.echocheck :
|
||||
ifdef ECHO_E
|
||||
$(TOUCH) $@
|
||||
@$(TOUCH) $@
|
||||
else
|
||||
@echo "No usable \"echo -e\" substitute found"
|
||||
@$(PRINTF) '%24s : x%sx\n' 'tab' '$(TAB)'
|
||||
@$(PRINTF) '%24s : x%sx\n' '"$(ECHO_E_ECHO) \t"' \
|
||||
'$(ECHO_E_ECHO_TAB)'
|
||||
@$(PRINTF) '%24s : x%sx\n' '"$(ECHO_E_ECHO_E) \t"' \
|
||||
'$(ECHO_E_ECHO_E_TAB)'
|
||||
@$(PRINTF) '%24s : x%sx\n' '"$(ECHO_E_BIN_ECHO) \t"' \
|
||||
'$(ECHO_E_BIN_ECHO_TAB)'
|
||||
@$(PRINTF) '%24s : x%sx\n' '"$(ECHO_E_BIN_ECHO_E) \t"' \
|
||||
'$(ECHO_E_BIN_ECHO_E_TAB)'
|
||||
@$(ECHO) "No usable \"echo -e\" substitute found"
|
||||
@exit 1
|
||||
endif
|
||||
VERYCLEANUP += .echocheck
|
||||
|
||||
echo :
|
||||
@$(ECHO) "Using \"$(ECHO_E)\" for \"echo -e\""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user