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