Change to kernel+modules build approach

From: Ruslan Ermilov <ru_at_freebsd.org>
Date: Thu, 14 Aug 2003 13:02:48 +0300
On Thu, Aug 14, 2003 at 02:10:19AM -0600, Scott Long wrote:
> Luoqi Chen wrote:
[...]
> >On the other hand, all modules should create all the opt_*.h files
> >it needs when built individually. Add opt_ddb.h to nullfs's Makefile
> >should fix the breakage.
> >
> Our kernel build system isn't set up to handle passing config options
> to modules.  Various solutions to this have been proposed, but nothing
> has appeared yet.  In 5.x, we document that modules will not work with
> PAE.
> 
How does the below look?  This is basically a more generic implementation
of Luoqi's idea, but for -CURRENT:

%%%
Index: kern.pre.mk
===================================================================
RCS file: /home/ncvs/src/sys/conf/kern.pre.mk,v
retrieving revision 1.33
diff -u -r1.33 kern.pre.mk
--- kern.pre.mk	30 Jul 2003 22:11:36 -0000	1.33
+++ kern.pre.mk	14 Aug 2003 09:39:30 -0000
_at__at_ -91,6 +91,7 _at__at_
 # them.
 
 MKMODULESENV=	MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR}
+MKMODULESENV+=	KERNOBJDIR=${.OBJDIR}
 .if (${KERN_IDENT} == LINT)
 MKMODULESENV+=	ALL_MODULES=LINT
 .endif
Index: kmod.mk
===================================================================
RCS file: /home/ncvs/src/sys/conf/kmod.mk,v
retrieving revision 1.139
diff -u -r1.139 kmod.mk
--- kmod.mk	26 Jul 2003 02:27:50 -0000	1.139
+++ kmod.mk	14 Aug 2003 09:42:52 -0000
_at__at_ -241,6 +241,10 _at__at_
 	${KMODUNLOAD} -v ${KMOD}
 .endif
 
+.if defined(KERNOBJDIR) && !empty(KERNOBJDIR) && exists(${KERNOBJDIR})
+.PATH: ${KERNOBJDIR}
+CFLAGS+=	-I${KERNOBJDIR}
+.else
 .for _src in ${SRCS:Mopt_*.h}
 CLEANFILES+=	${_src}
 .if !target(${_src})
_at__at_ -248,6 +252,7 _at__at_
 	touch ${.TARGET}
 .endif
 .endfor
+.endif
 
 MFILES?= kern/bus_if.m kern/device_if.m dev/iicbus/iicbb_if.m \
     dev/iicbus/iicbus_if.m isa/isa_if.m \
%%%


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA,
ru_at_sunbay.com		Sunbay Software Ltd,
ru_at_FreeBSD.org		FreeBSD committer

Received on Thu Aug 14 2003 - 01:04:00 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:18 UTC