From owner-freebsd-current Tue Aug 14 19:43: 8 2001 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id A7D7937B40B; Tue, 14 Aug 2001 19:42:57 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id MAA09013; Wed, 15 Aug 2001 12:42:54 +1000 Date: Wed, 15 Aug 2001 12:40:19 +1000 (EST) From: Bruce Evans X-X-Sender: To: Ruslan Ermilov Cc: , Mark Peek , Warner Losh Subject: Re: Cross builds and upgrade path from 4.x are broken in usr.bin/file In-Reply-To: <20010814203045.A60765@sunbay.com> Message-ID: <20010815120844.C17139-100000@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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