cddl/*: add a WITH(OUT)_DTRACE option

Add an option to enable/disable DTrace without disabling ZFS.  New
architectures such as CHERI may support ZFS before they support DTrace
and the old model of WITHOUT_CDDL disabling both wasn't helpful.

For compatiblity, the CDDL option remains and WITHOUT_CDDL implies
WITHOUT_DTRACE.  WITHOUT_DTRACE also implies WITHOUT_CTF.

As part of this change, largely convert cddl/*/Makefile to using the
more compact SUBDIR.${MK_<FOO>}+= form rather than using intermediate
variables.

Reviewed by:	markj
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D35718
This commit is contained in:
Brooks Davis 2022-07-06 14:03:48 +01:00
parent 513e1bbc73
commit 3bf6636512
12 changed files with 86 additions and 88 deletions

View File

@ -2,39 +2,32 @@
.include <src.opts.mk>
SUBDIR= drti \
libavl \
.if ${MK_DTRACE} == yes || ${MK_ZFS} == yes
SUBDIR= libspl
.endif
SUBDIR.${MK_DTRACE}+= \
drti \
libctf \
libdtrace \
${_libicp} \
${_libicp_rescue} \
libnvpair \
libspl \
${_libtpool} \
libumem \
libuutil \
${_libzfs_core} \
${_libzfs} \
${_libzfsbootenv} \
${_libzpool} \
${_libzutil} \
${_pam_zfs_key}
libdtrace
SUBDIR.${MK_TESTS}+= tests
.if ${MK_ZFS} != "no"
_libzfs_core= libzfs_core
_libicp= libicp
_libicp_rescue= libicp_rescue
_libzfs= libzfs
_libzutil= libzutil
_libzfsbootenv= libzfsbootenv
_libzpool= libzpool
_libtpool= libtpool
.if ${MK_OPENSSL} != "no"
_pam_zfs_key= pam_zfs_key
.endif
.endif
SUBDIR.${MK_ZFS}+= \
libavl \
libicp \
libicp_rescue \
libnvpair \
libtpool \
libumem \
libuutil \
libzfs \
libzfs_core \
libzfsbootenv \
libzpool \
libzutil
SUBDIR.${MK_ZFS}.${MK_OPENSSL} = pam_zfs_key
SUBDIR_DEPEND_libavl= libspl
SUBDIR_DEPEND_libctf= libspl

View File

@ -2,14 +2,11 @@
.include <src.opts.mk>
SUBDIR= ${_zfs} ${_zpool}
SUBDIR.${MK_TESTS}+= tests
.if ${MK_ZFS} != "no"
_zfs= zfs
_zpool= zpool
.endif
SUBDIR.${MK_ZFS}+= \
zfs \
zpool
SUBDIR_PARALLEL=

View File

@ -2,11 +2,7 @@
.include <src.opts.mk>
SUBDIR= ${_zfs}
.if ${MK_ZFS} != "no"
_zfs= zfs
.endif
SUBDIR.${MK_ZFS}+= zfs
SUBDIR_PARALLEL=

View File

@ -2,21 +2,17 @@
.include <src.opts.mk>
SUBDIR= \
SUBDIR.${MK_DTRACE}+= \
ctfconvert \
ctfdump \
ctfmerge \
${_zinject} \
${_zstream} \
${_ztest}
ctfmerge
SUBDIR.${MK_TESTS}+= tests
.if ${MK_ZFS} != "no"
_zinject= zinject
_ztest= ztest
_zstream = zstream
.endif
SUBDIR.${MK_ZFS}+= \
zinject \
ztest \
zstream
SUBDIR_PARALLEL=

View File

@ -2,11 +2,8 @@
.include <src.opts.mk>
SUBDIR= ${_zpool_influxdb}
.if ${MK_ZFS} != "no"
_zpool_influxdb= zpool_influxdb
.endif
SUBDIR.${MK_ZFS}+= \
zpool_influxdb
SUBDIR_PARALLEL=

View File

@ -2,23 +2,19 @@
.include <src.opts.mk>
SUBDIR= ${_dtrace} \
SUBDIR.${MK_DTRACE}+= \
${_dtrace} \
${_dwatch} \
${_lockstat} \
${_plockstat} \
${_zdb} \
${_zfsd} \
${_zhack}
${_plockstat}
SUBDIR.${MK_TESTS}+= tests
.if ${MK_ZFS} != "no"
_zdb= zdb
_zhack= zhack
. if ${MK_CXX} != "no"
_zfsd= zfsd
. endif
.endif
SUBDIR.${MK_ZFS}+= \
zdb \
zhack
SUBDIR.${MK_ZFS}.${MK_CXX}+= \
zfsd
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
_dtrace= dtrace

View File

@ -1,6 +1,6 @@
.\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
.\" $FreeBSD$
.Dd June 22, 2022
.Dd July 6, 2022
.Dt SRC.CONF 5
.Os
.Sh NAME
@ -328,6 +328,8 @@ When set, it enforces these options:
.It
.Va WITHOUT_CTF
.It
.Va WITHOUT_DTRACE
.It
.Va WITHOUT_LOADER_ZFS
.It
.Va WITHOUT_ZFS
@ -612,6 +614,14 @@ Do not build dma Mail Transport Agent.
.It Va WITHOUT_DOCCOMPRESS
Do not install compressed system documentation.
Only the uncompressed version will be installed.
.It Va WITHOUT_DTRACE
Do not build DTrace framework kernel modules, libraries, and user commands.
When set, it enforces these options:
.Pp
.Bl -item -compact
.It
.Va WITHOUT_CTF
.El
.It Va WITH_DTRACE_TESTS
Build and install the DTrace test suite in
.Pa /usr/tests/cddl/usr.sbin/dtrace .

View File

@ -92,6 +92,7 @@ __DEFAULT_YES_OPTIONS = \
DIALOG \
DICT \
DMAGENT \
DTRACE \
DYNAMICROOT \
EE \
EFI \
@ -364,9 +365,10 @@ MK_SOURCELESS_UCODE:= no
.endif
.if ${MK_CDDL} == "no"
MK_ZFS:= no
MK_LOADER_ZFS:= no
MK_CTF:= no
MK_DTRACE:= no
MK_LOADER_ZFS:= no
MK_ZFS:= no
.endif
.if ${MK_CRYPT} == "no"
@ -389,6 +391,10 @@ MK_TESTS:= no
MK_BSDINSTALL:= no
.endif
.if ${MK_DTRACE} == "no"
MK_CTF:= no
.endif
.if ${MK_MAIL} == "no"
MK_MAILWRAPPER:= no
MK_SENDMAIL:= no

View File

@ -35,6 +35,7 @@ __DEFAULT_YES_OPTIONS = \
CDDL \
CRYPT \
CUSE \
DTRACE \
EFI \
FORMAT_EXTENSIONS \
INET \
@ -183,6 +184,10 @@ MK_${var}_SUPPORT:= yes
MK_KERNEL_SYMBOLS:= no
.endif
.if ${MK_CDDL} == "no"
MK_DTRACE:= no
.endif
# Some modules only compile successfully if option FDT is set, due to #ifdef FDT
# wrapped around declarations. Module makefiles can optionally compile such
# things using .if !empty(OPT_FDT)

View File

@ -411,7 +411,7 @@ SUBDIR= \
_autofs= autofs
.endif
.if ${MK_CDDL} != "no" || defined(ALL_MODULES)
.if ${MK_DTRACE} != "no" || defined(ALL_MODULES)
.if ${MACHINE_CPUARCH} != "arm" || ${MACHINE_ARCH:Marmv[67]*} != ""
.if ${KERN_OPTS:MKDTRACE_HOOKS}
SUBDIR+= dtrace

View File

@ -902,13 +902,9 @@ OLD_FILES+=usr/share/man/man4/ccd.4.gz
OLD_FILES+=usr/share/man/man8/ccdconfig.8.gz
.endif
.if ${MK_CDDL} == no
OLD_LIBS+=lib/libavl.so.2
.if ${MK_DTRACE} == no
OLD_LIBS+=lib/libctf.so.2
OLD_LIBS+=lib/libdtrace.so.2
OLD_LIBS+=lib/libnvpair.so.2
OLD_LIBS+=lib/libumem.so.2
OLD_LIBS+=lib/libuutil.so.2
OLD_FILES+=usr/bin/ctfconvert
OLD_FILES+=usr/bin/ctfdump
OLD_FILES+=usr/bin/ctfmerge
@ -929,24 +925,12 @@ OLD_FILES+=usr/lib/dtrace/tcp.d
OLD_FILES+=usr/lib/dtrace/udp.d
OLD_FILES+=usr/lib/dtrace/udplite.d
OLD_FILES+=usr/lib/dtrace/unistd.d
OLD_FILES+=usr/lib/libavl.a
OLD_FILES+=usr/lib/libavl.so
OLD_FILES+=usr/lib/libavl_p.a
OLD_FILES+=usr/lib/libctf.a
OLD_FILES+=usr/lib/libctf.so
OLD_FILES+=usr/lib/libctf_p.a
OLD_FILES+=usr/lib/libdtrace.a
OLD_FILES+=usr/lib/libdtrace.so
OLD_FILES+=usr/lib/libdtrace_p.a
OLD_FILES+=usr/lib/libnvpair.a
OLD_FILES+=usr/lib/libnvpair.so
OLD_FILES+=usr/lib/libnvpair_p.a
OLD_FILES+=usr/lib/libumem.a
OLD_FILES+=usr/lib/libumem.so
OLD_FILES+=usr/lib/libumem_p.a
OLD_FILES+=usr/lib/libuutil.a
OLD_FILES+=usr/lib/libuutil.so
OLD_FILES+=usr/lib/libuutil_p.a
OLD_LIBS+=lib/libdtrace.so.2
OLD_FILES+=usr/libexec/dwatch/chmod
OLD_FILES+=usr/libexec/dwatch/errno
@ -1080,6 +1064,10 @@ OLD_FILES+=etc/periodic/daily/404.status-zfs
OLD_FILES+=etc/periodic/daily/800.scrub-zfs
OLD_FILES+=etc/zfs/exports
OLD_DIRS+=etc/zfs
OLD_LIBS+=lib/libavl.so.2
OLD_LIBS+=lib/libnvpair.so.2
OLD_LIBS+=lib/libumem.so.2
OLD_LIBS+=lib/libuutil.so.2
OLD_LIBS+=lib/libzfs.so.2
OLD_LIBS+=lib/libzfs.so.3
OLD_LIBS+=lib/libzfs_core.so.2
@ -1098,6 +1086,18 @@ OLD_FILES+=usr/lib/libbe.a
OLD_FILES+=usr/lib/libbe_p.a
OLD_FILES+=usr/lib/libbe.so
OLD_LIBS+=lib/libbe.so.1
OLD_FILES+=usr/lib/libavl.a
OLD_FILES+=usr/lib/libavl.so
OLD_FILES+=usr/lib/libavl_p.a
OLD_FILES+=usr/lib/libnvpair.a
OLD_FILES+=usr/lib/libnvpair.so
OLD_FILES+=usr/lib/libnvpair_p.a
OLD_FILES+=usr/lib/libumem.a
OLD_FILES+=usr/lib/libumem.so
OLD_FILES+=usr/lib/libumem_p.a
OLD_FILES+=usr/lib/libuutil.a
OLD_FILES+=usr/lib/libuutil.so
OLD_FILES+=usr/lib/libuutil_p.a
OLD_FILES+=usr/lib/libzfs.a
OLD_FILES+=usr/lib/libzfs.so
OLD_FILES+=usr/lib/libzfs_core.a

View File

@ -0,0 +1,2 @@
.\" $FreeBSD$
Do not build DTrace framework kernel modules, libraries, and user commands.