1 # SPDX-License-Identifier: GPL-2.0 1 # SPDX-License-Identifier: GPL-2.0 2 # 2 # 3 # This is a simple Makefile to test some of th 3 # This is a simple Makefile to test some of the RAID-6 code 4 # from userspace. 4 # from userspace. 5 # 5 # 6 6 7 pound := \# 7 pound := \# 8 8 9 # Adjust as desired !! 9 CC = gcc 10 CC = gcc !! 10 OPTFLAGS = -O2 # Adjust as desired 11 OPTFLAGS = -O2 !! 11 CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS) 12 CFLAGS = -I.. -I ../../../include -g $(OPTFL !! 12 LD = ld 13 LD = ld !! 13 AWK = awk -f 14 AWK = awk -f !! 14 AR = ar 15 AR = ar !! 15 RANLIB = ranlib 16 RANLIB = ranlib !! 16 OBJS = int1.o int2.o int4.o int8.o int16.o int32.o recov.o algos.o tables.o 17 OBJS = int1.o int2.o int4.o int8.o int16.o << 18 17 19 ARCH := $(shell uname -m 2>/dev/null | sed -e 18 ARCH := $(shell uname -m 2>/dev/null | sed -e /s/i.86/i386/) 20 ifeq ($(ARCH),i386) 19 ifeq ($(ARCH),i386) 21 CFLAGS += -DCONFIG_X86_32 20 CFLAGS += -DCONFIG_X86_32 22 IS_X86 = yes 21 IS_X86 = yes 23 endif 22 endif 24 ifeq ($(ARCH),x86_64) 23 ifeq ($(ARCH),x86_64) 25 CFLAGS += -DCONFIG_X86_64 24 CFLAGS += -DCONFIG_X86_64 26 IS_X86 = yes 25 IS_X86 = yes 27 endif 26 endif 28 27 29 ifeq ($(ARCH),arm) 28 ifeq ($(ARCH),arm) 30 CFLAGS += -I../../../arch/arm/include 29 CFLAGS += -I../../../arch/arm/include -mfpu=neon 31 HAS_NEON = yes 30 HAS_NEON = yes 32 endif 31 endif 33 ifeq ($(ARCH),aarch64) 32 ifeq ($(ARCH),aarch64) 34 CFLAGS += -I../../../arch/arm64/includ 33 CFLAGS += -I../../../arch/arm64/include 35 HAS_NEON = yes 34 HAS_NEON = yes 36 endif 35 endif 37 36 38 ifeq ($(findstring ppc,$(ARCH)),ppc) << 39 CFLAGS += -I../../../arch/powerpc/incl << 40 HAS_ALTIVEC := $(shell printf '$(pound << 41 gcc -c -x c - >/dev/n << 42 endif << 43 << 44 ifeq ($(ARCH),loongarch64) << 45 CFLAGS += -I../../../arch/loongarch/in << 46 CFLAGS += $(shell echo 'vld $$vr0, $$z << 47 gcc -c -x assembler - >/de << 48 rm ./-.o && echo -DCONFIG_ << 49 CFLAGS += $(shell echo 'xvld $$xr0, $$ << 50 gcc -c -x assembler - >/de << 51 rm ./-.o && echo -DCONFIG_ << 52 endif << 53 << 54 ifeq ($(IS_X86),yes) 37 ifeq ($(IS_X86),yes) 55 OBJS += mmx.o sse1.o sse2.o avx2.o r 38 OBJS += mmx.o sse1.o sse2.o avx2.o recov_ssse3.o recov_avx2.o avx512.o recov_avx512.o 56 CFLAGS += -DCONFIG_X86 !! 39 CFLAGS += $(shell echo "pshufb %xmm0, %xmm0" | \ 57 CFLAGS += $(shell echo "vpmovm2b %k1, !! 40 gcc -c -x assembler - >/dev/null 2>&1 && \ 58 gcc -c -x assembler - >/de !! 41 rm ./-.o && echo -DCONFIG_AS_SSSE3=1) 59 rm ./-.o && echo -DCONFIG_ !! 42 CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1" | \ >> 43 gcc -c -x assembler - >/dev/null 2>&1 && \ >> 44 rm ./-.o && echo -DCONFIG_AS_AVX2=1) >> 45 CFLAGS += $(shell echo "vpmovm2b %k1, %zmm5" | \ >> 46 gcc -c -x assembler - >/dev/null 2>&1 && \ >> 47 rm ./-.o && echo -DCONFIG_AS_AVX512=1) 60 else ifeq ($(HAS_NEON),yes) 48 else ifeq ($(HAS_NEON),yes) 61 OBJS += neon.o neon1.o neon2.o neon4 49 OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o 62 CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1 50 CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1 63 else ifeq ($(HAS_ALTIVEC),yes) !! 51 else 64 CFLAGS += -DCONFIG_ALTIVEC !! 52 HAS_ALTIVEC := $(shell printf '$(pound)include <altivec.h>\nvector int a;\n' |\ 65 OBJS += altivec1.o altivec2.o altivec4 !! 53 gcc -c -x c - >/dev/null && rm ./-.o && echo yes) 66 vpermxor1.o vpermxor2.o vpermx !! 54 ifeq ($(HAS_ALTIVEC),yes) 67 else ifeq ($(ARCH),loongarch64) !! 55 CFLAGS += -I../../../arch/powerpc/include 68 OBJS += loongarch_simd.o recov_loongar !! 56 CFLAGS += -DCONFIG_ALTIVEC >> 57 OBJS += altivec1.o altivec2.o altivec4.o altivec8.o \ >> 58 vpermxor1.o vpermxor2.o vpermxor4.o vpermxor8.o >> 59 endif 69 endif 60 endif 70 61 71 .c.o: 62 .c.o: 72 $(CC) $(CFLAGS) -c -o $@ $< 63 $(CC) $(CFLAGS) -c -o $@ $< 73 64 74 %.c: ../%.c 65 %.c: ../%.c 75 cp -f $< $@ 66 cp -f $< $@ 76 67 77 %.uc: ../%.uc 68 %.uc: ../%.uc 78 cp -f $< $@ 69 cp -f $< $@ 79 70 80 all: raid6.a raid6test !! 71 all: raid6.a raid6test 81 72 82 raid6.a: $(OBJS) 73 raid6.a: $(OBJS) 83 rm -f $@ !! 74 rm -f $@ 84 $(AR) cq $@ $^ !! 75 $(AR) cq $@ $^ 85 $(RANLIB) $@ !! 76 $(RANLIB) $@ 86 77 87 raid6test: test.c raid6.a 78 raid6test: test.c raid6.a 88 $(CC) $(CFLAGS) -o raid6test $^ 79 $(CC) $(CFLAGS) -o raid6test $^ 89 80 90 neon1.c: neon.uc ../unroll.awk 81 neon1.c: neon.uc ../unroll.awk 91 $(AWK) ../unroll.awk -vN=1 < neon.uc > 82 $(AWK) ../unroll.awk -vN=1 < neon.uc > $@ 92 83 93 neon2.c: neon.uc ../unroll.awk 84 neon2.c: neon.uc ../unroll.awk 94 $(AWK) ../unroll.awk -vN=2 < neon.uc > 85 $(AWK) ../unroll.awk -vN=2 < neon.uc > $@ 95 86 96 neon4.c: neon.uc ../unroll.awk 87 neon4.c: neon.uc ../unroll.awk 97 $(AWK) ../unroll.awk -vN=4 < neon.uc > 88 $(AWK) ../unroll.awk -vN=4 < neon.uc > $@ 98 89 99 neon8.c: neon.uc ../unroll.awk 90 neon8.c: neon.uc ../unroll.awk 100 $(AWK) ../unroll.awk -vN=8 < neon.uc > 91 $(AWK) ../unroll.awk -vN=8 < neon.uc > $@ 101 92 102 altivec1.c: altivec.uc ../unroll.awk 93 altivec1.c: altivec.uc ../unroll.awk 103 $(AWK) ../unroll.awk -vN=1 < altivec.u 94 $(AWK) ../unroll.awk -vN=1 < altivec.uc > $@ 104 95 105 altivec2.c: altivec.uc ../unroll.awk 96 altivec2.c: altivec.uc ../unroll.awk 106 $(AWK) ../unroll.awk -vN=2 < altivec.u 97 $(AWK) ../unroll.awk -vN=2 < altivec.uc > $@ 107 98 108 altivec4.c: altivec.uc ../unroll.awk 99 altivec4.c: altivec.uc ../unroll.awk 109 $(AWK) ../unroll.awk -vN=4 < altivec.u 100 $(AWK) ../unroll.awk -vN=4 < altivec.uc > $@ 110 101 111 altivec8.c: altivec.uc ../unroll.awk 102 altivec8.c: altivec.uc ../unroll.awk 112 $(AWK) ../unroll.awk -vN=8 < altivec.u 103 $(AWK) ../unroll.awk -vN=8 < altivec.uc > $@ 113 104 114 vpermxor1.c: vpermxor.uc ../unroll.awk 105 vpermxor1.c: vpermxor.uc ../unroll.awk 115 $(AWK) ../unroll.awk -vN=1 < vpermxor. 106 $(AWK) ../unroll.awk -vN=1 < vpermxor.uc > $@ 116 107 117 vpermxor2.c: vpermxor.uc ../unroll.awk 108 vpermxor2.c: vpermxor.uc ../unroll.awk 118 $(AWK) ../unroll.awk -vN=2 < vpermxor. 109 $(AWK) ../unroll.awk -vN=2 < vpermxor.uc > $@ 119 110 120 vpermxor4.c: vpermxor.uc ../unroll.awk 111 vpermxor4.c: vpermxor.uc ../unroll.awk 121 $(AWK) ../unroll.awk -vN=4 < vpermxor. 112 $(AWK) ../unroll.awk -vN=4 < vpermxor.uc > $@ 122 113 123 vpermxor8.c: vpermxor.uc ../unroll.awk 114 vpermxor8.c: vpermxor.uc ../unroll.awk 124 $(AWK) ../unroll.awk -vN=8 < vpermxor. 115 $(AWK) ../unroll.awk -vN=8 < vpermxor.uc > $@ 125 116 126 int1.c: int.uc ../unroll.awk 117 int1.c: int.uc ../unroll.awk 127 $(AWK) ../unroll.awk -vN=1 < int.uc > 118 $(AWK) ../unroll.awk -vN=1 < int.uc > $@ 128 119 129 int2.c: int.uc ../unroll.awk 120 int2.c: int.uc ../unroll.awk 130 $(AWK) ../unroll.awk -vN=2 < int.uc > 121 $(AWK) ../unroll.awk -vN=2 < int.uc > $@ 131 122 132 int4.c: int.uc ../unroll.awk 123 int4.c: int.uc ../unroll.awk 133 $(AWK) ../unroll.awk -vN=4 < int.uc > 124 $(AWK) ../unroll.awk -vN=4 < int.uc > $@ 134 125 135 int8.c: int.uc ../unroll.awk 126 int8.c: int.uc ../unroll.awk 136 $(AWK) ../unroll.awk -vN=8 < int.uc > 127 $(AWK) ../unroll.awk -vN=8 < int.uc > $@ 137 128 138 int16.c: int.uc ../unroll.awk 129 int16.c: int.uc ../unroll.awk 139 $(AWK) ../unroll.awk -vN=16 < int.uc > 130 $(AWK) ../unroll.awk -vN=16 < int.uc > $@ 140 131 141 int32.c: int.uc ../unroll.awk 132 int32.c: int.uc ../unroll.awk 142 $(AWK) ../unroll.awk -vN=32 < int.uc > 133 $(AWK) ../unroll.awk -vN=32 < int.uc > $@ 143 134 144 tables.c: mktables 135 tables.c: mktables 145 ./mktables > tables.c 136 ./mktables > tables.c 146 137 147 clean: 138 clean: 148 rm -f *.o *.a mktables mktables.c *.uc 139 rm -f *.o *.a mktables mktables.c *.uc int*.c altivec*.c vpermxor*.c neon*.c tables.c raid6test 149 140 150 spotless: clean 141 spotless: clean 151 rm -f *~ 142 rm -f *~
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.