AIX and OS X (and maybe BSD) sh has a built-in echo which doesn’t support the -n flag (OS X sh is actually bash but it doesn’t support -n based on compile-time flags and the POSIXLY_CORRECT environment variable).

AIX /bin/echo doesn’t support -n.

AIX echo and OS X /bin/echo support \c to prevent a trailing newline but linux echo (bash builtin and /bin/echo) don’t support it unless you also use the -e flag (which is not support by AIX /bin/echo or OS X sh or /bin/echo).

The BSD echo man page suggests using printf to avoid trailing newline, which is available on linux, OS X, and AIX.
This commit is contained in:
Kelvin Sherlock 2017-05-22 13:44:53 -04:00
parent 88eec86d1a
commit 9913c1dcb8

View File

@ -92,7 +92,7 @@ CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare
endif
GIT_VERSION := $(shell [ -e .git ] && { echo -n git- ; git describe --tags --always --dirty ; } || echo $(VERSION))
GIT_VERSION := $(shell [ -e .git ] && { printf git- ; git describe --tags --always --dirty ; } || echo $(VERSION))
ifneq ($(GIT_VERSION),)
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
endif