diff options
author | imp <imp@FreeBSD.org> | 2015-02-18 15:25:19 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2015-02-18 15:25:19 +0000 |
commit | ab9283f7d9180c8196ed03c9f60345cb00f3c0a9 (patch) | |
tree | 52da14dd30d828be68905ff4666744e28ea65330 | |
parent | 75e9c3ad51daec10b9f0da49d7f3d9a57e432d67 (diff) | |
download | FreeBSD-src-ab9283f7d9180c8196ed03c9f60345cb00f3c0a9.zip FreeBSD-src-ab9283f7d9180c8196ed03c9f60345cb00f3c0a9.tar.gz |
Populate new KERN_OPTS from all the opt_*.h files in
KERNBUILDDIR. Come up with some sensible defaults (though listing them
in kmod.mk may be unwise -- we have no easy way to know what are the
best sensible defaults for everything so we just catch the big stuff).
Append SRCS.${opt} for each option in KERN_OPTS to SRCS to allow easy
conditional compilation. Append any notion of KERN_OPTS_EXTRA to the
list of kernel opts.
Differential Revision: https://reviews.freebsd.org/D1530
-rw-r--r-- | sys/conf/config.mk | 54 | ||||
-rw-r--r-- | sys/conf/kmod.mk | 34 | ||||
-rw-r--r-- | sys/modules/Makefile | 4 |
3 files changed, 64 insertions, 28 deletions
diff --git a/sys/conf/config.mk b/sys/conf/config.mk new file mode 100644 index 0000000..b95b781 --- /dev/null +++ b/sys/conf/config.mk @@ -0,0 +1,54 @@ +# $FreeBSD$ +# +# Common code to marry kernel config(8) goo and module building goo. +# + +# Generate options files that otherwise would be built +# in substantially similar ways through the tree. Move +# the code here when they all produce identical results +# (or should) +.if !defined(KERNBUILDDIR) +opt_bpf.h: + echo "#define DEV_BPF 1" > ${.TARGET} +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} + @echo "#define TCP_OFFLOAD 1" >> ${.TARGET} +.endif +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.if ${MK_EISA} != "no" +opt_eisa.h: + @echo "#define DEV_EISA 1" > ${.TARGET} +.endif +opt_mrouting.h: + echo "#define MROUTING 1" > ${.TARGET} +opt_natm.h: + echo "#define NATM 1" > ${.TARGET} +opt_scsi.h: + echo "#define SCSI_DELAY 15000" > ${.TARGET} +opt_wlan.h: + echo "#define IEEE80211_DEBUG 1" > ${.TARGET} + echo "#define IEEE80211_AMPDU_AGE 1" >> ${.TARGET} + echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET} +KERN_OPTS.i386=NEW_PCIB DEV_PCI +KERN_OPTS.pc98=NEW_PCIB DEV_PCI +KERN_OPTS.amd64=NEW_PCIB DEV_PCI +KERN_OPTS.powerpc=NEW_PCIB DEV_PCI +KERN_OPTS=MROUTING NATM IEEE80211_DEBUG \ + IEEE80211_AMPDU_AGE IEEE80211_SUPPORT_MESH DEV_BPF \ + ${KERN_OPTS.${MACHINE}} ${KERN_OPTS_EXTRA} +.if ${MK_INET_SUPPORT} != "no" +KERN_OPTS+= INET TCP_OFFLOAD +.endif +.if ${MK_INET6_SUPPORT} != "no" +KERN_OPTS+= INET6 +.endif +.if ${MK_EISA} != "no" +KERN_OPTS+= DEV_EISA +.endif +.else +KERN_OPTS!=cat ${KERNBUILDDIR}/opt*.h | awk '{print $$2;}' | sort -u +.endif diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 91d4f49..2296e44 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -70,6 +70,7 @@ OBJCOPY?= objcopy # do this after bsd.own.mk. .include "kern.opts.mk" .include <bsd.compiler.mk> +.include "config.mk" .SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S @@ -163,6 +164,11 @@ OBJS+= ${_firmw:C/\:.*$/.fwo/} .endfor .endif +# Conditionally include SRCS based on kernel config options. +.for _o in ${KERN_OPTS} +SRCS+=${SRCS.${_o}} +.endfor + OBJS+= ${SRCS:N*.h:R:S/$/.o/g} .if !defined(PROG) @@ -316,34 +322,6 @@ unload: ${KMODUNLOAD} -v ${PROG} .endif -# Generate options files that otherwise would be built -# in substantially similar ways through the tree. Move -# the code here when they all produce identical results -# (or should) -.if !defined(KERNBUILDDIR) -opt_bpf.h: - echo "#define DEV_BPF 1" > ${.TARGET} -.if ${MK_INET_SUPPORT} != "no" -opt_inet.h: - @echo "#define INET 1" > ${.TARGET} - @echo "#define TCP_OFFLOAD 1" >> ${.TARGET} -.endif -.if ${MK_INET6_SUPPORT} != "no" -opt_inet6.h: - @echo "#define INET6 1" > ${.TARGET} -.endif -opt_mrouting.h: - echo "#define MROUTING 1" > ${.TARGET} -opt_natm.h: - echo "#define NATM 1" > ${.TARGET} -opt_scsi.h: - echo "#define SCSI_DELAY 15000" > ${.TARGET} -opt_wlan.h: - echo "#define IEEE80211_DEBUG 1" > ${.TARGET} - echo "#define IEEE80211_AMPDU_AGE 1" >> ${.TARGET} - echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET} -.endif - .if defined(KERNBUILDDIR) .PATH: ${KERNBUILDDIR} CFLAGS+= -I${KERNBUILDDIR} diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 7f917d6..f4348b8 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -751,4 +751,8 @@ afterinstall: fi .endif +.include "${SYSDIR}/conf/config.mk" + +SUBDIR:= ${SUBDIR:u:O} + .include <bsd.subdir.mk> |