Merge "Make LOCAL_SHORT_COMMANDS work on Darwin."
diff --git a/build/core/definitions.mk b/build/core/definitions.mk
index 997dc36..d57b77f 100644
--- a/build/core/definitions.mk
+++ b/build/core/definitions.mk
@@ -290,21 +290,21 @@
# $2: word list
#
define list-file-start-gen-10
- $$(hide) $$(HOST_ECHO) -n "$(call index-word-list,$10,$19,$2) " >> $$@
+ $$(hide) $$(HOST_ECHO_N) "$(call index-word-list,$10,$19,$2) " >> $$@
endef
# Used to generate a slice of always 10 items starting from index $1
# $1: start (tenth) index. CANNOT BE 0
# $2: word list
define list-file-always-gen-10
- $$(hide) $$(HOST_ECHO) -n "$(wordlist $10,$19,$2) " >> $$@
+ $$(hide) $$(HOST_ECHO_N) "$(wordlist $10,$19,$2) " >> $$@
endef
# Same as list-file-always-gen-10, except that the word list might be
# empty at position $10 (i.e. $(1)0)
define list-file-maybe-gen-10
ifneq ($(word $10,$2),)
- $$(hide) $$(HOST_ECHO) -n "$(wordlist $10,$19,$2) " >> $$@
+ $$(hide) $$(HOST_ECHO_N) "$(wordlist $10,$19,$2) " >> $$@
endif
endef
@@ -414,7 +414,7 @@
$$(__list_file).tmp:
@$$(call host-mkdir,$$(dir $$@))
- $$(hide) $$(HOST_ECHO) -n "" > $$@
+ $$(hide) $$(HOST_ECHO_N) "" > $$@
$(call list-file-maybe-gen-1000,0,$1)
$(call list-file-maybe-gen-1000,1,$1)
$(call list-file-maybe-gen-1000,2,$1)
diff --git a/build/core/init.mk b/build/core/init.mk
index 4614284..37187f8 100644
--- a/build/core/init.mk
+++ b/build/core/init.mk
@@ -255,7 +255,7 @@
HOST_MAKE := $(wildcard $(HOST_PREBUILT)/make$(HOST_EXEEXT))
endif
else
- $(call ndk_log,Host tols prebuilt directory not found, using system tools)
+ $(call ndk_log,Host tools prebuilt directory not found, using system tools)
endif
HOST_ECHO := $(strip $(HOST_ECHO))
@@ -271,6 +271,16 @@
endif
$(call ndk_log,Host 'echo' tool: $(HOST_ECHO))
+# Define HOST_ECHO_N to perform the equivalent of 'echo -n' on all platforms.
+ifeq ($(HOST_OS),windows)
+ # Our custom toolbox echo binary supports -n.
+ HOST_ECHO_N := $(HOST_ECHO) -n
+else
+ # On Posix, just use bare printf.
+ HOST_ECHO_N := printf %s
+endif
+$(call ndk_log,Host 'echo -n' tool: $(HOST_ECHO_N))
+
HOST_CMP := $(strip $(HOST_CMP))
ifndef HOST_CMP
HOST_CMP := $(strip $(wildcard $(NDK_ROOT)/prebuilt/$(HOST_TAG)/bin/cmp$(HOST_EXEEXT)))