xref: /freebsd/lib/libzstd/Makefile (revision 5f4c09dd85bff675e0ca63c55ea3c517e0fddfcc)
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
41# ZSTD_ASM_SUPPORTED is 0 on FreeBSD but 1 on macOS and Linux. Since we build
42# this as a bootstrap library and don't include any assembly sources in SRCS,
43# explicitly disable assembly.
44CFLAGS+=	-DZSTD_DISABLE_ASM
45
46PRIVATELIB=	yes
47PACKAGE=	runtime
48
49ZSTDDIR=	${SRCTOP}/sys/contrib/zstd
50.PATH:	${ZSTDDIR}/lib/common ${ZSTDDIR}/lib/compress \
51	${ZSTDDIR}/lib/decompress ${ZSTDDIR}/lib/deprecated \
52	${ZSTDDIR}/lib/dictBuilder ${ZSTDDIR}/lib
53
54.include <bsd.compiler.mk>
55
56CFLAGS.huf_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
57
58# https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1]
59# "Note that [GCC] autovectorization still does not do a good job on the
60# optimized version, so it's turned off via attribute and flag.  I found
61# that neither attribute nor command-line flag were entirely successful in
62# turning off vectorization, which is why there were both."
63.if ${COMPILER_TYPE} == "gcc"
64CFLAGS.zstd_decompress_block.c+=	-fno-tree-vectorize
65.endif
66
67# Work around lack of __bswap[sd]i2() intrinsics on riscv.  Probably should be
68# added to one of the runtime C libraries instead.
69.if ${MACHINE_CPUARCH} == "riscv"
70.PATH:	${ZSTDDIR}/lib/freebsd
71SRCS+=	zstd_kfreebsd.c
72.endif
73
74.include <bsd.lib.mk>
75