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