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_hack.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 22.if ${MACHINE_ARCH} == "aarch64" 23ZFS_SRC_AS = b3_aarch64_sse2.S b3_aarch64_sse41.S 24.endif 25 26SRCS+= ${ZFS_SRC} ${ZSTD_SRC} ${ZFS_SRC_AS} 27 28# 29# Any file that needs the FreeBSD overrides that are in 30# include/os/freebssd/spl/XXX needs to have these added to 31# CFLAGS_EARLY.file.c. In general, we try to build out of the OpenZFS tree 32# unaltered. There's a problem, though, that since we're building for a 33# standalone environment that's neither userland nor kernel, we sometimes need 34# special code and that's handled by the 'nested' includes where we either setup 35# something just-so before we include the include/XXX file, or if we need to 36# tweak something defined in that file. 37# 38 39ZFS_EARLY= -I${ZFSSRC}/spl \ 40 -I${ZFSOSINC} \ 41 -I${ZFSOSINC}/spl \ 42 -I${ZFSOSINC}/zfs 43 44# 45# For all files, though, we prepend the sys/ccompile.h file to the build which 46# has a bunch of defines that are present in OpenSolaris / Illumos, but missing 47# from FreeBSD. 48# 49.for i in ${ZFS_SRC} ${ZSTD_SRC} 50CFLAGS.$i+= -include ${ZFSOSINC}/spl/sys/ccompile.h -Wformat -Wall -I${OZFS}/include \ 51 -DNEED_SOLARIS_BOOLEAN 52.endfor 53 54CFLAGS_EARLY.blake3.c+= ${ZFS_EARLY} 55CFLAGS_EARLY.blake3_generic.c+= ${ZFS_EARLY} 56CFLAGS_EARLY.blake3_impl_hack.c+= ${ZFS_EARLY} 57CFLAGS_EARLY.list.c+= ${ZFS_EARLY} 58CFLAGS_EARLY.zfs_zstd.c+= ${ZFS_EARLY} 59CFLAGS_EARLY.nvlist.c+= ${ZFS_EARLY} 60CFLAGS_EARLY.zfs.c += ${ZFS_EARLY} 61 62# 63# zfs.c is special: we need to define HAS_ZSTD_ZFS to get zfssubr.c to initialize zstd 64# properly. We need to have the cddl boot compat directory in the include path for zfssubr.c 65# to be found, and we need a couple of other include paths for skein and lz4. Finally we 66# temporarily need LDRSRC to pick up part.h until libsa has a way to look into partitions 67# or enumerate them... 68# 69CFLAGS.zfs.c+= -DHAS_ZSTD_ZFS \ 70 -I${SYSDIR}/cddl/boot/zfs \ 71 -I${LDRSRC} \ 72 -I${SYSDIR}/crypto/skein \ 73 -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 74 75.for i in ${ZFS_SRC_AS} 76CFLAGS.$i+= -DLOCORE 77.endfor 78# 79# ZSTD coding style has some issues, so suppress clang's warnings. Also, zstd's 80# use of BMI instrucitons is broken in this environment, so avoid them. 81# 82.for i in ${ZSTD_SRC} 83CFLAGS.$i+= -U__BMI__ ${NO_WBITWISE_INSTEAD_OF_LOGICAL} 84.endfor 85 86CFLAGS.zfs_zstd.c+= -DIN_BASE -DIN_LIBSA 87 88# Do not unroll skein loops, reduce code size 89CFLAGS.skein_block.c+= -DSKEIN_LOOP=111 90 91# To find blake3_impl.c in OpenZFS tree for our somehat ugly blake3_impl_hack.c 92# that's needed until the necessary tweaks can be upstreamed. 93CFLAGS.blake3_impl_hack.c+= -I${OZFS}/module/icp/algs/blake3 -I${OZFS}/module/icp/include 94 95CWARNFLAGS.zfs.c+= ${NO_WDANGLING_POINTER} 96 97b3_aarch64_sse2.o: b3_aarch64_sse2.S 98 ${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${.IMPSRC} \ 99 -o ${.TARGET} 100 ${CTFCONVERT_CMD} 101 102b3_aarch64_sse41.o: b3_aarch64_sse41.S 103 ${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${.IMPSRC} \ 104 -o ${.TARGET} 105 ${CTFCONVERT_CMD} 106