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