libmagic: Use HOST_CC when compiling hostprog used by build

The "mkmagic" program should be built with the host compiler.

Only use BTOOLSPATH if not building for host

Obtained from:	Juniper Networks, Inc.
Reviewed by:	sjg
Differential Revision:	https://reviews.freebsd.org/D44539
This commit is contained in:
Stephen J. Kiernan 2024-03-27 18:02:32 -04:00
parent a6d8dcb0d9
commit 39f6f6f1c6

View file

@ -59,12 +59,13 @@ magic.mgc: magic
CLEANFILES+= mkmagic
DEPENDOBJS+= mkmagic
build-tools: mkmagic
# For the non-dirdeps build, HOST_CC is CC by default
mkmagic: apprentice.c cdf_time.c encoding.c funcs.c magic.c print.c ${INCS} ${BUILD_TOOLS_META}
${CC:N${CCACHE_BIN}} ${CFLAGS} -DCOMPILE_ONLY ${LDFLAGS} -o ${.TARGET} \
${HOST_CC:N${CCACHE_BIN}} ${CFLAGS} -DCOMPILE_ONLY ${LDFLAGS} -o ${.TARGET} \
${.ALLSRC:N*.h:O:u} ${LDADD}
.endif
.if ${MK_DIRDEPS_BUILD} == "yes"
.if ${MK_DIRDEPS_BUILD} == "yes" && ${MACHINE} != "host"
BTOOLSPATH= ${HOST_OBJTOP}/${RELDIR}
.else
magic.mgc: mkmagic