xref: /linux/lib/raid6/Makefile (revision 63307d015b91e626c97bb82e88054af3d0b74643)
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_S390) += s390vx8.o recov_s390xc.o
12
13hostprogs-y	+= mktables
14
15quiet_cmd_unroll = UNROLL  $@
16      cmd_unroll = $(AWK) -f$(srctree)/$(src)/unroll.awk -vN=$(UNROLL) < $< > $@
17
18ifeq ($(CONFIG_ALTIVEC),y)
19altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
20
21ifdef CONFIG_CC_IS_CLANG
22# clang ppc port does not yet support -maltivec when -msoft-float is
23# enabled. A future release of clang will resolve this
24# https://bugs.llvm.org/show_bug.cgi?id=31177
25CFLAGS_REMOVE_altivec1.o  += -msoft-float
26CFLAGS_REMOVE_altivec2.o  += -msoft-float
27CFLAGS_REMOVE_altivec4.o  += -msoft-float
28CFLAGS_REMOVE_altivec8.o  += -msoft-float
29CFLAGS_REMOVE_altivec8.o  += -msoft-float
30CFLAGS_REMOVE_vpermxor1.o += -msoft-float
31CFLAGS_REMOVE_vpermxor2.o += -msoft-float
32CFLAGS_REMOVE_vpermxor4.o += -msoft-float
33CFLAGS_REMOVE_vpermxor8.o += -msoft-float
34endif
35endif
36
37# The GCC option -ffreestanding is required in order to compile code containing
38# ARM/NEON intrinsics in a non C99-compliant environment (such as the kernel)
39ifeq ($(CONFIG_KERNEL_MODE_NEON),y)
40NEON_FLAGS := -ffreestanding
41ifeq ($(ARCH),arm)
42NEON_FLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon
43endif
44CFLAGS_recov_neon_inner.o += $(NEON_FLAGS)
45ifeq ($(ARCH),arm64)
46CFLAGS_REMOVE_recov_neon_inner.o += -mgeneral-regs-only
47CFLAGS_REMOVE_neon1.o += -mgeneral-regs-only
48CFLAGS_REMOVE_neon2.o += -mgeneral-regs-only
49CFLAGS_REMOVE_neon4.o += -mgeneral-regs-only
50CFLAGS_REMOVE_neon8.o += -mgeneral-regs-only
51endif
52endif
53
54targets += int1.c
55$(obj)/int1.c:   UNROLL := 1
56$(obj)/int1.c:   $(src)/int.uc $(src)/unroll.awk FORCE
57	$(call if_changed,unroll)
58
59targets += int2.c
60$(obj)/int2.c:   UNROLL := 2
61$(obj)/int2.c:   $(src)/int.uc $(src)/unroll.awk FORCE
62	$(call if_changed,unroll)
63
64targets += int4.c
65$(obj)/int4.c:   UNROLL := 4
66$(obj)/int4.c:   $(src)/int.uc $(src)/unroll.awk FORCE
67	$(call if_changed,unroll)
68
69targets += int8.c
70$(obj)/int8.c:   UNROLL := 8
71$(obj)/int8.c:   $(src)/int.uc $(src)/unroll.awk FORCE
72	$(call if_changed,unroll)
73
74targets += int16.c
75$(obj)/int16.c:  UNROLL := 16
76$(obj)/int16.c:  $(src)/int.uc $(src)/unroll.awk FORCE
77	$(call if_changed,unroll)
78
79targets += int32.c
80$(obj)/int32.c:  UNROLL := 32
81$(obj)/int32.c:  $(src)/int.uc $(src)/unroll.awk FORCE
82	$(call if_changed,unroll)
83
84CFLAGS_altivec1.o += $(altivec_flags)
85targets += altivec1.c
86$(obj)/altivec1.c:   UNROLL := 1
87$(obj)/altivec1.c:   $(src)/altivec.uc $(src)/unroll.awk FORCE
88	$(call if_changed,unroll)
89
90CFLAGS_altivec2.o += $(altivec_flags)
91targets += altivec2.c
92$(obj)/altivec2.c:   UNROLL := 2
93$(obj)/altivec2.c:   $(src)/altivec.uc $(src)/unroll.awk FORCE
94	$(call if_changed,unroll)
95
96CFLAGS_altivec4.o += $(altivec_flags)
97targets += altivec4.c
98$(obj)/altivec4.c:   UNROLL := 4
99$(obj)/altivec4.c:   $(src)/altivec.uc $(src)/unroll.awk FORCE
100	$(call if_changed,unroll)
101
102CFLAGS_altivec8.o += $(altivec_flags)
103targets += altivec8.c
104$(obj)/altivec8.c:   UNROLL := 8
105$(obj)/altivec8.c:   $(src)/altivec.uc $(src)/unroll.awk FORCE
106	$(call if_changed,unroll)
107
108CFLAGS_vpermxor1.o += $(altivec_flags)
109targets += vpermxor1.c
110$(obj)/vpermxor1.c: UNROLL := 1
111$(obj)/vpermxor1.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
112	$(call if_changed,unroll)
113
114CFLAGS_vpermxor2.o += $(altivec_flags)
115targets += vpermxor2.c
116$(obj)/vpermxor2.c: UNROLL := 2
117$(obj)/vpermxor2.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
118	$(call if_changed,unroll)
119
120CFLAGS_vpermxor4.o += $(altivec_flags)
121targets += vpermxor4.c
122$(obj)/vpermxor4.c: UNROLL := 4
123$(obj)/vpermxor4.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
124	$(call if_changed,unroll)
125
126CFLAGS_vpermxor8.o += $(altivec_flags)
127targets += vpermxor8.c
128$(obj)/vpermxor8.c: UNROLL := 8
129$(obj)/vpermxor8.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
130	$(call if_changed,unroll)
131
132CFLAGS_neon1.o += $(NEON_FLAGS)
133targets += neon1.c
134$(obj)/neon1.c:   UNROLL := 1
135$(obj)/neon1.c:   $(src)/neon.uc $(src)/unroll.awk FORCE
136	$(call if_changed,unroll)
137
138CFLAGS_neon2.o += $(NEON_FLAGS)
139targets += neon2.c
140$(obj)/neon2.c:   UNROLL := 2
141$(obj)/neon2.c:   $(src)/neon.uc $(src)/unroll.awk FORCE
142	$(call if_changed,unroll)
143
144CFLAGS_neon4.o += $(NEON_FLAGS)
145targets += neon4.c
146$(obj)/neon4.c:   UNROLL := 4
147$(obj)/neon4.c:   $(src)/neon.uc $(src)/unroll.awk FORCE
148	$(call if_changed,unroll)
149
150CFLAGS_neon8.o += $(NEON_FLAGS)
151targets += neon8.c
152$(obj)/neon8.c:   UNROLL := 8
153$(obj)/neon8.c:   $(src)/neon.uc $(src)/unroll.awk FORCE
154	$(call if_changed,unroll)
155
156targets += s390vx8.c
157$(obj)/s390vx8.c:   UNROLL := 8
158$(obj)/s390vx8.c:   $(src)/s390vx.uc $(src)/unroll.awk FORCE
159	$(call if_changed,unroll)
160
161quiet_cmd_mktable = TABLE   $@
162      cmd_mktable = $(obj)/mktables > $@
163
164targets += tables.c
165$(obj)/tables.c: $(obj)/mktables FORCE
166	$(call if_changed,mktable)
167