The escape sequence '\n' should be translated to a new line character
when printed to version.cpp. Default mode might be implementation
dependent. At least in Fedora /usr/bin/echo defaults to -E. On the
other hand older versions might not support the -e option that enables
backslash escapes where it is not default.
Split the command into two, one for each output line, which should
produce same output on all platforms.
$(built_dist_files)
ifneq ($(shell sed 's/.*"\(.*\)".*/\1/' src/version.cpp 2>/dev/null),$(version))
- $(shell echo 'extern const char CCACHE_VERSION[];\nconst char CCACHE_VERSION[] = "$(version)";' >src/version.cpp)
+ $(shell echo 'extern const char CCACHE_VERSION[];' >src/version.cpp)
+ $(shell echo 'const char CCACHE_VERSION[] = "$(version)";' >>src/version.cpp)
endif
src/version.o: src/version.cpp