xref: /linux/lib/raid6/Makefile (revision dd40c5b4c90d84d30cdb452c2d193d6fb42247df)
1# SPDX-License-Identifier: GPL-2.0
2obj-$(CONFIG_RAID6_PQ)	+= raid6_pq.o
3
4raid6_pq-y	+= algos.o recov.o tables.o int1.o int2.o int4.o \
5		   int8.o int16.o int32.o
6
7raid6_pq-$(CONFIG_X86) += recov_ssse3.o recov_avx2.o mmx.o sse1.o sse2.o avx2.o avx512.o recov_avx512.o
8raid6_pq-$(CONFIG_ALTIVEC) += altivec1.o altivec2.o altivec4.o altivec8.o \
9                              vpermxor1.o vpermxor2.o vpermxor4.o vpermxor8.o
10raid6_pq-$(CONFIG_KERNEL_MODE_NEON) += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o
11raid6_pq-$(CONFIG_TILEGX) += tilegx8.o
12raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o
13
14hostprogs-y	+= mktables
15
16quiet_cmd_unroll = UNROLL  $@
17      cmd_unroll = $(AWK) -f$(srctree)/$(src)/unroll.awk -vN=$(UNROLL) \
18                   < $< > $@ || ( rm -f $@ && exit 1 )
19
20ifeq ($(CONFIG_ALTIVEC),y)
21altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
22endif
23
24# The GCC option -ffreestanding is required in order to compile code containing
25# ARM/NEON intrinsics in a non C99-compliant environment (such as the kernel)
26ifeq ($(CONFIG_KERNEL_MODE_NEON),y)
27NEON_FLAGS := -ffreestanding
28ifeq ($(ARCH),arm)
29NEON_FLAGS += -mfloat-abi=softfp -mfpu=neon
30endif
31CFLAGS_recov_neon_inner.o += $(NEON_FLAGS)
32ifeq ($(ARCH),arm64)
33CFLAGS_REMOVE_recov_neon_inner.o += -mgeneral-regs-only
34CFLAGS_REMOVE_neon1.o += -mgeneral-regs-only
35CFLAGS_REMOVE_neon2.o += -mgeneral-regs-only
36CFLAGS_REMOVE_neon4.o += -mgeneral-regs-only
37CFLAGS_REMOVE_neon8.o += -mgeneral-regs-only
38endif
39endif
40
41targets += int1.c
42$(obj)/int1.c:   UNROLL := 1
43$(obj)/int1.c:   $(src)/int.uc $(src)/unroll.awk FORCE
44	$(call if_changed,unroll)
45
46targets += int2.c
47$(obj)/int2.c:   UNROLL := 2
48$(obj)/int2.c:   $(src)/int.uc $(src)/unroll.awk FORCE
49	$(call if_changed,unroll)
50
51targets += int4.c
52$(obj)/int4.c:   UNROLL := 4
53$(obj)/int4.c:   $(src)/int.uc $(src)/unroll.awk FORCE
54	$(call if_changed,unroll)
55
56targets += int8.c
57$(obj)/int8.c:   UNROLL := 8
58$(obj)/int8.c:   $(src)/int.uc $(src)/unroll.awk FORCE
59	$(call if_changed,unroll)
60
61targets += int16.c
62$(obj)/int16.c:  UNROLL := 16
63$(obj)/int16.c:  $(src)/int.uc $(src)/unroll.awk FORCE
64	$(call if_changed,unroll)
65
66targets += int32.c
67$(obj)/int32.c:  UNROLL := 32
68$(obj)/int32.c:  $(src)/int.uc $(src)/unroll.awk FORCE
69	$(call if_changed,unroll)
70
71CFLAGS_altivec1.o += $(altivec_flags)
72targets += altivec1.c
73$(obj)/altivec1.c:   UNROLL := 1
74$(obj)/altivec1.c:   $(src)/altivec.uc $(src)/unroll.awk FORCE
75	$(call if_changed,unroll)
76
77CFLAGS_altivec2.o += $(altivec_flags)
78targets += altivec2.c
79$(obj)/altivec2.c:   UNROLL := 2
80$(obj)/altivec2.c:   $(src)/altivec.uc $(src)/unroll.awk FORCE
81	$(call if_changed,unroll)
82
83CFLAGS_altivec4.o += $(altivec_flags)
84targets += altivec4.c
85$(obj)/altivec4.c:   UNROLL := 4
86$(obj)/altivec4.c:   $(src)/altivec.uc $(src)/unroll.awk FORCE
87	$(call if_changed,unroll)
88
89CFLAGS_altivec8.o += $(altivec_flags)
90targets += altivec8.c
91$(obj)/altivec8.c:   UNROLL := 8
92$(obj)/altivec8.c:   $(src)/altivec.uc $(src)/unroll.awk FORCE
93	$(call if_changed,unroll)
94
95CFLAGS_vpermxor1.o += $(altivec_flags)
96targets += vpermxor1.c
97$(obj)/vpermxor1.c: UNROLL := 1
98$(obj)/vpermxor1.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
99	$(call if_changed,unroll)
100
101CFLAGS_vpermxor2.o += $(altivec_flags)
102targets += vpermxor2.c
103$(obj)/vpermxor2.c: UNROLL := 2
104$(obj)/vpermxor2.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
105	$(call if_changed,unroll)
106
107CFLAGS_vpermxor4.o += $(altivec_flags)
108targets += vpermxor4.c
109$(obj)/vpermxor4.c: UNROLL := 4
110$(obj)/vpermxor4.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
111	$(call if_changed,unroll)
112
113CFLAGS_vpermxor8.o += $(altivec_flags)
114targets += vpermxor8.c
115$(obj)/vpermxor8.c: UNROLL := 8
116$(obj)/vpermxor8.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
117	$(call if_changed,unroll)
118
119CFLAGS_neon1.o += $(NEON_FLAGS)
120targets += neon1.c
121$(obj)/neon1.c:   UNROLL := 1
122$(obj)/neon1.c:   $(src)/neon.uc $(src)/unroll.awk FORCE
123	$(call if_changed,unroll)
124
125CFLAGS_neon2.o += $(NEON_FLAGS)
126targets += neon2.c
127$(obj)/neon2.c:   UNROLL := 2
128$(obj)/neon2.c:   $(src)/neon.uc $(src)/unroll.awk FORCE
129	$(call if_changed,unroll)
130
131CFLAGS_neon4.o += $(NEON_FLAGS)
132targets += neon4.c
133$(obj)/neon4.c:   UNROLL := 4
134$(obj)/neon4.c:   $(src)/neon.uc $(src)/unroll.awk FORCE
135	$(call if_changed,unroll)
136
137CFLAGS_neon8.o += $(NEON_FLAGS)
138targets += neon8.c
139$(obj)/neon8.c:   UNROLL := 8
140$(obj)/neon8.c:   $(src)/neon.uc $(src)/unroll.awk FORCE
141	$(call if_changed,unroll)
142
143targets += tilegx8.c
144$(obj)/tilegx8.c:   UNROLL := 8
145$(obj)/tilegx8.c:   $(src)/tilegx.uc $(src)/unroll.awk FORCE
146	$(call if_changed,unroll)
147
148targets += s390vx8.c
149$(obj)/s390vx8.c:   UNROLL := 8
150$(obj)/s390vx8.c:   $(src)/s390vx.uc $(src)/unroll.awk FORCE
151	$(call if_changed,unroll)
152
153quiet_cmd_mktable = TABLE   $@
154      cmd_mktable = $(obj)/mktables > $@ || ( rm -f $@ && exit 1 )
155
156targets += tables.c
157$(obj)/tables.c: $(obj)/mktables FORCE
158	$(call if_changed,mktable)
159