xref: /linux/lib/raid/raid6/Makefile (revision 3626738bc7147d52cb49f3994a9846aa2d34810a)
1# SPDX-License-Identifier: GPL-2.0
2
3ccflags-y			+= -I $(src)
4
5obj-$(CONFIG_RAID6_PQ)		+= raid6_pq.o tests/
6
7raid6_pq-y			+= algos.o tables.o
8
9# generic integer generation and recovery implementation
10raid6_pq-y			+= int1.o int2.o int4.o int8.o
11raid6_pq-y			+= recov.o
12
13# architecture-specific generation and recovery implementations:
14raid6_pq-$(CONFIG_KERNEL_MODE_NEON) += arm/neon.o \
15				   arm/neon1.o \
16				   arm/neon2.o \
17				   arm/neon4.o \
18				   arm/neon8.o \
19				   arm/recov_neon.o \
20				   arm/recov_neon_inner.o
21raid6_pq-$(CONFIG_LOONGARCH)	+= loongarch/loongarch_simd.o \
22				   loongarch/recov_loongarch_simd.o
23raid6_pq-$(CONFIG_ALTIVEC)	+= powerpc/altivec1.o \
24				   powerpc/altivec2.o \
25				   powerpc/altivec4.o \
26				   powerpc/altivec8.o \
27				   powerpc/vpermxor1.o \
28				   powerpc/vpermxor2.o \
29				   powerpc/vpermxor4.o \
30				   powerpc/vpermxor8.o
31raid6_pq-$(CONFIG_RISCV_ISA_V)	+= riscv/rvv.o \
32				   riscv/recov_rvv.o
33raid6_pq-$(CONFIG_S390)		+= s390/s390vx8.o \
34				   s390/recov_s390xc.o
35ifeq ($(CONFIG_X86),y)
36raid6_pq-$(CONFIG_X86_32)	+= x86/mmx.o \
37				   x86/sse1.o
38endif
39raid6_pq-$(CONFIG_X86)		+= x86/sse2.o \
40				   x86/avx2.o \
41				   x86/avx512.o \
42				   x86/recov_ssse3.o \
43				   x86/recov_avx2.o \
44				   x86/recov_avx512.o
45
46hostprogs			+= mktables
47
48CFLAGS_arm/neon1.o += $(CC_FLAGS_FPU)
49CFLAGS_arm/neon2.o += $(CC_FLAGS_FPU)
50CFLAGS_arm/neon4.o += $(CC_FLAGS_FPU)
51CFLAGS_arm/neon8.o += $(CC_FLAGS_FPU)
52CFLAGS_arm/recov_neon_inner.o += $(CC_FLAGS_FPU)
53CFLAGS_REMOVE_arm/neon1.o += $(CC_FLAGS_NO_FPU)
54CFLAGS_REMOVE_arm/neon2.o += $(CC_FLAGS_NO_FPU)
55CFLAGS_REMOVE_arm/neon4.o += $(CC_FLAGS_NO_FPU)
56CFLAGS_REMOVE_arm/neon8.o += $(CC_FLAGS_NO_FPU)
57CFLAGS_REMOVE_arm/recov_neon_inner.o += $(CC_FLAGS_NO_FPU)
58
59ifeq ($(CONFIG_ALTIVEC),y)
60altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
61# Enable <altivec.h>
62altivec_flags += -isystem $(shell $(CC) -print-file-name=include)
63
64CFLAGS_powerpc/altivec1.o += $(altivec_flags)
65CFLAGS_powerpc/altivec2.o += $(altivec_flags)
66CFLAGS_powerpc/altivec4.o += $(altivec_flags)
67CFLAGS_powerpc/altivec8.o += $(altivec_flags)
68CFLAGS_powerpc/vpermxor1.o += $(altivec_flags)
69CFLAGS_powerpc/vpermxor2.o += $(altivec_flags)
70CFLAGS_powerpc/vpermxor4.o += $(altivec_flags)
71CFLAGS_powerpc/vpermxor8.o += $(altivec_flags)
72
73ifdef CONFIG_CC_IS_CLANG
74# clang ppc port does not yet support -maltivec when -msoft-float is
75# enabled. A future release of clang will resolve this
76# https://llvm.org/pr31177
77CFLAGS_REMOVE_powerpc/altivec1.o  += -msoft-float
78CFLAGS_REMOVE_powerpc/altivec2.o  += -msoft-float
79CFLAGS_REMOVE_powerpc/altivec4.o  += -msoft-float
80CFLAGS_REMOVE_powerpc/altivec8.o  += -msoft-float
81CFLAGS_REMOVE_powerpc/vpermxor1.o += -msoft-float
82CFLAGS_REMOVE_powerpc/vpermxor2.o += -msoft-float
83CFLAGS_REMOVE_powerpc/vpermxor4.o += -msoft-float
84CFLAGS_REMOVE_powerpc/vpermxor8.o += -msoft-float
85endif # CONFIG_CC_IS_CLANG
86endif # CONFIG_ALTIVEC
87
88quiet_cmd_mktable = TABLE   $@
89      cmd_mktable = $(obj)/mktables > $@
90
91targets += tables.c
92$(obj)/tables.c: $(obj)/mktables FORCE
93	$(call if_changed,mktable)
94
95quiet_cmd_unroll = UNROLL  $@
96      cmd_unroll = $(AWK) -v N=$* -f $(src)/unroll.awk < $< > $@
97
98targets += int1.c int2.c int4.c int8.c
99$(obj)/int%.c: $(src)/int.uc $(src)/unroll.awk FORCE
100	$(call if_changed,unroll)
101
102targets += arm/neon1.c arm/neon2.c arm/neon4.c arm/neon8.c
103$(obj)/arm/neon%.c: $(src)/arm/neon.uc $(src)/unroll.awk FORCE
104	$(call if_changed,unroll)
105
106targets += powerpc/altivec1.c \
107	   powerpc/altivec2.c \
108	   powerpc/altivec4.c \
109	   powerpc/altivec8.c
110$(obj)/powerpc/altivec%.c: $(src)/powerpc/altivec.uc $(src)/unroll.awk FORCE
111	$(call if_changed,unroll)
112
113targets += powerpc/vpermxor1.c \
114	   powerpc/vpermxor2.c \
115	   powerpc/vpermxor4.c \
116	   powerpc/vpermxor8.c
117$(obj)/powerpc/vpermxor%.c: $(src)/powerpc/vpermxor.uc $(src)/unroll.awk FORCE
118	$(call if_changed,unroll)
119
120targets += s390/s390vx8.c
121$(obj)/s390/s390vx%.c: $(src)/s390/s390vx.uc $(src)/unroll.awk FORCE
122	$(call if_changed,unroll)
123