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
 # Initialise variables that get added to throughout the various Makefiles
1
 # Initialise variables that get added to throughout the various Makefiles
2
 #
2
 #
3
-MAKEDEPS	:= Makefile .toolcheck
3
+MAKEDEPS	:= Makefile .toolcheck .echocheck
4
 SRCDIRS		:=
4
 SRCDIRS		:=
5
 SRCS		:=
5
 SRCS		:=
6
 NON_AUTO_SRCS	:=
6
 NON_AUTO_SRCS	:=
9
 MEDIA		:=
9
 MEDIA		:=
10
 NON_AUTO_MEDIA	:=
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
 # Grab the central Config file.
12
 # Grab the central Config file.
31
 #
13
 #
32
 MAKEDEPS	+= Config
14
 MAKEDEPS	+= Config
90
 TOUCH		?= touch
72
 TOUCH		?= touch
91
 MKDIR		?= mkdir
73
 MKDIR		?= mkdir
92
 CP		?= cp
74
 CP		?= cp
75
+ECHO		?= echo
93
 PERL		?= /usr/bin/perl
76
 PERL		?= /usr/bin/perl
94
 CC		?= $(CROSS_COMPILE)gcc
77
 CC		?= $(CROSS_COMPILE)gcc
95
 AS		?= $(CROSS_COMPILE)as
78
 AS		?= $(CROSS_COMPILE)as

+ 28
- 7
src/Makefile.housekeeping View File

7
 #
7
 #
8
 CLEANUP	:= $(BIN)/*.* # *.* to avoid catching the "CVS" directory
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
 # Version number calculations 
10
 # Version number calculations 
16
 #
11
 #
17
 VERSION_MAJOR	= 0
12
 VERSION_MAJOR	= 0
44
 	@$(TOUCH) $@
39
 	@$(TOUCH) $@
45
 VERYCLEANUP	+= .toolcheck
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
 # Build verbosity
68
 # Build verbosity
48
 #
69
 #
49
 ifeq ($(V),1)
70
 ifeq ($(V),1)
126
 	@$(CPP) $(CFLAGS) $(CFLAGS_$(3)) $(CFLAGS_$(4)) -DOBJECT=$(4) \
147
 	@$(CPP) $(CFLAGS) $(CFLAGS_$(3)) $(CFLAGS_$(4)) -DOBJECT=$(4) \
127
 		-Wno-error -M $(1) -MT "$(4)_DEPS" -MG -MP | \
148
 		-Wno-error -M $(1) -MT "$(4)_DEPS" -MG -MP | \
128
 		sed 's/_DEPS\s*:/_DEPS =/' >> $(2)
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
 		 '\n\t$$(QM)$(ECHO) "  [BUILD] $$@"\n' \
151
 		 '\n\t$$(QM)$(ECHO) "  [BUILD] $$@"\n' \
131
 		 '\n\t$$(RULE_$(3))\n' \
152
 		 '\n\t$$(RULE_$(3))\n' \
132
 		 '\nBOBJS += $$(BIN)/$(4).o\n' \
153
 		 '\nBOBJS += $$(BIN)/$(4).o\n' \
373
 	@$(MKDIR) -p $(dir $(2))
394
 	@$(MKDIR) -p $(dir $(2))
374
 	@$(RM) $(2)
395
 	@$(RM) $(2)
375
 	@$(TOUCH) $(2)
396
 	@$(TOUCH) $(2)
376
-	@$(ECHO) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
397
+	@$(ECHO_E) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
377
 		  '\n\t$$(QM)$(ECHO) "  [FINISH] $$@"' \
398
 		  '\n\t$$(QM)$(ECHO) "  [FINISH] $$@"' \
378
 		  '\n\t$$(Q)$$(CP) $$< $$@' \
399
 		  '\n\t$$(Q)$$(CP) $$< $$@' \
379
 		  '\n\t$$(Q)$$(FINALISE_$(1))' \
400
 		  '\n\t$$(Q)$$(FINALISE_$(1))' \

Loading…
Cancel
Save