Remove dependence on source tree options. Move all kernel module

options into kern.opts.mk and change all the places where we use
src.opts.mk to pull in the options. Conditionally define SYSDIR and
use SYSDIR/conf/kern.opts.mk instead of a CURDIR path. Replace all
instances of CURDIR/../../etc with STSDIR, but only in the affected
files.

As a special compatibility hack, include bsd.owm.mk at the top of
kern.opts.mk to allow the bare build of sys/modules to work on older
systems. If the defaults ever change between 9.x, 10.x and current for
these options, however, you'll wind up with the host OS' defaults
rather than the -current defaults. This hack will be removed when
we no longer need to support this build scenario.

Reviewed by: jhb
Differential Revision: https://phabric.freebsd.org/D529
This commit is contained in:
Warner Losh 2014-08-11 14:50:49 +00:00
parent fd162ebf38
commit df3394b3de
14 changed files with 76 additions and 29 deletions

View File

@ -11,19 +11,42 @@
# that haven't been converted over.
#
# Note: bsd.own.mk must be included before the rest of kern.opts.mk to make
# building on 10.x and earlier work. This should be removed when that's no
# longer supported since it confounds the defaults (since it uses the host's
# notion of defaults rather than what's default in current when building
# within sys/modules).
.include <bsd.own.mk>
# These options are used by the kernel build process (kern.mk and kmod.mk)
# They have to be listed here so we can build modules outside of the
# src tree.
__DEFAULT_YES_OPTIONS = \
ARM_EABI \
BLUETOOTH \
CDDL \
CRYPT \
FORMAT_EXTENSIONS \
INET \
INET6 \
KERNEL_SYMBOLS
IPFILTER \
KERNEL_SYMBOLS \
NETGRAPH \
PF \
SOURCELESS_HOST \
SOURCELESS_UCODE \
USB_GADGET_EXAMPLES \
ZFS
# expanded inline from bsd.mkopt.mk:
__DEFAULT_NO_OPTIONS = \
EISA \
NAND \
OFED
# expanded inline from bsd.mkopt.mk to avoid share/mk dependency
# Those that default to yes
.for var in ${__DEFAULT_YES_OPTIONS}
.if !defined(MK_${var})
.if defined(WITHOUT_${var}) # WITHOUT always wins
@ -35,6 +58,18 @@ MK_${var}:= yes
.endfor
.undef __DEFAULT_YES_OPTIONS
# Those that default to no
.for var in ${__DEFAULT_NO_OPTIONS}
.if !defined(MK_${var})
.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins
MK_${var}:= yes
.else
MK_${var}:= no
.endif
.endif
.endfor
.undef __DEFAULT_NO_OPTIONS
#
# MK_*_SUPPORT options which default to "yes" unless their corresponding
# MK_* variable is set to "no".

View File

@ -1,6 +1,7 @@
# $FreeBSD$
.include <src.opts.mk>
SYSDIR?=${.CURDIR}/..
.include "${SYSDIR}/conf/kern.opts.mk"
SUBDIR_PARALLEL=

View File

@ -1,9 +1,10 @@
# $FreeBSD$
.include <src.opts.mk>
SYSDIR?=${.CURDIR}/../../..
.include "${SYSDIR}/conf/kern.opts.mk"
.PATH: ${.CURDIR}/../../../dev/aic7xxx
.PATH: ${SYSDIR}/dev/aic7xxx
KMOD= ahc
.if ${MK_EISA} != "no"
SUBDIR+= ahc_eisa
@ -20,20 +21,20 @@ REG_PRINT_OPT= -p aic7xxx_reg_print.c
.endif
BEFORE_DEPEND = ${GENSRCS}
../aicasm/aicasm: ${.CURDIR}/../../../dev/aic7xxx/aicasm/*.[chyl]
../aicasm/aicasm: ${SYSDIR}/dev/aic7xxx/aicasm/*.[chyl]
( cd ${.CURDIR}/../aicasm; ${MAKE} aicasm; )
.if make(ahcfirmware)
ahcfirmware: ${GENSRCS}
${GENSRCS}: \
${.CURDIR}/../../../dev/aic7xxx/aic7xxx.{reg,seq} \
${.CURDIR}/../../../cam/scsi/scsi_message.h
../aicasm/aicasm ${INCLUDES} -I${.CURDIR}/../../../cam/scsi \
-I${.CURDIR}/../../../dev/aic7xxx \
${SYSDIR}/dev/aic7xxx/aic7xxx.{reg,seq} \
${SYSDIR}/cam/scsi/scsi_message.h
../aicasm/aicasm ${INCLUDES} -I${SYSDIR}/cam/scsi \
-I${SYSDIR}/dev/aic7xxx \
-o aic7xxx_seq.h -r aic7xxx_reg.h \
${REG_PRINT_OPT} \
-i ${.CURDIR}/../../../dev/aic7xxx/aic7xxx_osm.h \
${.CURDIR}/../../../dev/aic7xxx/aic7xxx.seq
-i ${SYSDIR}/dev/aic7xxx/aic7xxx_osm.h \
${SYSDIR}/dev/aic7xxx/aic7xxx.seq
.else
${GENSRCS}:
@echo "Error: ${.TARGET} is missing. Run 'make ahcfirmware'"

View File

@ -1,6 +1,7 @@
# $FreeBSD$
.include <src.opts.mk>
SYSDIR?=${.CURDIR}/../..
.include "${SYSDIR}/conf/kern.opts.mk"
SUBDIR= cxgb
SUBDIR+= cxgb_t3fw

View File

@ -2,7 +2,8 @@
# $FreeBSD$
#
.include <src.opts.mk>
SYSDIR?=${.CURDIR}/../..
.include "${SYSDIR}/conf/kern.opts.mk"
SUBDIR= if_cxgbe
SUBDIR+= t4_firmware

View File

@ -1,8 +1,9 @@
# $FreeBSD$
.include <src.opts.mk>
SYSDIR?=${.CURDIR}/../..
.include "${SYSDIR}/conf/kern.opts.mk"
.PATH: ${.CURDIR}/../../dev/dpt
.PATH: ${SYSDIR}/dev/dpt
KMOD= dpt
SRCS= dpt_scsi.c dpt.h \
dpt_pci.c pci_if.h \

View File

@ -1,6 +1,7 @@
# $FreeBSD$
.include <src.opts.mk>
SYSDIR?=${.CURDIR}/../..
.include "${SYSDIR}/conf/kern.opts.mk"
# Modules that include binary-only blobs of microcode should be selectable by
# MK_SOURCELESS_UCODE option (see below).

View File

@ -1,7 +1,7 @@
# $FreeBSD$
.include <src.opts.mk>
.include <bsd.own.mk>
SYSDIR?=${.CURDIR}/../..
.include "${SYSDIR}/conf/kern.opts.mk"
.if ${MACHINE_CPUARCH} == "amd64"
_radeonkms= radeonkms

View File

@ -1,8 +1,9 @@
# $FreeBSD$
.include <src.opts.mk>
SYSDIR?=${.CURDIR}/../..
.include "${SYSDIR}/conf/kern.opts.mk"
.PATH: ${.CURDIR}/../../dev/ep
.PATH: ${SYSDIR}/dev/ep
KMOD= if_ep
SRCS= if_ep.c

View File

@ -1,8 +1,9 @@
# $FreeBSD$
.include <src.opts.mk>
SYSDIR?=${.CURDIR}/../..
.include "${SYSDIR}/conf/kern.opts.mk"
.PATH: ${.CURDIR}/../../net ${.CURDIR}/../../netinet ${.CURDIR}/../../netinet6
.PATH: ${SYSDIR}/net ${SYSDIR}/netinet ${SYSDIR}/netinet6
KMOD= if_gif
SRCS= if_gif.c in_gif.c opt_inet.h opt_inet6.h opt_mrouting.h

View File

@ -1,7 +1,8 @@
# $Whistle: Makefile,v 1.5 1999/01/24 06:48:37 archie Exp $
# $FreeBSD$
.include <src.opts.mk>
SYSDIR?=${.CURDIR}/../..
.include "${SYSDIR}/conf/kern.opts.mk"
SUBDIR= async \
atm \
@ -57,7 +58,7 @@ SUBDIR= async \
_bluetooth= bluetooth
.endif
.if ${MK_CRYPT} != "no" && exists(${.CURDIR}/../../crypto/rc4/rc4.c)
.if ${MK_CRYPT} != "no" && exists(${SYSDIR}/crypto/rc4/rc4.c)
_mppc= mppc
.endif

View File

@ -1,6 +1,7 @@
# $FreeBSD$
.include <src.opts.mk>
SYSDIR?=${.CURDIR}/../../..
.include "${SYSDIR}/conf/kern.opts.mk"
# Modules that include binary-only blobs of microcode should be selectable by
# MK_SOURCELESS_UCODE option (see below).

View File

@ -25,7 +25,8 @@
# SUCH DAMAGE.
#
.include <src.opts.mk>
SYSDIR?=${.CURDIR}/../..
.include "${SYSDIR}/conf/kern.opts.mk"
#
# Check for common USB debug flags to pass when building the USB

View File

@ -1,8 +1,9 @@
# $FreeBSD$
.include <src.opts.mk>
SYSDIR?=${.CURDIR}/../..
.include "${SYSDIR}/conf/kern.opts.mk"
.PATH: ${.CURDIR}/../../dev/vx
.PATH: ${SYSDIR}/dev/vx
KMOD= if_vx
SRCS= if_vx.c if_vx_pci.c