build modules using kernel config
Simon 'corecode' Schubert
corecode at fs.ei.tum.de
Mon Feb 7 16:49:46 PST 2005
a patch to build modules with kernel config, if modules are being built
together with kernel.
i'm running that since several months.
also available at:
<http://chlamydia.fs.ei.tum.de/~corecode/module_kernel_options.patch>
cheers
simon
--
/"\
\ /
\ ASCII Ribbon Campaign
/ \ Against HTML Mail and News
=== conf/kmod.mk
==================================================================
--- conf/kmod.mk (revision 6881)
+++ conf/kmod.mk (revision 6882)
@@ -215,11 +215,16 @@
${KMODUNLOAD} -v ${KMOD}
.endif
-.for _src in ${SRCS:Mopt_*.h}
+.for _src in ${SRCS:Mopt_*.h} ${SRCS:Muse_*.h}
CLEANFILES+= ${_src}
.if !target(${_src})
+.if defined(BUILDING_WITH_KERNEL) && exists(${BUILDING_WITH_KERNEL}/${_src})
+${_src}: ${BUILDING_WITH_KERNEL}/${_src}
+ ${INSTALL} ${BUILDING_WITH_KERNEL}/${_src} ${.TARGET}
+.else
${_src}:
touch ${.TARGET}
+.endif # BUILDING_WITH_KERNEL
.endif
.endfor
=== conf/Makefile.i386
==================================================================
--- conf/Makefile.i386 (revision 6881)
+++ conf/Makefile.i386 (revision 6882)
@@ -257,7 +257,7 @@
reinstall: modules-reinstall
.endif
-MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}
+MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR} BUILDING_WITH_KERNEL=${.OBJDIR}
.if defined(MODULES_OVERRIDE)
MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
.endif
=== net/stf/Makefile
==================================================================
--- net/stf/Makefile (revision 6881)
+++ net/stf/Makefile (revision 6882)
@@ -7,10 +7,12 @@
SRCS= if_stf.c opt_inet.h opt_inet6.h
NOMAN=
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > ${.TARGET}
opt_inet6.h:
echo "#define INET6 1" > ${.TARGET}
+.endif
.include <bsd.kmod.mk>
=== net/vlan/Makefile
==================================================================
--- net/vlan/Makefile (revision 6881)
+++ net/vlan/Makefile (revision 6882)
@@ -8,7 +8,9 @@
CFLAGS+= -DNVLAN=0
NOMAN=
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > ${.TARGET}
+.endif
.include <bsd.kmod.mk>
=== net/ip_mroute/Makefile
==================================================================
--- net/ip_mroute/Makefile (revision 6881)
+++ net/ip_mroute/Makefile (revision 6882)
@@ -10,7 +10,4 @@
opt_mrouting.h:
echo "#define MROUTING 1" > ${.TARGET}
-opt_random_ip_id.h:
- echo > ${.TARGET}
-
.include <bsd.kmod.mk>
=== net/gif/Makefile
==================================================================
--- net/gif/Makefile (revision 6881)
+++ net/gif/Makefile (revision 6882)
@@ -7,6 +7,7 @@
SRCS= if_gif.c in_gif.c in6_gif.c opt_inet.h opt_inet6.h opt_mrouting.h
NOMAN=
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > ${.TARGET}
@@ -15,5 +16,6 @@
opt_mrouting.h:
echo "#define MROUTING 1" > ${.TARGET}
+.endif
.include <bsd.kmod.mk>
=== net/faith/Makefile
==================================================================
--- net/faith/Makefile (revision 6881)
+++ net/faith/Makefile (revision 6882)
@@ -8,10 +8,12 @@
CFLAGS+= -DNFAITH=0
NOMAN=
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > ${.TARGET}
opt_inet6.h:
echo "#define INET6 1" > ${.TARGET}
+.endif
.include <bsd.kmod.mk>
=== net/gre/Makefile
==================================================================
--- net/gre/Makefile (revision 6881)
+++ net/gre/Makefile (revision 6882)
@@ -5,6 +5,7 @@
KMOD= if_gre
SRCS= if_gre.c ip_gre.c opt_inet.h opt_ns.h opt_atalk.h
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > ${.TARGET}
@@ -13,5 +14,6 @@
opt_atalk.h:
echo "#define NETATALK 1" > ${.TARGET}
+.endif
.include <bsd.kmod.mk>
=== net/sl/Makefile
==================================================================
--- net/sl/Makefile (revision 6881)
+++ net/sl/Makefile (revision 6882)
@@ -12,8 +12,10 @@
CFLAGS+= ${PROTOS}
CLEANFILES= use_sl.h
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > opt_inet.h
+.endif
use_sl.h:
echo "#define NSL ${NSL}" > use_sl.h
=== net/disc/Makefile
==================================================================
--- net/disc/Makefile (revision 6881)
+++ net/disc/Makefile (revision 6882)
@@ -10,10 +10,12 @@
CFLAGS+= ${PROTOS}
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > opt_inet.h
#opt_inet6.h:
# echo "#define INET6 1" > opt_inet6.h
+.endif
.include <bsd.kmod.mk>
=== net/pf/Makefile
==================================================================
--- net/pf/Makefile (revision 6881)
+++ net/pf/Makefile (revision 6882)
@@ -12,19 +12,15 @@
use_pflog.h:
echo "#define NPFLOG 1" > ${.TARGET}
+.if !defined(BUILDING_WITH_KERNEL)
use_pfsync.h:
-# .PATH searches only work for targes without source
-.if !exists(use_pfsync.h)
echo "#define NPFSYNC 0" > ${.TARGET}
-.endif
opt_inet.h:
echo "#define INET 1" > ${.TARGET}
opt_inet6.h:
-# .PATH searches only work for targes without source
-.if !exists(opt_inet6.h)
echo "#define INET6 1" > ${.TARGET}
-.endif
+.endif # !BUILDING_WITH_KERNEL
.include <bsd.kmod.mk>
=== net/sppp/Makefile
==================================================================
--- net/sppp/Makefile (revision 6881)
+++ net/sppp/Makefile (revision 6882)
@@ -16,6 +16,7 @@
sppp_isempty \
sppp_flush
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > opt_inet.h
@@ -24,5 +25,6 @@
opt_ipx.h:
echo "#define IPX 1" > opt_ipx.h
+.endif
.include <bsd.kmod.mk>
=== net/tap/Makefile
==================================================================
--- net/tap/Makefile (revision 6881)
+++ net/tap/Makefile (revision 6882)
@@ -12,7 +12,9 @@
CLEANFILES+= opt_inet.h
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > opt_inet.h
+.endif
.include <bsd.kmod.mk>
=== net/ef/Makefile
==================================================================
--- net/ef/Makefile (revision 6881)
+++ net/ef/Makefile (revision 6882)
@@ -20,11 +20,13 @@
CFLAGS+= -DEF_DEBUG
.endif
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > opt_inet.h
opt_ipx.h:
echo "#define IPX 1" > opt_ipx.h
+.endif
opt_ef.h:
.for frame in ETHER_II ETHER_8023 ETHER_8022 ETHER_SNAP
@@ -34,9 +36,9 @@
.endfor
load: all
- /sbin/kldload ./${PROG}
+ /sbin/kldload ${.OBJDIR}/${KMOD}
unload:
- /sbin/kldunload ${PROG}
+ -/sbin/kldunload ${KMOD}
.include <bsd.kmod.mk>
=== net/tun/Makefile
==================================================================
--- net/tun/Makefile (revision 6881)
+++ net/tun/Makefile (revision 6882)
@@ -11,6 +11,7 @@
CFLAGS+= ${PROTOS}
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > opt_inet.h
@@ -22,5 +23,6 @@
opt_ipx.h:
echo "#define IPX 1" > opt_ipx.h
+.endif
.include <bsd.kmod.mk>
=== vfs/smbfs/Makefile
==================================================================
--- vfs/smbfs/Makefile (revision 6881)
+++ vfs/smbfs/Makefile (revision 6882)
@@ -65,6 +65,6 @@
.endif
unload:
- @(if kldunload ${KMOD}; then true; else true; fi)
+ @-kldunload ${KMOD}
.include <bsd.kmod.mk>
=== vfs/nwfs/Makefile
==================================================================
--- vfs/nwfs/Makefile (revision 6881)
+++ vfs/nwfs/Makefile (revision 6882)
@@ -17,12 +17,12 @@
echo "#define NCP 1" > ${.TARGET}
load: nwfs.ko
- kldload ./nwfs.ko
+ kldload ${.OBJDIR}/nwfs.ko
unload:
- @(if kldunload nwfs; then true; else true; fi)
+ @-kldunload nwfs
deinstall:
- rm -f /modules/nwfs.ko
+ rm -f ${DESTDIR}/modules/nwfs.ko
.include <bsd.kmod.mk>
=== netgraph/iface/Makefile
==================================================================
--- netgraph/iface/Makefile (revision 6881)
+++ netgraph/iface/Makefile (revision 6882)
@@ -6,6 +6,7 @@
SRCS= ng_iface.c opt_atalk.h opt_inet.h opt_inet6.h opt_ipx.h
KMODDEPS= netgraph
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > opt_inet.h
@@ -17,5 +18,6 @@
opt_ipx.h:
echo "#define IPX 1" > opt_ipx.h
+.endif
.include <bsd.kmod.mk>
=== netproto/ncp/Makefile
==================================================================
--- netproto/ncp/Makefile (revision 6881)
+++ netproto/ncp/Makefile (revision 6882)
@@ -34,12 +34,12 @@
.endif
load: ${KMOD}.ko
- kldload ./${KMOD}.ko
+ kldload ${.OBJDIR}/${KMOD}.ko
unload:
- @(if kldunload ${KMOD}; then true; else true; fi)
+ @-kldunload ${KMOD}
deinstall:
- rm -f /modules/ncp.ko
+ rm -f ${DESTDIR}/modules/ncp.ko
.include <bsd.kmod.mk>
=== netproto/802_11/Makefile
==================================================================
--- netproto/802_11/Makefile (revision 6881)
+++ netproto/802_11/Makefile (revision 6882)
@@ -5,10 +5,12 @@
SRCS += ieee80211_node.c ieee80211_output.c ieee80211_proto.c
SRCS += bus_if.h device_if.h opt_inet.h opt_ipx.h
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > ${.TARGET}
opt_ipx.h:
echo "#define IPX 1" > ${.TARGET}
+.endif
.include <bsd.kmod.mk>
=== dev/crypto/ubsec/Makefile
==================================================================
--- dev/crypto/ubsec/Makefile (revision 6881)
+++ dev/crypto/ubsec/Makefile (revision 6882)
@@ -7,7 +7,9 @@
SRCS += device_if.h bus_if.h pci_if.h
SRCS += opt_bdg.h opt_bus.h crypto_if.h
+.if !defined(BUILDING_WITH_KERNEL)
opt_ubsec.h:
echo "#define UBSEC_DEBUG 1" > opt_ubsec.h
+.endif
.include <bsd.kmod.mk>
=== dev/crypto/hifn/Makefile
==================================================================
--- dev/crypto/hifn/Makefile (revision 6881)
+++ dev/crypto/hifn/Makefile (revision 6882)
@@ -7,7 +7,9 @@
SRCS += device_if.h bus_if.h pci_if.h
SRCS += opt_bdg.h opt_bus.h crypto_if.h
+.if !defined(BUILDING_WITH_KERNEL)
opt_hifn.h:
echo "#define HIFN_DEBUG 1" > opt_hifn.h
+.endif
.include <bsd.kmod.mk>
=== dev/disk/aic7xxx/ahc/Makefile
==================================================================
--- dev/disk/aic7xxx/ahc/Makefile (revision 6881)
+++ dev/disk/aic7xxx/ahc/Makefile (revision 6882)
@@ -35,7 +35,9 @@
CLEANFILES= ${GENSRCS} aic7xxx_reg_print.c
+.if !defined(BUILDING_WITH_KERNEL)
use_pci.h:
echo "#define NPCI 1" > use_pci.h
+.endif
.include <bsd.kmod.mk>
=== dev/disk/trm/Makefile
==================================================================
--- dev/disk/trm/Makefile (revision 6881)
+++ dev/disk/trm/Makefile (revision 6882)
@@ -7,7 +7,9 @@
SRCS= trm.c trm.h opt_cam.h device_if.h bus_if.h \
opt_scsi.h pci_if.h
+.if !defined(BUILDING_WITH_KERNEL)
opt_scsi.h:
echo "#define SCSI_DELAY 15000" > opt_scsi.h
+.endif
.include <bsd.kmod.mk>
=== dev/disk/aha/Makefile
==================================================================
--- dev/disk/aha/Makefile (revision 6881)
+++ dev/disk/aha/Makefile (revision 6882)
@@ -10,7 +10,9 @@
use_aha.h:
echo "#define NAHA 1" > use_aha.h
+.if !defined(BUILDING_WITH_KERNEL)
opt_scsi.h:
echo "#define SCSI_DELAY 15000" > opt_scsi.h
+.endif
.include <bsd.kmod.mk>
=== dev/misc/dcons/dcons/Makefile
==================================================================
--- dev/misc/dcons/dcons/Makefile (revision 6881)
+++ dev/misc/dcons/dcons/Makefile (revision 6882)
@@ -8,10 +8,12 @@
SRCS = dcons.c dcons_os.c
SRCS += dcons.h dcons_os.h opt_dcons.h opt_ddb.h opt_comconsole.h
+.if !defined(BUILDING_WITH_KERNEL)
opt_ddb.h:
- echo "#define DDB 1" > $@
+ echo "#define DDB 1" > ${.TARGET}
+.endif
opt_comconsole.h:
- echo "#define ALT_BREAK_TO_DEBUGGER 1" > $@
+ echo "#define ALT_BREAK_TO_DEBUGGER 1" > ${.TARGET}
.include <bsd.kmod.mk>
=== dev/usbmisc/ukbd/Makefile
==================================================================
--- dev/usbmisc/ukbd/Makefile (revision 6881)
+++ dev/usbmisc/ukbd/Makefile (revision 6882)
@@ -8,7 +8,9 @@
ukbd.c
NOMAN =
+.if !defined(BUILDING_WITH_KERNEL)
opt_kbd.h:
echo '#define KBD_INSTALL_CDEV 1' > opt_kbd.h
+.endif
.include <bsd.kmod.mk>
=== dev/netif/snc/Makefile
==================================================================
--- dev/netif/snc/Makefile (revision 6881)
+++ dev/netif/snc/Makefile (revision 6882)
@@ -6,7 +6,9 @@
SRCS = if_snc.c if_snc_cbus.c if_snc_pccard.c dp83932.c dp83932subr.c
SRCS += opt_inet.h opt_bdg.h device_if.h bus_if.h isa_if.h card_if.h
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > ${.TARGET}
+.endif
.include <bsd.kmod.mk>
=== dev/netif/ie/Makefile
==================================================================
--- dev/netif/ie/Makefile (revision 6881)
+++ dev/netif/ie/Makefile (revision 6882)
@@ -9,11 +9,13 @@
use_ie.h:
echo "#define NIE 1" > ${.TARGET}
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > ${.TARGET}
opt_ipx.h:
echo "" > ${.TARGET}
+.endif
.include <bsd.kmod.mk>
=== dev/netif/an/Makefile
==================================================================
--- dev/netif/an/Makefile (revision 6881)
+++ dev/netif/an/Makefile (revision 6882)
@@ -6,7 +6,9 @@
SRCS = if_an.c if_an_pccard.c if_an_pci.c if_an_isa.c
SRCS += opt_inet.h device_if.h bus_if.h pci_if.h isa_if.h card_if.h
+.if !defined(BUILDING_WITH_KERNEL)
opt_inet.h:
echo "#define INET 1" > opt_inet.h
+.endif
.include <bsd.kmod.mk>
=== dev/netif/em/Makefile
==================================================================
--- dev/netif/em/Makefile (revision 6881)
+++ dev/netif/em/Makefile (revision 6882)
@@ -5,9 +5,4 @@
SRCS = device_if.h bus_if.h pci_if.h opt_bdg.h
SRCS += if_em.c if_em_hw.c
-clean:
- rm -f opt_bdg.h device_if.h bus_if.h pci_if.h setdef*
- rm -f *.o *.kld *.ko
- rm -f @ machine
-
.include <bsd.kmod.mk>
Attachment:
pgp00001.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00001.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20050207/a81189bf/attachment-0018.obj>
More information about the Submit
mailing list