The branch main has been updated by brooks:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3bf66365129a13933f77d1f4421d5136861cffb4

commit 3bf66365129a13933f77d1f4421d5136861cffb4
Author:     Brooks Davis <bro...@freebsd.org>
AuthorDate: 2022-07-06 13:03:48 +0000
Commit:     Brooks Davis <bro...@freebsd.org>
CommitDate: 2022-07-06 13:03:48 +0000

    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
---
 cddl/lib/Makefile                        | 49 ++++++++++++++------------------
 cddl/sbin/Makefile                       |  9 ++----
 cddl/share/Makefile                      |  6 +---
 cddl/usr.bin/Makefile                    | 16 ++++-------
 cddl/usr.libexec/Makefile                |  7 ++---
 cddl/usr.sbin/Makefile                   | 20 ++++++-------
 share/man/man5/src.conf.5                | 12 +++++++-
 share/mk/src.opts.mk                     | 10 +++++--
 sys/conf/kern.opts.mk                    |  5 ++++
 sys/modules/Makefile                     |  2 +-
 tools/build/mk/OptionalObsoleteFiles.inc | 34 +++++++++++-----------
 tools/build/options/WITHOUT_DTRACE       |  2 ++
 12 files changed, 85 insertions(+), 87 deletions(-)

diff --git a/cddl/lib/Makefile b/cddl/lib/Makefile
index 5ca0d56b291a..e66109a21138 100644
--- a/cddl/lib/Makefile
+++ b/cddl/lib/Makefile
@@ -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} \
+       libdtrace
+
+SUBDIR.${MK_TESTS}+= tests
+
+SUBDIR.${MK_ZFS}+= \
+       libavl \
+       libicp \
+       libicp_rescue \
        libnvpair \
-       libspl \
-       ${_libtpool} \
+       libtpool \
        libumem \
        libuutil \
-       ${_libzfs_core} \
-       ${_libzfs} \
-       ${_libzfsbootenv} \
-       ${_libzpool} \
-       ${_libzutil} \
-       ${_pam_zfs_key}
-
-SUBDIR.${MK_TESTS}+= tests
+       libzfs \
+       libzfs_core \
+       libzfsbootenv \
+       libzpool \
+       libzutil
 
-.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}.${MK_OPENSSL} = pam_zfs_key
 
 SUBDIR_DEPEND_libavl=          libspl
 SUBDIR_DEPEND_libctf=          libspl
diff --git a/cddl/sbin/Makefile b/cddl/sbin/Makefile
index 99c4a91a3e69..2b3dcf886246 100644
--- a/cddl/sbin/Makefile
+++ b/cddl/sbin/Makefile
@@ -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=
 
diff --git a/cddl/share/Makefile b/cddl/share/Makefile
index 68670ffbe7e0..258b60877f75 100644
--- a/cddl/share/Makefile
+++ b/cddl/share/Makefile
@@ -2,11 +2,7 @@
 
 .include <src.opts.mk>
 
-SUBDIR= ${_zfs}
-
-.if ${MK_ZFS} != "no"
-_zfs=   zfs
-.endif
+SUBDIR.${MK_ZFS}+= zfs
 
 SUBDIR_PARALLEL=
 
diff --git a/cddl/usr.bin/Makefile b/cddl/usr.bin/Makefile
index 10d55215c0b3..97c4639cece0 100644
--- a/cddl/usr.bin/Makefile
+++ b/cddl/usr.bin/Makefile
@@ -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=
 
diff --git a/cddl/usr.libexec/Makefile b/cddl/usr.libexec/Makefile
index 6280cbab5766..7b7dfc7bd354 100644
--- a/cddl/usr.libexec/Makefile
+++ b/cddl/usr.libexec/Makefile
@@ -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=
 
diff --git a/cddl/usr.sbin/Makefile b/cddl/usr.sbin/Makefile
index 4dde136dc412..68dc735b3d1b 100644
--- a/cddl/usr.sbin/Makefile
+++ b/cddl/usr.sbin/Makefile
@@ -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
diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
index f1ca36e5597d..82c32772e762 100644
--- a/share/man/man5/src.conf.5
+++ b/share/man/man5/src.conf.5
@@ -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 .
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index a7e414fd0432..4ac61f13cee2 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -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
diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk
index 2d6e2d1eb729..eae05882cb17 100644
--- a/sys/conf/kern.opts.mk
+++ b/sys/conf/kern.opts.mk
@@ -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)
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 68f1ae38a712..e494c93b4ba7 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -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
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc 
b/tools/build/mk/OptionalObsoleteFiles.inc
index 85257d41140c..7f67b0c8056d 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -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
diff --git a/tools/build/options/WITHOUT_DTRACE 
b/tools/build/options/WITHOUT_DTRACE
new file mode 100644
index 000000000000..7a246ee5ee3d
--- /dev/null
+++ b/tools/build/options/WITHOUT_DTRACE
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Do not build DTrace framework kernel modules, libraries, and user commands.

Reply via email to