xref: /freebsd/lib/libzstd/Makefile (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1
2LIB=	zstd
3SRCS=	entropy_common.c \
4	error_private.c \
5	fse_decompress.c \
6	pool.c \
7	threading.c \
8	xxhash.c \
9	zstd_common.c \
10	fse_compress.c \
11	huf_compress.c \
12	zstd_compress.c \
13	zstd_compress_literals.c \
14	zstd_compress_sequences.c \
15	zstd_compress_superblock.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 -fvisibility=hidden
39LIBADD=	pthread
40
41PRIVATELIB=	yes
42PACKAGE=	runtime
43
44ZSTDDIR=	${SRCTOP}/sys/contrib/zstd
45.PATH:	${ZSTDDIR}/lib/common ${ZSTDDIR}/lib/compress \
46	${ZSTDDIR}/lib/decompress ${ZSTDDIR}/lib/deprecated \
47	${ZSTDDIR}/lib/dictBuilder ${ZSTDDIR}/lib
48
49.include <bsd.compiler.mk>
50
51CFLAGS.huf_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
52
53# https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1]
54# "Note that [GCC] autovectorization still does not do a good job on the
55# optimized version, so it's turned off via attribute and flag.  I found
56# that neither attribute nor command-line flag were entirely successful in
57# turning off vectorization, which is why there were both."
58.if ${COMPILER_TYPE} == "gcc"
59CFLAGS.zstd_decompress_block.c+=	-fno-tree-vectorize
60.endif
61
62# Work around lack of __bswap[sd]i2() intrinsics on riscv.  Probably should be
63# added to one of the runtime C libraries instead.
64.if ${MACHINE_CPUARCH} == "riscv"
65.PATH:	${ZSTDDIR}/lib/freebsd
66SRCS+=	zstd_kfreebsd.c
67.endif
68
69.include <bsd.lib.mk>
70