xref: /freebsd/stand/libsa/zfs/Makefile.inc (revision 4773d3425e62bda14f0dd91c4e3de5009dba388f)
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_compress.c fse_decompress.c hist.c
16ZSTD_SRC+=	huf_compress.c huf_decompress.c pool.c xxhash.c
17ZSTD_SRC+=	zstd_common.c zstd_compress.c zstd_compress_literals.c
18ZSTD_SRC+=	zstd_compress_sequences.c zstd_compress_superblock.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
21ZSTD_SRC+=	zstd_opt.c
22
23CFLAGS+=	-DHAS_ZSTD_ZFS
24SRCS+=		${ZFS_SRC} ${ZSTD_SRC}
25
26CFLAGS+=	-I${LDRSRC}
27CFLAGS+=	-I${SYSDIR}/cddl/boot/zfs
28CFLAGS+=	-I${SYSDIR}/crypto/skein
29
30#
31# Any file that needs the FreeBSD overrides that are in
32# include/os/freebssd/spl/XXX needs to have these added to
33# CFLAGS_EARLY.file.c. In general, we try to build out of the OpenZFS tree
34# unaltered. There's a problem, though, that since we're building for a
35# standalone environment that's neither userland nor kernel, we sometimes need
36# special code and that's handled by the 'nested' includes where we either setup
37# something just-so before we include the include/XXX file, or if we need to
38# tweak something defined in that file.
39#
40
41ZFS_EARLY=	-I${ZFSSRC}/spl					\
42		-I${ZFSOSINC}					\
43		-I${ZFSOSINC}/spl				\
44		-I${ZFSOSINC}/zfs
45
46#
47# For all files, though, we prepend the sys/ccompile.h file to the build which
48# has a bunch of defines that are present in OpenSolaris / Illumos, but missing
49# from FreeBSD.
50#
51.for i in ${ZFS_SRC} ${ZSTD_SRC}
52CFLAGS.$i+=	-include ${ZFSOSINC}/spl/sys/ccompile.h -Wformat -Wall -I${OZFS}/include \
53	-DNEED_SOLARIS_BOOLEAN
54.endfor
55
56CFLAGS_EARLY.blake3.c+= ${ZFS_EARLY}
57CFLAGS_EARLY.blake3_generic.c+= ${ZFS_EARLY}
58CFLAGS_EARLY.blake3_impl_hack.c+= ${ZFS_EARLY}
59CFLAGS_EARLY.list.c+= ${ZFS_EARLY}
60CFLAGS_EARLY.zfs_zstd.c+= ${ZFS_EARLY}
61CFLAGS_EARLY.nvlist.c+= ${ZFS_EARLY}
62
63# Can't use the early flags because there's two conflicting definitions of boolean_t in
64# the zfs code that need to be unified, as well as a number of other hacks for pre-openzfs
65# code still in the tree that needs to be fixed.
66CFLAGS.zfs.c+=	-I${ZFSOSINC}/spl				\
67		-I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 \
68		-I${ZFSOSINC}/zfs				\
69		-I${OZFS}/include
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
81# Do not unroll skein loops, reduce code size
82CFLAGS.skein_block.c+=	-DSKEIN_LOOP=111
83
84# To puck up blake3_impl.c...
85CFLAGS.blake3_impl_hack.c+= -I${OZFS}/module/icp/algs/blake3
86