189a51591SEric Biggers# SPDX-License-Identifier: GPL-2.0-only 289a51591SEric Biggers 389a51591SEric Biggers# Makefile for the kernel's cyclic redundancy check (CRC) library code 489a51591SEric Biggers 589a51591SEric Biggersobj-$(CONFIG_CRC4) += crc4.o 689a51591SEric Biggersobj-$(CONFIG_CRC7) += crc7.o 789a51591SEric Biggersobj-$(CONFIG_CRC8) += crc8.o 889a51591SEric Biggersobj-$(CONFIG_CRC16) += crc16.o 989a51591SEric Biggersobj-$(CONFIG_CRC_CCITT) += crc-ccitt.o 1089a51591SEric Biggersobj-$(CONFIG_CRC_ITU_T) += crc-itu-t.o 110bcfca56SEric Biggers 1289a51591SEric Biggersobj-$(CONFIG_CRC_T10DIF) += crc-t10dif.o 130bcfca56SEric Biggerscrc-t10dif-y := crc-t10dif-main.o 140bcfca56SEric Biggersifeq ($(CONFIG_CRC_T10DIF_ARCH),y) 150bcfca56SEric BiggersCFLAGS_crc-t10dif-main.o += -I$(src)/$(SRCARCH) 16530b304fSEric Biggerscrc-t10dif-$(CONFIG_ARM) += arm/crc-t10dif-core.o 172b7531b2SEric Biggerscrc-t10dif-$(CONFIG_ARM64) += arm64/crc-t10dif-core.o 18190c253dSEric Biggerscrc-t10dif-$(CONFIG_PPC) += powerpc/crct10dif-vpmsum_asm.o 19b5943815SEric Biggerscrc-t10dif-$(CONFIG_RISCV) += riscv/crc16_msb.o 20b10749d8SEric Biggerscrc-t10dif-$(CONFIG_X86) += x86/crc16-msb-pclmul.o 210bcfca56SEric Biggersendif 220bcfca56SEric Biggers 2389a51591SEric Biggersobj-$(CONFIG_CRC32) += crc32.o 240bcfca56SEric Biggerscrc32-y := crc32-main.o 250bcfca56SEric Biggersifeq ($(CONFIG_CRC32_ARCH),y) 260bcfca56SEric BiggersCFLAGS_crc32-main.o += -I$(src)/$(SRCARCH) 27530b304fSEric Biggerscrc32-$(CONFIG_ARM) += arm/crc32-core.o 282b7531b2SEric Biggerscrc32-$(CONFIG_ARM64) += arm64/crc32-core.o 29190c253dSEric Biggerscrc32-$(CONFIG_PPC) += powerpc/crc32c-vpmsum_asm.o 30b5943815SEric Biggerscrc32-$(CONFIG_RISCV) += riscv/crc32_lsb.o riscv/crc32_msb.o 312374bf23SEric Biggerscrc32-$(CONFIG_S390) += s390/crc32le-vx.o s390/crc32be-vx.o 329b2d720eSEric Biggerscrc32-$(CONFIG_SPARC) += sparc/crc32c_asm.o 33b10749d8SEric Biggerscrc32-$(CONFIG_X86) += x86/crc32-pclmul.o 34b10749d8SEric Biggerscrc32-$(CONFIG_X86_64) += x86/crc32c-3way.o 350bcfca56SEric Biggersendif 360bcfca56SEric Biggers 3789a51591SEric Biggersobj-$(CONFIG_CRC64) += crc64.o 380bcfca56SEric Biggerscrc64-y := crc64-main.o 390bcfca56SEric Biggersifeq ($(CONFIG_CRC64_ARCH),y) 400bcfca56SEric BiggersCFLAGS_crc64-main.o += -I$(src)/$(SRCARCH) 4163432fd6SDemian Shulhan 42*e3babebfSArd Biesheuvelcrc64-cflags-$(CONFIG_ARM) += -march=armv8-a -mfpu=crypto-neon-fp-armv8 43*e3babebfSArd Biesheuvelcrc64-cflags-$(CONFIG_ARM64) += -march=armv8-a+crypto 44061cef5fSArd BiesheuvelCFLAGS_REMOVE_crc64-neon.o += $(CC_FLAGS_NO_FPU) 45*e3babebfSArd BiesheuvelCFLAGS_crc64-neon.o += $(CC_FLAGS_FPU) -I$(src)/$(SRCARCH) $(crc64-cflags-y) 46*e3babebfSArd Biesheuvelcrc64-$(CONFIG_ARM) += crc64-neon.o 47061cef5fSArd Biesheuvelcrc64-$(CONFIG_ARM64) += crc64-neon.o 4863432fd6SDemian Shulhan 49b5943815SEric Biggerscrc64-$(CONFIG_RISCV) += riscv/crc64_lsb.o riscv/crc64_msb.o 50b10749d8SEric Biggerscrc64-$(CONFIG_X86) += x86/crc64-pclmul.o 5163432fd6SDemian Shulhanendif # CONFIG_CRC64_ARCH 520bcfca56SEric Biggers 5389a51591SEric Biggersobj-y += tests/ 5489a51591SEric Biggers 5589a51591SEric Biggershostprogs := gen_crc32table gen_crc64table 5689a51591SEric Biggersclean-files := crc32table.h crc64table.h 5789a51591SEric Biggers 580bcfca56SEric Biggers$(obj)/crc32-main.o: $(obj)/crc32table.h 590bcfca56SEric Biggers$(obj)/crc64-main.o: $(obj)/crc64table.h 6089a51591SEric Biggers 6189a51591SEric Biggersquiet_cmd_crc32 = GEN $@ 6289a51591SEric Biggers cmd_crc32 = $< > $@ 6389a51591SEric Biggers 6489a51591SEric Biggersquiet_cmd_crc64 = GEN $@ 6589a51591SEric Biggers cmd_crc64 = $< > $@ 6689a51591SEric Biggers 6789a51591SEric Biggers$(obj)/crc32table.h: $(obj)/gen_crc32table 6889a51591SEric Biggers $(call cmd,crc32) 6989a51591SEric Biggers 7089a51591SEric Biggers$(obj)/crc64table.h: $(obj)/gen_crc64table 7189a51591SEric Biggers $(call cmd,crc64) 72