xref: /freebsd/stand/libsa/zfs/Makefile.inc (revision 7a7741af18d6c8a804cc643cb7ecda9d730c6aa6)
1.PATH:		${ZFSSRC}
2.PATH:		${SYSDIR}/crypto/skein
3.PATH:		${ZFSOSSRC}/spl
4.PATH:		${OZFS}/module/zstd
5.PATH:		${OZFS}/module/zstd/lib/common
6.PATH:		${OZFS}/module/zstd/lib/compress
7.PATH:		${OZFS}/module/zstd/lib/decompress
8.PATH:		${OZFS}/module/icp/asm-aarch64/blake3
9.PATH:		${OZFS}/module/icp/algs/blake3
10ZFS_SRC=	zfs.c nvlist.c skein.c skein_block.c list.c
11ZFS_SRC+=	zfs_zstd.c
12ZFS_SRC+=	blake3.c blake3_generic.c blake3_impl.c
13ZSTD_SRC+=	entropy_common.c error_private.c
14ZSTD_SRC+=	fse_decompress.c hist.c
15ZSTD_SRC+=	huf_decompress.c pool.c xxhash.c
16ZSTD_SRC+=	zstd_common.c
17ZSTD_SRC+=	zstd_ddict.c zstd_decompress.c zstd_decompress_block.c
18ZSTD_SRC+=	zstd_double_fast.c zstd_fast.c zstd_lazy.c zstd_ldm.c
19
20SRCS+=		${ZFS_SRC} ${ZSTD_SRC} ${ZFS_SRC_AS}
21
22#
23# Any file that needs the FreeBSD overrides that are in
24# include/os/freebssd/spl/XXX needs to have these added to
25# CFLAGS_EARLY.file.c. In general, we try to build out of the OpenZFS tree
26# unaltered. There's a problem, though, that since we're building for a
27# standalone environment that's neither userland nor kernel, we sometimes need
28# special code and that's handled by the 'nested' includes where we either setup
29# something just-so before we include the include/XXX file, or if we need to
30# tweak something defined in that file.
31#
32
33ZFS_EARLY=	-I${ZFSSRC}/spl					\
34		-I${ZFSOSINC}					\
35		-I${ZFSOSINC}/spl				\
36		-I${ZFSOSINC}/zfs
37
38#
39# For all files, though, we prepend the sys/ccompile.h file to the build which
40# has a bunch of defines that are present in OpenSolaris / Illumos, but missing
41# from FreeBSD.
42#
43.for i in ${ZFS_SRC} ${ZSTD_SRC}
44CFLAGS.$i+=	-include ${ZFSOSINC}/spl/sys/ccompile.h -Wformat -Wall -I${OZFS}/include \
45	-DNEED_SOLARIS_BOOLEAN
46.endfor
47
48CFLAGS_EARLY.blake3.c+= ${ZFS_EARLY} -DOMIT_SIMD
49CFLAGS_EARLY.blake3_generic.c+= ${ZFS_EARLY} -DOMIT_SIMD
50CFLAGS_EARLY.blake3_impl.c+= ${ZFS_EARLY} -DOMIT_SIMD
51CFLAGS_EARLY.list.c+= ${ZFS_EARLY}
52CFLAGS_EARLY.zfs_zstd.c+= ${ZFS_EARLY}
53CFLAGS_EARLY.nvlist.c+= ${ZFS_EARLY}
54CFLAGS_EARLY.zfs.c += ${ZFS_EARLY}
55
56#
57# zfs.c is special: we need to define HAS_ZSTD_ZFS to get zfssubr.c to initialize zstd
58# properly. We need to have the cddl boot compat directory in the include path for zfssubr.c
59# to be found, and we need a couple of other include paths for skein and lz4. Finally we
60# temporarily need LDRSRC to pick up part.h until libsa has a way to look into partitions
61# or enumerate them...
62#
63CFLAGS.zfs.c+=	-DHAS_ZSTD_ZFS					\
64		-I${SYSDIR}/cddl/boot/zfs			\
65		-I${LDRSRC}					\
66		-I${SYSDIR}/crypto/skein			\
67		-I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4
68
69#
70# ZSTD coding style has some issues, so suppress clang's warnings. Also, zstd's
71# use of BMI instrucitons is broken in this environment, so avoid them.
72#
73.for i in ${ZSTD_SRC}
74CFLAGS.$i+=	-U__BMI__ ${NO_WBITWISE_INSTEAD_OF_LOGICAL}
75.endfor
76
77CFLAGS.zfs_zstd.c+= -DIN_BASE -DIN_LIBSA
78
79CFLAGS.blake3_impl.c+= -I${OZFS}/module/icp/algs/blake3 -I${OZFS}/module/icp/include -DIN_LIBSA
80
81# Do not unroll skein loops, reduce code size
82CFLAGS.skein_block.c+=	-DSKEIN_LOOP=111
83
84CWARNFLAGS.zfs.c+= ${NO_WDANGLING_POINTER}
85