Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
David Woodhouse | cc4589e | 2010-08-11 00:19:05 +0100 | [diff] [blame] | 2 | # |
| 3 | # This is a simple Makefile to test some of the RAID-6 code |
| 4 | # from userspace. |
| 5 | # |
| 6 | |
| 7 | CC = gcc |
| 8 | OPTFLAGS = -O2 # Adjust as desired |
| 9 | CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS) |
| 10 | LD = ld |
| 11 | AWK = awk -f |
| 12 | AR = ar |
| 13 | RANLIB = ranlib |
Yuanhan Liu | 4f8c55c | 2012-11-30 13:10:40 -0800 | [diff] [blame] | 14 | OBJS = int1.o int2.o int4.o int8.o int16.o int32.o recov.o algos.o tables.o |
David Woodhouse | cc4589e | 2010-08-11 00:19:05 +0100 | [diff] [blame] | 15 | |
Yuanhan Liu | 2c93584 | 2012-11-30 13:10:39 -0800 | [diff] [blame] | 16 | ARCH := $(shell uname -m 2>/dev/null | sed -e /s/i.86/i386/) |
| 17 | ifeq ($(ARCH),i386) |
| 18 | CFLAGS += -DCONFIG_X86_32 |
Yuanhan Liu | 4f8c55c | 2012-11-30 13:10:40 -0800 | [diff] [blame] | 19 | IS_X86 = yes |
Yuanhan Liu | 2c93584 | 2012-11-30 13:10:39 -0800 | [diff] [blame] | 20 | endif |
| 21 | ifeq ($(ARCH),x86_64) |
| 22 | CFLAGS += -DCONFIG_X86_64 |
Yuanhan Liu | 4f8c55c | 2012-11-30 13:10:40 -0800 | [diff] [blame] | 23 | IS_X86 = yes |
Yuanhan Liu | 2c93584 | 2012-11-30 13:10:39 -0800 | [diff] [blame] | 24 | endif |
Yuanhan Liu | 4f8c55c | 2012-11-30 13:10:40 -0800 | [diff] [blame] | 25 | |
Ard Biesheuvel | 7d11965 | 2013-05-16 17:20:32 +0200 | [diff] [blame] | 26 | ifeq ($(ARCH),arm) |
| 27 | CFLAGS += -I../../../arch/arm/include -mfpu=neon |
| 28 | HAS_NEON = yes |
| 29 | endif |
Jeremy Linton | 313a06e | 2018-11-05 18:14:41 -0600 | [diff] [blame] | 30 | ifeq ($(ARCH),aarch64) |
Ard Biesheuvel | 7d11965 | 2013-05-16 17:20:32 +0200 | [diff] [blame] | 31 | CFLAGS += -I../../../arch/arm64/include |
| 32 | HAS_NEON = yes |
| 33 | endif |
| 34 | |
Yuanhan Liu | 4f8c55c | 2012-11-30 13:10:40 -0800 | [diff] [blame] | 35 | ifeq ($(IS_X86),yes) |
Gayatri Kammela | 161db5d | 2016-08-12 18:03:21 -0700 | [diff] [blame] | 36 | OBJS += mmx.o sse1.o sse2.o avx2.o recov_ssse3.o recov_avx2.o avx512.o recov_avx512.o |
Masahiro Yamada | 92203b0 | 2020-03-26 17:00:54 +0900 | [diff] [blame] | 37 | CFLAGS += -DCONFIG_X86 |
Gayatri Kammela | 161db5d | 2016-08-12 18:03:21 -0700 | [diff] [blame] | 38 | CFLAGS += $(shell echo "vpmovm2b %k1, %zmm5" | \ |
Masahiro Yamada | 06bd48b | 2020-03-26 17:00:49 +0900 | [diff] [blame] | 39 | gcc -c -x assembler - >/dev/null 2>&1 && \ |
Gayatri Kammela | 161db5d | 2016-08-12 18:03:21 -0700 | [diff] [blame] | 40 | rm ./-.o && echo -DCONFIG_AS_AVX512=1) |
Ard Biesheuvel | 7d11965 | 2013-05-16 17:20:32 +0200 | [diff] [blame] | 41 | else ifeq ($(HAS_NEON),yes) |
Jeremy Linton | 313a06e | 2018-11-05 18:14:41 -0600 | [diff] [blame] | 42 | OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o |
Ard Biesheuvel | 7d11965 | 2013-05-16 17:20:32 +0200 | [diff] [blame] | 43 | CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1 |
Yuanhan Liu | 4f8c55c | 2012-11-30 13:10:40 -0800 | [diff] [blame] | 44 | else |
Max Filippov | c28399b | 2013-08-22 18:53:06 +0400 | [diff] [blame] | 45 | HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\ |
Matt Brown | aa9532d | 2017-08-04 13:42:33 +1000 | [diff] [blame] | 46 | gcc -c -x c - >/dev/null && rm ./-.o && echo yes) |
Yuanhan Liu | 4f8c55c | 2012-11-30 13:10:40 -0800 | [diff] [blame] | 47 | ifeq ($(HAS_ALTIVEC),yes) |
Matt Brown | aa9532d | 2017-08-04 13:42:33 +1000 | [diff] [blame] | 48 | CFLAGS += -I../../../arch/powerpc/include |
| 49 | CFLAGS += -DCONFIG_ALTIVEC |
Matt Brown | 751ba79 | 2017-08-04 13:42:32 +1000 | [diff] [blame] | 50 | OBJS += altivec1.o altivec2.o altivec4.o altivec8.o \ |
| 51 | vpermxor1.o vpermxor2.o vpermxor4.o vpermxor8.o |
Yuanhan Liu | 4f8c55c | 2012-11-30 13:10:40 -0800 | [diff] [blame] | 52 | endif |
| 53 | endif |
Yuanhan Liu | 2c93584 | 2012-11-30 13:10:39 -0800 | [diff] [blame] | 54 | |
David Woodhouse | cc4589e | 2010-08-11 00:19:05 +0100 | [diff] [blame] | 55 | .c.o: |
| 56 | $(CC) $(CFLAGS) -c -o $@ $< |
| 57 | |
| 58 | %.c: ../%.c |
| 59 | cp -f $< $@ |
| 60 | |
| 61 | %.uc: ../%.uc |
| 62 | cp -f $< $@ |
| 63 | |
| 64 | all: raid6.a raid6test |
| 65 | |
Yuanhan Liu | 4f8c55c | 2012-11-30 13:10:40 -0800 | [diff] [blame] | 66 | raid6.a: $(OBJS) |
David Woodhouse | cc4589e | 2010-08-11 00:19:05 +0100 | [diff] [blame] | 67 | rm -f $@ |
| 68 | $(AR) cq $@ $^ |
| 69 | $(RANLIB) $@ |
| 70 | |
| 71 | raid6test: test.c raid6.a |
| 72 | $(CC) $(CFLAGS) -o raid6test $^ |
| 73 | |
Ard Biesheuvel | 7d11965 | 2013-05-16 17:20:32 +0200 | [diff] [blame] | 74 | neon1.c: neon.uc ../unroll.awk |
| 75 | $(AWK) ../unroll.awk -vN=1 < neon.uc > $@ |
| 76 | |
| 77 | neon2.c: neon.uc ../unroll.awk |
| 78 | $(AWK) ../unroll.awk -vN=2 < neon.uc > $@ |
| 79 | |
| 80 | neon4.c: neon.uc ../unroll.awk |
| 81 | $(AWK) ../unroll.awk -vN=4 < neon.uc > $@ |
| 82 | |
| 83 | neon8.c: neon.uc ../unroll.awk |
| 84 | $(AWK) ../unroll.awk -vN=8 < neon.uc > $@ |
| 85 | |
David Woodhouse | cc4589e | 2010-08-11 00:19:05 +0100 | [diff] [blame] | 86 | altivec1.c: altivec.uc ../unroll.awk |
| 87 | $(AWK) ../unroll.awk -vN=1 < altivec.uc > $@ |
| 88 | |
| 89 | altivec2.c: altivec.uc ../unroll.awk |
| 90 | $(AWK) ../unroll.awk -vN=2 < altivec.uc > $@ |
| 91 | |
| 92 | altivec4.c: altivec.uc ../unroll.awk |
| 93 | $(AWK) ../unroll.awk -vN=4 < altivec.uc > $@ |
| 94 | |
| 95 | altivec8.c: altivec.uc ../unroll.awk |
| 96 | $(AWK) ../unroll.awk -vN=8 < altivec.uc > $@ |
| 97 | |
Matt Brown | 751ba79 | 2017-08-04 13:42:32 +1000 | [diff] [blame] | 98 | vpermxor1.c: vpermxor.uc ../unroll.awk |
| 99 | $(AWK) ../unroll.awk -vN=1 < vpermxor.uc > $@ |
| 100 | |
| 101 | vpermxor2.c: vpermxor.uc ../unroll.awk |
| 102 | $(AWK) ../unroll.awk -vN=2 < vpermxor.uc > $@ |
| 103 | |
| 104 | vpermxor4.c: vpermxor.uc ../unroll.awk |
| 105 | $(AWK) ../unroll.awk -vN=4 < vpermxor.uc > $@ |
| 106 | |
| 107 | vpermxor8.c: vpermxor.uc ../unroll.awk |
| 108 | $(AWK) ../unroll.awk -vN=8 < vpermxor.uc > $@ |
| 109 | |
David Woodhouse | cc4589e | 2010-08-11 00:19:05 +0100 | [diff] [blame] | 110 | int1.c: int.uc ../unroll.awk |
| 111 | $(AWK) ../unroll.awk -vN=1 < int.uc > $@ |
| 112 | |
| 113 | int2.c: int.uc ../unroll.awk |
| 114 | $(AWK) ../unroll.awk -vN=2 < int.uc > $@ |
| 115 | |
| 116 | int4.c: int.uc ../unroll.awk |
| 117 | $(AWK) ../unroll.awk -vN=4 < int.uc > $@ |
| 118 | |
| 119 | int8.c: int.uc ../unroll.awk |
| 120 | $(AWK) ../unroll.awk -vN=8 < int.uc > $@ |
| 121 | |
| 122 | int16.c: int.uc ../unroll.awk |
| 123 | $(AWK) ../unroll.awk -vN=16 < int.uc > $@ |
| 124 | |
| 125 | int32.c: int.uc ../unroll.awk |
| 126 | $(AWK) ../unroll.awk -vN=32 < int.uc > $@ |
| 127 | |
| 128 | tables.c: mktables |
| 129 | ./mktables > tables.c |
| 130 | |
| 131 | clean: |
Matt Brown | 751ba79 | 2017-08-04 13:42:32 +1000 | [diff] [blame] | 132 | rm -f *.o *.a mktables mktables.c *.uc int*.c altivec*.c vpermxor*.c neon*.c tables.c raid6test |
David Woodhouse | cc4589e | 2010-08-11 00:19:05 +0100 | [diff] [blame] | 133 | |
| 134 | spotless: clean |
| 135 | rm -f *~ |