Browse Source

Another (hopefully more robust) attempt to find a usable substitute

for "echo -e" on the host system.
tags/v0.9.3
Michael Brown 17 years ago
parent
commit
a8bddfe153
2 changed files with 30 additions and 26 deletions
  1. 2
    19
      src/Makefile
  2. 28
    7
      src/Makefile.housekeeping

+ 2
- 19
src/Makefile View File

@@ -1,6 +1,6 @@
1 1
 # Initialise variables that get added to throughout the various Makefiles
2 2
 #
3
-MAKEDEPS	:= Makefile .toolcheck
3
+MAKEDEPS	:= Makefile .toolcheck .echocheck
4 4
 SRCDIRS		:=
5 5
 SRCS		:=
6 6
 NON_AUTO_SRCS	:=
@@ -9,24 +9,6 @@ ROMS		:=
9 9
 MEDIA		:=
10 10
 NON_AUTO_MEDIA	:=
11 11
 
12
-# Find a usable "echo -e" substitute.
13
-#
14
-ifeq ($(shell echo '\101'),A)
15
-ECHO		?= echo
16
-endif
17
-ifeq ($(shell echo -e '\101'),A)
18
-ECHO		?= echo -e
19
-endif
20
-ifeq ($(shell /bin/echo '\101'),A)
21
-ECHO		?= /bin/echo
22
-endif
23
-ifeq ($(shell /bin/echo -e '\101'),A)
24
-ECHO		?= /bin/echo -e
25
-endif
26
-ifndef ECHO
27
-ECHO		:= echo
28
-endif
29
-
30 12
 # Grab the central Config file.
31 13
 #
32 14
 MAKEDEPS	+= Config
@@ -90,6 +72,7 @@ RM		?= rm -f
90 72
 TOUCH		?= touch
91 73
 MKDIR		?= mkdir
92 74
 CP		?= cp
75
+ECHO		?= echo
93 76
 PERL		?= /usr/bin/perl
94 77
 CC		?= $(CROSS_COMPILE)gcc
95 78
 AS		?= $(CROSS_COMPILE)as

+ 28
- 7
src/Makefile.housekeeping View File

@@ -7,11 +7,6 @@
7 7
 #
8 8
 CLEANUP	:= $(BIN)/*.* # *.* to avoid catching the "CVS" directory
9 9
 
10
-# Show what we're using for "echo -e"
11
-#
12
-echo :
13
-	@$(ECHO) Using "$(ECHO)" to echo
14
-
15 10
 # Version number calculations 
16 11
 #
17 12
 VERSION_MAJOR	= 0
@@ -44,6 +39,32 @@ version :
44 39
 	@$(TOUCH) $@
45 40
 VERYCLEANUP	+= .toolcheck
46 41
 
42
+# Find a usable "echo -e" substitute.
43
+#
44
+TAB 		:= $(shell printf "\t")
45
+ifeq ($(shell echo '\t'),$(TAB))
46
+ECHO_E		?= echo
47
+endif
48
+ifeq ($(shell echo -e '\t'),$(TAB))
49
+ECHO_E		?= echo -e
50
+endif
51
+ifeq ($(shell /bin/echo '\t'),$(TAB))
52
+ECHO_E		?= /bin/echo
53
+endif
54
+ifeq ($(shell /bin/echo -e '\t'),$(TAB))
55
+ECHO_E		?= /bin/echo -e
56
+endif
57
+.echocheck :
58
+ifdef ECHO_E
59
+	$(TOUCH) $@
60
+else
61
+	@echo "No usable \"echo -e\" substitute found"
62
+	@exit 1
63
+endif
64
+VERYCLEANUP	+= .echocheck
65
+echo :
66
+	@$(ECHO) "Using \"$(ECHO_E)\" for \"echo -e\""
67
+
47 68
 # Build verbosity
48 69
 #
49 70
 ifeq ($(V),1)
@@ -126,7 +147,7 @@ define obj_template
126 147
 	@$(CPP) $(CFLAGS) $(CFLAGS_$(3)) $(CFLAGS_$(4)) -DOBJECT=$(4) \
127 148
 		-Wno-error -M $(1) -MT "$(4)_DEPS" -MG -MP | \
128 149
 		sed 's/_DEPS\s*:/_DEPS =/' >> $(2)
129
-	@$(ECHO) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
150
+	@$(ECHO_E) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
130 151
 		 '\n\t$$(QM)$(ECHO) "  [BUILD] $$@"\n' \
131 152
 		 '\n\t$$(RULE_$(3))\n' \
132 153
 		 '\nBOBJS += $$(BIN)/$(4).o\n' \
@@ -373,7 +394,7 @@ define media_template
373 394
 	@$(MKDIR) -p $(dir $(2))
374 395
 	@$(RM) $(2)
375 396
 	@$(TOUCH) $(2)
376
-	@$(ECHO) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
397
+	@$(ECHO_E) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
377 398
 		  '\n\t$$(QM)$(ECHO) "  [FINISH] $$@"' \
378 399
 		  '\n\t$$(Q)$$(CP) $$< $$@' \
379 400
 		  '\n\t$$(Q)$$(FINALISE_$(1))' \

Loading…
Cancel
Save