xref: /linux/lib/crc/Makefile (revision 0bcfca56406dc6342e30fafe41a2f34cdde029b4)
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
11*0bcfca56SEric Biggers
1289a51591SEric Biggersobj-$(CONFIG_CRC_T10DIF) += crc-t10dif.o
13*0bcfca56SEric Biggerscrc-t10dif-y := crc-t10dif-main.o
14*0bcfca56SEric Biggersifeq ($(CONFIG_CRC_T10DIF_ARCH),y)
15*0bcfca56SEric BiggersCFLAGS_crc-t10dif-main.o += -I$(src)/$(SRCARCH)
16*0bcfca56SEric Biggersendif
17*0bcfca56SEric Biggers
1889a51591SEric Biggersobj-$(CONFIG_CRC32) += crc32.o
19*0bcfca56SEric Biggerscrc32-y := crc32-main.o
20*0bcfca56SEric Biggersifeq ($(CONFIG_CRC32_ARCH),y)
21*0bcfca56SEric BiggersCFLAGS_crc32-main.o += -I$(src)/$(SRCARCH)
22*0bcfca56SEric Biggersendif
23*0bcfca56SEric Biggers
2489a51591SEric Biggersobj-$(CONFIG_CRC64) += crc64.o
25*0bcfca56SEric Biggerscrc64-y := crc64-main.o
26*0bcfca56SEric Biggersifeq ($(CONFIG_CRC64_ARCH),y)
27*0bcfca56SEric BiggersCFLAGS_crc64-main.o += -I$(src)/$(SRCARCH)
28*0bcfca56SEric Biggersendif
29*0bcfca56SEric Biggers
3089a51591SEric Biggersobj-y += tests/
3189a51591SEric Biggers
3289a51591SEric Biggershostprogs := gen_crc32table gen_crc64table
3389a51591SEric Biggersclean-files := crc32table.h crc64table.h
3489a51591SEric Biggers
35*0bcfca56SEric Biggers$(obj)/crc32-main.o: $(obj)/crc32table.h
36*0bcfca56SEric Biggers$(obj)/crc64-main.o: $(obj)/crc64table.h
3789a51591SEric Biggers
3889a51591SEric Biggersquiet_cmd_crc32 = GEN     $@
3989a51591SEric Biggers      cmd_crc32 = $< > $@
4089a51591SEric Biggers
4189a51591SEric Biggersquiet_cmd_crc64 = GEN     $@
4289a51591SEric Biggers      cmd_crc64 = $< > $@
4389a51591SEric Biggers
4489a51591SEric Biggers$(obj)/crc32table.h: $(obj)/gen_crc32table
4589a51591SEric Biggers	$(call cmd,crc32)
4689a51591SEric Biggers
4789a51591SEric Biggers$(obj)/crc64table.h: $(obj)/gen_crc64table
4889a51591SEric Biggers	$(call cmd,crc64)
49