Subject: honoring KERNOBJDIR for install floppy builds
To: None <port-i386@netbsd.org>
From: John Kohl <jtk@kolvir.arlington.ma.us>
List: port-i386
Date: 04/16/2000 18:39:48
I'd like to get the floppy builds to honor KERNOBJDIR for i386.
However, I'm not sure about the right makefile changes to do this.

I've done one version, but unfortunately due to the order of inclusion
of various files and bindings of variables it requires me to .include
"/etc/mk.conf" explicitly, which seems wrong.

I'd like to do something like this in each floppy Makefile:

KERNOBJDIR?=	${.CURDIR}/../../../../sys/arch/i386/compile
KERN?=	${KERNOBJDIR}/INSTALL/netbsd

(or rather, put the conditional KERNOBJDIR into Makefile.inc)

but due to make variable binding order, this doesn't work right since
mk.conf is included after these definitions.  Even if mk.conf
unconditionally defines KERNOBJDIR=/blah, KERN is bound to the old
expansion of KERNOBJDIR.

Is this the way make should work?  (I'd expected it to expand ${KERNOBJDIR}
when ${KERN} gets evaluated, not when it gets defined.)

Anyway, here's what I've come up with.  Is there a better way to do
this?

diff -r -c ./Makefile.inc /usr/src/distrib/i386/floppies/Makefile.inc
*** ./Makefile.inc	Sat Jun 14 14:56:01 1997
--- /usr/src/distrib/i386/floppies/Makefile.inc	Sat Apr 15 10:17:12 2000
***************
*** 4,6 ****
--- 4,9 ----
  # VER is revision with dots, as in "1.2C"
  REV!=sh ${.CURDIR}/../../../../sys/conf/osrelease.sh -s
  VER!=sh ${.CURDIR}/../../../../sys/conf/osrelease.sh 
+ .include "/etc/mk.conf"
+ KERNOBJDIR?=	${.CURDIR}/../../../../sys/arch/i386/compile
+ 
diff -r -c ./bootfloppy/Makefile /usr/src/distrib/i386/floppies/bootfloppy/Makefile
*** ./bootfloppy/Makefile	Tue Mar 23 13:10:57 1999
--- /usr/src/distrib/i386/floppies/bootfloppy/Makefile	Sat Apr 15 10:19:09 2000
***************
*** 5,10 ****
  .include "${TOP}/Makefile.inc"
  
  IMAGE=		boot.fs
! KERN?=	${.CURDIR}/../../../../sys/arch/i386/compile/INSTALL/netbsd
  
  .include "${TOP}/bootfloppy-common/Makefile.inc"
--- 5,10 ----
  .include "${TOP}/Makefile.inc"
  
  IMAGE=		boot.fs
! KERN?=	${KERNOBJDIR}/INSTALL/netbsd
  
  .include "${TOP}/bootfloppy-common/Makefile.inc"
diff -r -c ./bootfloppy-big/Makefile /usr/src/distrib/i386/floppies/bootfloppy-big/Makefile
*** ./bootfloppy-big/Makefile	Tue Mar 23 13:10:58 1999
--- /usr/src/distrib/i386/floppies/bootfloppy-big/Makefile	Sat Apr 15 10:17:37 2000
***************
*** 5,11 ****
  .include "${TOP}/Makefile.inc"
  
  IMAGE=		boot-big.fs
! KERN?=	${.CURDIR}/../../../../sys/arch/i386/compile/INSTALL/netbsd
  
  # This Makefile builds a boot image on a 2.88M-sized image.
  #
--- 5,11 ----
  .include "${TOP}/Makefile.inc"
  
  IMAGE=		boot-big.fs
! KERN?=	${KERNOBJDIR}/INSTALL/netbsd
  
  # This Makefile builds a boot image on a 2.88M-sized image.
  #
diff -r -c ./bootfloppy-small/Makefile /usr/src/distrib/i386/floppies/bootfloppy-small/Makefile
*** ./bootfloppy-small/Makefile	Tue Mar 23 13:10:59 1999
--- /usr/src/distrib/i386/floppies/bootfloppy-small/Makefile	Sat Apr 15 10:19:02 2000
***************
*** 5,11 ****
  .include "${TOP}/Makefile.inc"
  
  IMAGE=	boot-small.fs
! KERN?=	${.CURDIR}/../../../../sys/arch/i386/compile/INSTALL_SMALL/netbsd
  DISKTYPE=	floppy5
  DISKSIZE=	2400
  
--- 5,11 ----
  .include "${TOP}/Makefile.inc"
  
  IMAGE=	boot-small.fs
! KERN?=	${KERNOBJDIR}/INSTALL_SMALL/netbsd
  DISKTYPE=	floppy5
  DISKSIZE=	2400
  
diff -r -c ./bootfloppy-tiny/Makefile /usr/src/distrib/i386/floppies/bootfloppy-tiny/Makefile
*** ./bootfloppy-tiny/Makefile	Tue Mar 23 13:10:59 1999
--- /usr/src/distrib/i386/floppies/bootfloppy-tiny/Makefile	Sat Apr 15 10:19:13 2000
***************
*** 5,11 ****
  .include "${TOP}/Makefile.inc"
  
  IMAGE=	boot-tiny.fs
! KERN?=	${.CURDIR}/../../../../sys/arch/i386/compile/INSTALL_TINY/netbsd
  DISKTYPE=	floppy5
  DISKSIZE=	2400
  
--- 5,11 ----
  .include "${TOP}/Makefile.inc"
  
  IMAGE=	boot-tiny.fs
! KERN?=	${KERNOBJDIR}/INSTALL_TINY/netbsd
  DISKTYPE=	floppy5
  DISKSIZE=	2400
  
diff -r -c ./fdset/Makefile /usr/src/distrib/i386/floppies/fdset/Makefile
*** ./fdset/Makefile	Tue Mar 23 13:10:59 1999
--- /usr/src/distrib/i386/floppies/fdset/Makefile	Sat Apr 15 10:17:17 2000
***************
*** 4,9 ****
  
  .include "${TOP}/Makefile.inc"
  
! KERN?=	${.CURDIR}/../../../../sys/arch/i386/compile/INSTALL/netbsd
  
  .include "${TOP}/fdset-common/Makefile.inc"
--- 4,9 ----
  
  .include "${TOP}/Makefile.inc"
  
! KERN?=	${KERNOBJDIR}/INSTALL/netbsd
  
  .include "${TOP}/fdset-common/Makefile.inc"