module opt_* building
Eivind Eklund
eivind at FreeBSD.org
Tue Jul 22 08:31:17 PDT 2003
On Mon, Jul 21, 2003 at 01:08:36AM -0700, John-Mark Gurney wrote:
> I recently realized that for kernel module building, we can simply create
> a symlink pointing to the opt_*.h file created by config. (See attached
> patch.)
>
> This only is part of the work. The problem is that the modules/Makefile's
> define a target, which needs to be overriden in the case of being built
> as part of the kernel, and left intact when building standalone.
>
> The only thing I can think of is to add a opt_xxx.h_def or something
> similar to the target in the modules/Makefile, and then add a dependancy
> on that target in the standalone case.
>
> I have thought about a way to automate building of these options. It'd
> require setting up a file with defaults to build from. Extending options
> files? Yet another place to list options doesn't seem like a good idea.
>
> Comments?
The attached patch is a year-old attempt to deal with the same case; I had
some problems with it, but don't remember what exactly it was (some weird
error, I remember...)
I'd think the infrastructure should probably be extended so each module
can contain a file 'config' which contains suitable kernel config fragments
to build that module, and which is run alongside a normal config for that
module. Not quite sure what implementation to use for this - possibly a
new way of running config(8) to generate a suitable build space for each
module?
Eivind.
-------------- next part --------------
Index: conf/Makefile.i386
===================================================================
RCS file: /home/ncvs/src/sys/conf/Makefile.i386,v
retrieving revision 1.255
diff -u -r1.255 Makefile.i386
--- conf/Makefile.i386 20 Feb 2002 23:35:49 -0000 1.255
+++ conf/Makefile.i386 2 Mar 2002 14:48:10 -0000
@@ -30,7 +30,8 @@
.endif
.include "$S/conf/kern.pre.mk"
-MKMODULESENV+= MACHINE=i386
+KERNCOMPILEDIR!=pwd
+MKMODULESENV+= MACHINE=i386 KERNCOMPILEDIR=${KERNCOMPILEDIR}
%BEFORE_DEPEND
Index: conf/kmod.mk
===================================================================
RCS file: /home/ncvs/src/sys/conf/kmod.mk,v
retrieving revision 1.113
diff -u -r1.113 kmod.mk
--- conf/kmod.mk 1 Mar 2002 01:21:29 -0000 1.113
+++ conf/kmod.mk 13 Mar 2002 14:13:20 -0000
@@ -93,15 +93,20 @@
.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S
-CFLAGS+= ${COPTS} -D_KERNEL ${CWARNFLAGS}
-CFLAGS+= -DKLD_MODULE
# Don't use any standard or source-relative include directories.
# Since -nostdinc will annull any previous -I paths, we repeat all
# such paths after -nostdinc. It doesn't seem to be possible to
# add to the front of `make' variable.
_ICFLAGS:= ${CFLAGS:M-I*}
-CFLAGS+= -nostdinc -I- ${INCLMAGIC} ${_ICFLAGS}
+#CFLAGS= ${COPTFLAGS} -D_KERNEL ${CWARNFLAGS}
+CFLAGS+= -D_KERNEL ${CWARNFLAGS}
+CFLAGS+= -DKLD_MODULE
+CFLAGS+= -nostdinc -I- ${INCLMAGIC}
+.if defined(KERNCOMPILEDIR)
+CFLAGS+= -I. -I${KERNCOMPILEDIR} -include ${KERNCOMPILEDIR}/opt_global.h
+.endif
+CFLAGS+=${_ICFLAGS}
# Add -I paths for system headers. Individual KLD makefiles don't
# need any -I paths for this. Similar defaults for .PATH can't be
More information about the freebsd-arch
mailing list