Browse Source

Yet another attempt to autodetect an appropriate "echo -e".

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
3ab571006e
2 changed files with 32 additions and 11 deletions
  1. 1
    0
      src/Makefile
  2. 31
    11
      src/Makefile.housekeeping

+ 1
- 0
src/Makefile View File

73
 MKDIR		?= mkdir
73
 MKDIR		?= mkdir
74
 CP		?= cp
74
 CP		?= cp
75
 ECHO		?= echo
75
 ECHO		?= echo
76
+PRINTF		?= printf
76
 PERL		?= /usr/bin/perl
77
 PERL		?= /usr/bin/perl
77
 CC		?= $(CROSS_COMPILE)gcc
78
 CC		?= $(CROSS_COMPILE)gcc
78
 AS		?= $(CROSS_COMPILE)as
79
 AS		?= $(CROSS_COMPILE)as

+ 31
- 11
src/Makefile.housekeeping View File

41
 
41
 
42
 # Find a usable "echo -e" substitute.
42
 # Find a usable "echo -e" substitute.
43
 #
43
 #
44
-TAB 		:= $(shell printf "\t")
45
-ifeq ($(shell echo '\t'),$(TAB))
46
-ECHO_E		?= echo
44
+TAB 			:= $(shell $(PRINTF) '\t')
45
+ECHO_E_ECHO		:= $(ECHO)
46
+ECHO_E_ECHO_E		:= $(ECHO) -e
47
+ECHO_E_BIN_ECHO 	:= /bin/echo
48
+ECHO_E_BIN_ECHO_E 	:= /bin/echo -e
49
+ECHO_E_ECHO_TAB		:= $(shell $(ECHO_E_ECHO) '\t' | cat)
50
+ECHO_E_ECHO_E_TAB	:= $(shell $(ECHO_E_ECHO_E) '\t' | cat)
51
+ECHO_E_BIN_ECHO_TAB 	:= $(shell $(ECHO_E_BIN_ECHO) '\t')
52
+ECHO_E_BIN_ECHO_E_TAB 	:= $(shell $(ECHO_E_BIN_ECHO_E) '\t')
53
+
54
+ifeq ($(ECHO_E_ECHO_TAB),$(TAB))
55
+ECHO_E		?= $(ECHO_E_ECHO)
47
 endif
56
 endif
48
-ifeq ($(shell echo -e '\t'),$(TAB))
49
-ECHO_E		?= echo -e
57
+ifeq ($(ECHO_E_ECHO_E_TAB),$(TAB))
58
+ECHO_E		?= $(ECHO_E_ECHO_E)
50
 endif
59
 endif
51
-ifeq ($(shell /bin/echo '\t'),$(TAB))
52
-ECHO_E		?= /bin/echo
60
+ifeq ($(ECHO_E_BIN_ECHO_TAB),$(TAB))
61
+ECHO_E		?= $(ECHO_E_BIN_ECHO)
53
 endif
62
 endif
54
-ifeq ($(shell /bin/echo -e '\t'),$(TAB))
55
-ECHO_E		?= /bin/echo -e
63
+ifeq ($(ECHO_E_BIN_ECHO_E_TAB),$(TAB))
64
+ECHO_E		?= $(ECHO_E_BIN_ECHO_E)
56
 endif
65
 endif
66
+
57
 .echocheck :
67
 .echocheck :
58
 ifdef ECHO_E
68
 ifdef ECHO_E
59
-	$(TOUCH) $@
69
+	@$(TOUCH) $@
60
 else
70
 else
61
-	@echo "No usable \"echo -e\" substitute found"
71
+	@$(PRINTF) '%24s : x%sx\n' 'tab' '$(TAB)'
72
+	@$(PRINTF) '%24s : x%sx\n' '"$(ECHO_E_ECHO) \t"' \
73
+				    '$(ECHO_E_ECHO_TAB)'
74
+	@$(PRINTF) '%24s : x%sx\n' '"$(ECHO_E_ECHO_E) \t"' \
75
+				    '$(ECHO_E_ECHO_E_TAB)'
76
+	@$(PRINTF) '%24s : x%sx\n' '"$(ECHO_E_BIN_ECHO) \t"' \
77
+				    '$(ECHO_E_BIN_ECHO_TAB)'
78
+	@$(PRINTF) '%24s : x%sx\n' '"$(ECHO_E_BIN_ECHO_E) \t"' \
79
+				    '$(ECHO_E_BIN_ECHO_E_TAB)'
80
+	@$(ECHO) "No usable \"echo -e\" substitute found"
62
 	@exit 1
81
 	@exit 1
63
 endif
82
 endif
64
 VERYCLEANUP	+= .echocheck
83
 VERYCLEANUP	+= .echocheck
84
+
65
 echo :
85
 echo :
66
 	@$(ECHO) "Using \"$(ECHO_E)\" for \"echo -e\""
86
 	@$(ECHO) "Using \"$(ECHO_E)\" for \"echo -e\""
67
 
87
 

Loading…
Cancel
Save