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