Date: Wed, 15 Aug 2001 12:40:19 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Ruslan Ermilov <ru@FreeBSD.ORG> Cc: <current@FreeBSD.ORG>, Mark Peek <mark@whistle.com>, Warner Losh <imp@harmony.village.org> Subject: Re: Cross builds and upgrade path from 4.x are broken in usr.bin/file Message-ID: <20010815120844.C17139-100000@besplex.bde.org> In-Reply-To: <20010814203045.A60765@sunbay.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 14 Aug 2001, Ruslan Ermilov wrote: > On Tue, Aug 14, 2001 at 08:55:56AM -0700, David O'Brien wrote: > > >From a correctness stand point, building the .mgc files at install time > > is the correct thing to do... or maybe we should do both -- doing the > > [re]creation of the .mgc files at install time in the cross-[arch-]build > > case. Not both. > > +mkmagic: apprentice.c print-hacked.c > > + ${HOST_CC} -o mkmagic -DHAVE_CONFIG_H -DCOMPILE_ONLY \ > > + -I${.CURDIR} -I${SRCDIR} ${.ALLSRC} > > > Whoa, cool! > > That's what I wanted from the very beginning (-DCOMPILE_ONLY knob). > It then fits just nicely into the `build-tools' concept. And we > don't need this ugly HOST_CC hack for Makefile.inc1, as ${CC} is > set correctly during the `build-tools' stage. Let's don't reinvent > the wheel, and please try the attached patch instead. I agree (except the build-tools concept is a hack to work around build-tools binaries not being buildable and installable in the usual way (with 1 binary per Makefile)). > Index: usr.bin/file/Makefile > =================================================================== > RCS file: /home/ncvs/src/usr.bin/file/Makefile,v > retrieving revision 1.21 > diff -u -r1.21 Makefile > --- usr.bin/file/Makefile 2001/08/08 16:19:30 1.21 > +++ usr.bin/file/Makefile 2001/08/14 17:30:11 > @@ -34,23 +34,29 @@ > CFLAGS+= -DMAGIC='"${MAGICPATH}/magic"' -DBUILTIN_ELF -DELFCORE -DHAVE_CONFIG_H > CFLAGS+= -I${.CURDIR} -I${SRCDIR} > > -CLEANFILES+= magic magic.mgc magic.mime.mgc magic.mime.PITA > +CLEANFILES+= mkmagic magic magic.mgc magic.mime.mgc magic.mime.PITA CLEANFILES= magic magic.mgc magic.mime.mgc magic.mime.PITA mkmagic (This fixes disorder and the usual style bug for the initial assignment to CLEANFILES.) > > MAGFILES= ${SRCDIR}/Header\ > ${SRCDIR}/Localstuff\ > ${SRCDIR}/Magdir/[a-z]* > > -all: file magic magic.mgc magic.mime.mgc > +all: ${PROG} magic magic.mgc magic.mime.mgc all: magic magic.mgc magic.mime.mgc (Don't depend on `file' twice. Putting it first may have been a workaround for broken dependencies in an old version of the Makefile.) > +build-tools: mkmagic > + > +mkmagic: apprentice.c print-hacked.c > + ${CC} -DHAVE_CONFIG_H -DCOMPILE_ONLY \ > + -I${.CURDIR} -I${SRCDIR} -o ${.TARGET} ${.ALLSRC} This should use CFLAGS if possible, and should use LDFLAGS, something like: ${CC} -DCOMPILE_ONLY {CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} See sh/Makefile for other tweaks (depend on .o instead of .c ...). Other probems with this (generally shared with all build-tools binaries): - CFLAGS for the main binary may be inappropriate for the tools - missing dependencies on headers. > + > magic: ${MAGFILES} > cat ${.ALLSRC} > ${.TARGET} > > -magic.mgc: file magic > - ./${PROG} -C -m magic > +magic.mgc: mkmagic magic > + ./mkmagic magic > > -magic.mime.mgc: file magic.mime > +magic.mime.mgc: mkmagic magic.mime > ln -sf ${SRCDIR}/magic.mime magic.mime.PITA > - ./${PROG} -C -m magic.mime.PITA > + ./mkmagic magic.mime.PITA > mv magic.mime.PITA.mgc magic.mime.mgc > > CLEANFILES+= print-hacked.c Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010815120844.C17139-100000>