xref: /linux/lib/crc/Makefile (revision 190c253d8696b7ba14424c484435ac2d4bcb9ebd)
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
18*190c253dSEric Biggerscrc-t10dif-$(CONFIG_PPC) += powerpc/crct10dif-vpmsum_asm.o
190bcfca56SEric Biggersendif
200bcfca56SEric Biggers
2189a51591SEric Biggersobj-$(CONFIG_CRC32) += crc32.o
220bcfca56SEric Biggerscrc32-y := crc32-main.o
230bcfca56SEric Biggersifeq ($(CONFIG_CRC32_ARCH),y)
240bcfca56SEric BiggersCFLAGS_crc32-main.o += -I$(src)/$(SRCARCH)
25530b304fSEric Biggerscrc32-$(CONFIG_ARM) += arm/crc32-core.o
262b7531b2SEric Biggerscrc32-$(CONFIG_ARM64) += arm64/crc32-core.o
27*190c253dSEric Biggerscrc32-$(CONFIG_PPC) += powerpc/crc32c-vpmsum_asm.o
280bcfca56SEric Biggersendif
290bcfca56SEric Biggers
3089a51591SEric Biggersobj-$(CONFIG_CRC64) += crc64.o
310bcfca56SEric Biggerscrc64-y := crc64-main.o
320bcfca56SEric Biggersifeq ($(CONFIG_CRC64_ARCH),y)
330bcfca56SEric BiggersCFLAGS_crc64-main.o += -I$(src)/$(SRCARCH)
340bcfca56SEric Biggersendif
350bcfca56SEric Biggers
3689a51591SEric Biggersobj-y += tests/
3789a51591SEric Biggers
3889a51591SEric Biggershostprogs := gen_crc32table gen_crc64table
3989a51591SEric Biggersclean-files := crc32table.h crc64table.h
4089a51591SEric Biggers
410bcfca56SEric Biggers$(obj)/crc32-main.o: $(obj)/crc32table.h
420bcfca56SEric Biggers$(obj)/crc64-main.o: $(obj)/crc64table.h
4389a51591SEric Biggers
4489a51591SEric Biggersquiet_cmd_crc32 = GEN     $@
4589a51591SEric Biggers      cmd_crc32 = $< > $@
4689a51591SEric Biggers
4789a51591SEric Biggersquiet_cmd_crc64 = GEN     $@
4889a51591SEric Biggers      cmd_crc64 = $< > $@
4989a51591SEric Biggers
5089a51591SEric Biggers$(obj)/crc32table.h: $(obj)/gen_crc32table
5189a51591SEric Biggers	$(call cmd,crc32)
5289a51591SEric Biggers
5389a51591SEric Biggers$(obj)/crc64table.h: $(obj)/gen_crc64table
5489a51591SEric Biggers	$(call cmd,crc64)
55