git: 09ace5cefbd2 - main - stand/zfs: Limit flags further for ZFS

From: Warner Losh <imp_at_FreeBSD.org>
Date: Sun, 24 Jul 2022 22:55:46 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=09ace5cefbd29c105b2b332b71a19b3f9fd8079b

commit 09ace5cefbd29c105b2b332b71a19b3f9fd8079b
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-07-24 21:51:53 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-07-24 22:53:35 +0000

    stand/zfs: Limit flags further for ZFS
    
    Constrain CFLAGS for ZFS: don't add anything globally. Add the includes
    to only the files that need them. Add -DHAS_ZSTD_ZFS to zfs.c (which
    includes zfsimpl.c which includes zfssubr.c both of which need this
    defined). Also add it to efi/boot1/Makefile since zfs_module.c also
    includes zfsimple.c.
    
    Sponsored by:           Netflix
    Reviewed by:            tsoome
    Differential Revision:  https://reviews.freebsd.org/D35887
---
 stand/libsa/zfs/Makefile.inc | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/stand/libsa/zfs/Makefile.inc b/stand/libsa/zfs/Makefile.inc
index 9de1a1f00c24..15a4c8bf3018 100644
--- a/stand/libsa/zfs/Makefile.inc
+++ b/stand/libsa/zfs/Makefile.inc
@@ -20,13 +20,8 @@ ZSTD_SRC+=	zstd_ddict.c zstd_decompress.c zstd_decompress_block.c
 ZSTD_SRC+=	zstd_double_fast.c zstd_fast.c zstd_lazy.c zstd_ldm.c
 ZSTD_SRC+=	zstd_opt.c
 
-CFLAGS+=	-DHAS_ZSTD_ZFS
 SRCS+=		${ZFS_SRC} ${ZSTD_SRC}
 
-CFLAGS+=	-I${LDRSRC}
-CFLAGS+=	-I${SYSDIR}/cddl/boot/zfs
-CFLAGS+=	-I${SYSDIR}/crypto/skein
-
 #
 # Any file that needs the FreeBSD overrides that are in
 # include/os/freebssd/spl/XXX needs to have these added to
@@ -63,7 +58,11 @@ CFLAGS_EARLY.nvlist.c+= ${ZFS_EARLY}
 # Can't use the early flags because there's two conflicting definitions of boolean_t in
 # the zfs code that need to be unified, as well as a number of other hacks for pre-openzfs
 # code still in the tree that needs to be fixed.
-CFLAGS.zfs.c+=	-I${ZFSOSINC}/spl				\
+CFLAGS.zfs.c+=	-DHAS_ZSTD_ZFS					\
+		-I${SYSDIR}/cddl/boot/zfs			\
+		-I${LDRSRC}					\
+		-I${SYSDIR}/crypto/skein			\
+		-I${ZFSOSINC}/spl				\
 		-I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 \
 		-I${ZFSOSINC}/zfs				\
 		-I${OZFS}/include