xref: /freebsd/lib/libzstd/Makefile (revision 8b959dd6a3921c35395bef4a6d7ad2426a3bd88e)
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
52# https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1]
53# "Note that [GCC] autovectorization still does not do a good job on the
54# optimized version, so it's turned off via attribute and flag.  I found
55# that neither attribute nor command-line flag were entirely successful in
56# turning off vectorization, which is why there were both."
57.if ${COMPILER_TYPE} == "gcc"
58CFLAGS.zstd_decompress_block.c+=	-fno-tree-vectorize
59.endif
60
61# Work around lack of __bswap[sd]i2() intrinsics on riscv.  Probably should be
62# added to one of the runtime C libraries instead.
63.if ${MACHINE_CPUARCH} == "riscv"
64.PATH:	${ZSTDDIR}/lib/freebsd
65SRCS+=	zstd_kfreebsd.c
66.endif
67
68.include <bsd.lib.mk>
69