xref: /freebsd/lib/libzstd/Makefile (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
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	zstd_compress_superblock.c \
17	zstdmt_compress.c \
18	huf_decompress.c \
19	zstd_ddict.c \
20	zstd_decompress.c \
21	zstd_decompress_block.c \
22	zbuff_common.c \
23	zbuff_compress.c \
24	zbuff_decompress.c \
25	cover.c \
26	divsufsort.c \
27	zdict.c \
28	zstd_fast.c \
29	zstd_lazy.c \
30	zstd_ldm.c \
31	zstd_opt.c \
32	zstd_double_fast.c \
33	debug.c \
34	hist.c \
35	fastcover.c
36WARNS?=	2
37INCS=	zstd.h
38CFLAGS+=	-I${ZSTDDIR}/lib -I${ZSTDDIR}/lib/common -DXXH_NAMESPACE=ZSTD_ \
39		-DZSTD_MULTITHREAD=1 -fvisibility=hidden
40LIBADD=	pthread
41
42PRIVATELIB=	yes
43PACKAGE=	runtime
44
45ZSTDDIR=	${SRCTOP}/sys/contrib/zstd
46.PATH:	${ZSTDDIR}/lib/common ${ZSTDDIR}/lib/compress \
47	${ZSTDDIR}/lib/decompress ${ZSTDDIR}/lib/deprecated \
48	${ZSTDDIR}/lib/dictBuilder ${ZSTDDIR}/lib
49
50.include <bsd.compiler.mk>
51
52CFLAGS.huf_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
53
54# https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1]
55# "Note that [GCC] autovectorization still does not do a good job on the
56# optimized version, so it's turned off via attribute and flag.  I found
57# that neither attribute nor command-line flag were entirely successful in
58# turning off vectorization, which is why there were both."
59.if ${COMPILER_TYPE} == "gcc"
60CFLAGS.zstd_decompress_block.c+=	-fno-tree-vectorize
61.endif
62
63# Work around lack of __bswap[sd]i2() intrinsics on riscv.  Probably should be
64# added to one of the runtime C libraries instead.
65.if ${MACHINE_CPUARCH} == "riscv"
66.PATH:	${ZSTDDIR}/lib/freebsd
67SRCS+=	zstd_kfreebsd.c
68.endif
69
70.include <bsd.lib.mk>
71