On Tue, Aug 14, 2001 at 08:55:56AM -0700, David O'Brien wrote:
> On Tue, Aug 14, 2001 at 09:54:04AM +0300, Ruslan Ermilov wrote:
> > > They produce the same output, but in the general case they do not need
> > > to.
> > 
> > What I hear?  Hell, then my solution (or something similar) should be
> > committed, as it at least unbreaks the 4.x -> 5.0 upgrade path, which
> > I am mostly concerned about (on the same arch).
> I never said they weren't the same format nor that it wouldn't be fixed.
> I said I wanted to try some things.  NetBSD something simular to the
> patch below in their usr.bin/file/Makefile -- they build the .mgc files
> during build time.  The patch to src/Makefile.inc is one way to implement
> the needed hooks.

> >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.
Just to clarify.  Nothing should be built in ${.OBJDIR} at install time,
as it may be read-only.  The build in ${DESTDIR} is allowed, we, for
example, execute makewhatis(1) at the end of `installworld'.  But this
"build" is implicit, i.e., it's not done by make dependencies.  And
also note that only bootstrap-tools and utilities copied to the
${TMPPATH} as the first step of `installworld' are allowed during

> +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.

Ruslan Ermilov          Oracle Developer/DBA,
[EMAIL PROTECTED]           Sunbay Software AG,
[EMAIL PROTECTED]          FreeBSD committer,
+380.652.512.251        Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age
Index: Makefile.inc1
RCS file: /home/ncvs/src/Makefile.inc1,v
retrieving revision 1.208
diff -u -r1.208 Makefile.inc1
--- Makefile.inc1       2001/08/04 18:25:38     1.208
+++ Makefile.inc1       2001/08/14 17:30:11
@@ -600,7 +600,8 @@
 .for _tool in bin/csh bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
-    ${_libroken4} ${_libkrb5} lib/libncurses ${_share} usr.sbin/sysinstall
+    ${_libroken4} ${_libkrb5} lib/libncurses ${_share} usr.bin/file \
+    usr.sbin/sysinstall
        cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
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 @@
-CLEANFILES+=   magic magic.mgc magic.mime.mgc magic.mime.PITA
+CLEANFILES+=   mkmagic magic magic.mgc magic.mime.mgc magic.mime.PITA
 MAGFILES=      ${SRCDIR}/Header\
-all: file magic magic.mgc magic.mime.mgc
+all: ${PROG} magic magic.mgc magic.mime.mgc
+build-tools: mkmagic
+mkmagic: apprentice.c print-hacked.c
+           -I${.CURDIR} -I${SRCDIR} -o ${.TARGET} ${.ALLSRC}
 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

Reply via email to