1# $FreeBSD$ 2 3LIB= zstd 4SRCS= entropy_common.c \ 5 error_private.c \ 6 fse_decompress.c \ 7 pool.c \ 8 threading.c \ 9 xxhash.c \ 10 zstd_common.c \ 11 fse_compress.c \ 12 huf_compress.c \ 13 zstd_compress.c \ 14 zstd_compress_literals.c \ 15 zstd_compress_sequences.c \ 16 zstdmt_compress.c \ 17 huf_decompress.c \ 18 zstd_ddict.c \ 19 zstd_decompress.c \ 20 zstd_decompress_block.c \ 21 zbuff_common.c \ 22 zbuff_compress.c \ 23 zbuff_decompress.c \ 24 cover.c \ 25 divsufsort.c \ 26 zdict.c \ 27 zstd_fast.c \ 28 zstd_lazy.c \ 29 zstd_ldm.c \ 30 zstd_opt.c \ 31 zstd_double_fast.c \ 32 debug.c \ 33 hist.c \ 34 fastcover.c 35WARNS= 2 36INCS= zstd.h 37CFLAGS+= -I${ZSTDDIR}/lib -I${ZSTDDIR}/lib/common -DXXH_NAMESPACE=ZSTD_ \ 38 -DZSTD_MULTITHREAD=1 39LIBADD= pthread 40 41PRIVATELIB= yes 42 43ZSTDDIR= ${SRCTOP}/sys/contrib/zstd 44.PATH: ${ZSTDDIR}/lib/common ${ZSTDDIR}/lib/compress \ 45 ${ZSTDDIR}/lib/decompress ${ZSTDDIR}/lib/deprecated \ 46 ${ZSTDDIR}/lib/dictBuilder ${ZSTDDIR}/lib 47 48.include <bsd.compiler.mk> 49 50# https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1] 51# "Note that [GCC] autovectorization still does not do a good job on the 52# optimized version, so it's turned off via attribute and flag. I found 53# that neither attribute nor command-line flag were entirely successful in 54# turning off vectorization, which is why there were both." 55.if ${COMPILER_TYPE} == "gcc" 56CFLAGS.zstd_decompress_block.c+= -fno-tree-vectorize 57.endif 58 59# Work around for LLVM bug 35023, https://bugs.llvm.org/show_bug.cgi?id=35023 60# Fixed in https://reviews.llvm.org/rL349935 ; not sure if we have that version 61# in our LLVM or not yet. 62.if ${MACHINE_ARCH:Marm*} != "" 63CFLAGS.zstd_compress.c+= -O0 64.endif 65 66# Work around lack of __bswap[sd]i2() intrinsics on riscv. Probably should be 67# added to one of the runtime C libraries instead. 68.if ${MACHINE_CPUARCH} == "riscv" 69.PATH: ${ZSTDDIR}/lib/freebsd 70SRCS+= zstd_kfreebsd.c 71.endif 72 73.include <bsd.lib.mk> 74