xref: /freebsd/lib/libzstd/Makefile (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
1e2290905SBaptiste DaroussinLIB=	zstd
2e2290905SBaptiste DaroussinSRCS=	entropy_common.c \
3e2290905SBaptiste Daroussin	error_private.c \
4e2290905SBaptiste Daroussin	fse_decompress.c \
5e2290905SBaptiste Daroussin	pool.c \
6e2290905SBaptiste Daroussin	threading.c \
7e2290905SBaptiste Daroussin	xxhash.c \
8e2290905SBaptiste Daroussin	zstd_common.c \
9e2290905SBaptiste Daroussin	fse_compress.c \
10e2290905SBaptiste Daroussin	huf_compress.c \
11e2290905SBaptiste Daroussin	zstd_compress.c \
124d3f1eafSConrad Meyer	zstd_compress_literals.c \
134d3f1eafSConrad Meyer	zstd_compress_sequences.c \
1437f1f268SConrad Meyer	zstd_compress_superblock.c \
15e2290905SBaptiste Daroussin	zstdmt_compress.c \
16e2290905SBaptiste Daroussin	huf_decompress.c \
17a0483764SConrad Meyer	zstd_ddict.c \
18e2290905SBaptiste Daroussin	zstd_decompress.c \
19a0483764SConrad Meyer	zstd_decompress_block.c \
20e2290905SBaptiste Daroussin	zbuff_common.c \
21e2290905SBaptiste Daroussin	zbuff_compress.c \
22e2290905SBaptiste Daroussin	zbuff_decompress.c \
23e2290905SBaptiste Daroussin	cover.c \
24e2290905SBaptiste Daroussin	divsufsort.c \
2504ac1c64SBaptiste Daroussin	zdict.c \
2604ac1c64SBaptiste Daroussin	zstd_fast.c \
2704ac1c64SBaptiste Daroussin	zstd_lazy.c \
2804ac1c64SBaptiste Daroussin	zstd_ldm.c \
2904ac1c64SBaptiste Daroussin	zstd_opt.c \
300f743729SConrad Meyer	zstd_double_fast.c \
310f743729SConrad Meyer	debug.c \
320f743729SConrad Meyer	hist.c \
330f743729SConrad Meyer	fastcover.c
34ecebb3ccSKyle EvansWARNS?=	2
35e2290905SBaptiste DaroussinINCS=	zstd.h
361fc317e3SBaptiste DaroussinCFLAGS+=	-I${ZSTDDIR}/lib -I${ZSTDDIR}/lib/common -DXXH_NAMESPACE=ZSTD_ \
3798689d0fSConrad Meyer		-DZSTD_MULTITHREAD=1 -fvisibility=hidden
381fc317e3SBaptiste DaroussinLIBADD=	pthread
39e2290905SBaptiste Daroussin
40*4101bcfaSJessica Clarke# ZSTD_ASM_SUPPORTED is 0 on FreeBSD but 1 on macOS and Linux. Since we build
41*4101bcfaSJessica Clarke# this as a bootstrap library and don't include any assembly sources in SRCS,
42*4101bcfaSJessica Clarke# explicitly disable assembly.
43*4101bcfaSJessica ClarkeCFLAGS+=	-DZSTD_DISABLE_ASM
44*4101bcfaSJessica Clarke
45e2290905SBaptiste DaroussinPRIVATELIB=	yes
466cd88fe0SEmmanuel VadotPACKAGE=	runtime
47e2290905SBaptiste Daroussin
480c16b537SWarner LoshZSTDDIR=	${SRCTOP}/sys/contrib/zstd
49e2290905SBaptiste Daroussin.PATH:	${ZSTDDIR}/lib/common ${ZSTDDIR}/lib/compress \
50e2290905SBaptiste Daroussin	${ZSTDDIR}/lib/decompress ${ZSTDDIR}/lib/deprecated \
51e2290905SBaptiste Daroussin	${ZSTDDIR}/lib/dictBuilder ${ZSTDDIR}/lib
52e2290905SBaptiste Daroussin
534d3f1eafSConrad Meyer.include <bsd.compiler.mk>
544d3f1eafSConrad Meyer
555f2aca83SDimitry AndricCFLAGS.huf_decompress.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
565f2aca83SDimitry Andric
574d3f1eafSConrad Meyer# https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1]
584d3f1eafSConrad Meyer# "Note that [GCC] autovectorization still does not do a good job on the
594d3f1eafSConrad Meyer# optimized version, so it's turned off via attribute and flag.  I found
604d3f1eafSConrad Meyer# that neither attribute nor command-line flag were entirely successful in
614d3f1eafSConrad Meyer# turning off vectorization, which is why there were both."
624d3f1eafSConrad Meyer.if ${COMPILER_TYPE} == "gcc"
634d3f1eafSConrad MeyerCFLAGS.zstd_decompress_block.c+=	-fno-tree-vectorize
644d3f1eafSConrad Meyer.endif
654d3f1eafSConrad Meyer
6622aec4deSConrad Meyer# Work around lack of __bswap[sd]i2() intrinsics on riscv.  Probably should be
6722aec4deSConrad Meyer# added to one of the runtime C libraries instead.
6822aec4deSConrad Meyer.if ${MACHINE_CPUARCH} == "riscv"
6922aec4deSConrad Meyer.PATH:	${ZSTDDIR}/lib/freebsd
7022aec4deSConrad MeyerSRCS+=	zstd_kfreebsd.c
7122aec4deSConrad Meyer.endif
7222aec4deSConrad Meyer
73e2290905SBaptiste Daroussin.include <bsd.lib.mk>
74