Subject: Re: CVS commit: basesrc
To: Antti Kantee <pooka@netbsd.org>
From: Simon J. Gerraty <sjg@quick.com.au>
List: tech-userlevel
Date: 03/28/2001 10:35:20
>New file(1) uses file -C to compile the magic database into a more
>efficient format. We therefore need both host & target binaries, the
>first to compile the magic database with and the latter for normal
>reasons.

I'd look at doing something like this:

.ifdef CROSS_COMPILE
HOST_TOOL=host-${PROG}

host-${PROG}:	${OBJS:S,.o,.lo,}
	${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC}
.endif
HOST_TOOL?=${PROG}


generated-file:	${HOST_PROG}
	${.OBJDIR}/${HOST_PROG} ...


We (netbsd) have a bsd.hostprog.mk but in my build at work I found it more 
convenient to include the handling of .lo and HOST_LINK.c etc 
in the normal *.mk

>Well, the real fun part is of course that we'd actually need to run the
>_target_ file binary to create a compiled database which is usable on
>the target.

That would be a bug in the design :-)
--sjg