1ifneq ($(KBUILD_EXTMOD),) 2src = @abs_srcdir@ 3obj = @abs_builddir@ 4zstd_include = $(src)/include 5else 6zstd_include = $(srctree)/$(src)/include 7endif 8 9MODULE := zzstd 10 11obj-$(CONFIG_ZFS) := $(MODULE).o 12 13asflags-y := -I$(zstd_include) 14ccflags-y := -I$(zstd_include) 15 16# Zstd uses -O3 by default, so we should follow 17ccflags-y += -O3 18 19# -fno-tree-vectorize gets set for gcc in zstd/common/compiler.h 20# Set it for other compilers, too. 21$(obj)/lib/zstd.o: c_flags += -fno-tree-vectorize 22 23# SSE register return with SSE disabled if -march=znverX is passed 24$(obj)/lib/zstd.o: c_flags += -U__BMI__ 25 26# Quiet warnings about frame size due to unused code in unmodified zstd lib 27$(obj)/lib/zstd.o: c_flags += -Wframe-larger-than=20480 28 29# Disable aarch64 neon SIMD instructions for kernel mode 30$(obj)/lib/zstd.o: c_flags += -include $(zstd_include)/aarch64_compat.h -include $(zstd_include)/zstd_compat_wrapper.h -Wp,-w 31 32$(obj)/zfs_zstd.o: c_flags += -include $(zstd_include)/zstd_compat_wrapper.h 33 34$(MODULE)-objs += zfs_zstd.o 35$(MODULE)-objs += lib/zstd.o 36 37all: 38 mkdir -p lib 39