xref: /freebsd/stand/libsa/zfs/Makefile.inc (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
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/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_hack.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}
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}
50CFLAGS_EARLY.blake3_generic.c+= ${ZFS_EARLY}
51CFLAGS_EARLY.blake3_impl_hack.c+= ${ZFS_EARLY}
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
80# Do not unroll skein loops, reduce code size
81CFLAGS.skein_block.c+=	-DSKEIN_LOOP=111
82
83# To find blake3_impl.c in OpenZFS tree for our somehat ugly blake3_impl_hack.c
84# that's needed until the necessary tweaks can be upstreamed.
85CFLAGS.blake3_impl_hack.c+= -I${OZFS}/module/icp/algs/blake3
86
87CWARNFLAGS.zfs.c+= ${NO_WDANGLING_POINTER}
88