kmod.mk: Use portable printf '%s' over non-portable echo -n

Whilst /bin/echo on macOS and Linux implement -n, as do the builtin
echos in bash and zsh, the builtin echo in dash does not, causing the
first line of the output to be -n foo rather than just foo, and there to
be an extra newline in the output and thus blank line, both of which
result in "Symbol ... is not present in *.kld" warnings appearing in the
build output (once for -n foo and once for the empty string for each
module where EXPORT_SYMS is a list of symbols).

MFC after:	1 week
This commit is contained in:
Jessica Clarke 2023-07-11 21:30:06 +01:00
parent 0dea4f064d
commit d1e44bc944

View File

@ -266,7 +266,7 @@ ${FULLPROG}: ${OBJS} ${BLOB_OBJS}
.if ${EXPORT_SYMS} == NO
:> export_syms
.elif !exists(${.CURDIR}/${EXPORT_SYMS})
echo -n "${EXPORT_SYMS:@s@$s${.newline}@}" > export_syms
printf '%s' "${EXPORT_SYMS:@s@$s${.newline}@}" > export_syms
.else
grep -v '^#' < ${EXPORT_SYMS} > export_syms
.endif