152 lines · plain
1# SPDX-License-Identifier: GPL-2.02#3# This is a simple Makefile to test some of the RAID-6 code4# from userspace.5#6 7pound := \#8 9# Adjust as desired10CC = gcc11OPTFLAGS = -O212CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS)13LD = ld14AWK = awk -f15AR = ar16RANLIB = ranlib17OBJS = int1.o int2.o int4.o int8.o int16.o int32.o recov.o algos.o tables.o18 19ARCH := $(shell uname -m 2>/dev/null | sed -e /s/i.86/i386/)20ifeq ($(ARCH),i386)21 CFLAGS += -DCONFIG_X86_3222 IS_X86 = yes23endif24ifeq ($(ARCH),x86_64)25 CFLAGS += -DCONFIG_X86_6426 IS_X86 = yes27endif28 29ifeq ($(ARCH),arm)30 CFLAGS += -I../../../arch/arm/include -mfpu=neon31 HAS_NEON = yes32endif33ifeq ($(ARCH),aarch64)34 CFLAGS += -I../../../arch/arm64/include35 HAS_NEON = yes36endif37 38ifeq ($(findstring ppc,$(ARCH)),ppc)39 CFLAGS += -I../../../arch/powerpc/include40 HAS_ALTIVEC := $(shell printf '$(pound)include <altivec.h>\nvector int a;\n' |\41 gcc -c -x c - >/dev/null && rm ./-.o && echo yes)42endif43 44ifeq ($(ARCH),loongarch64)45 CFLAGS += -I../../../arch/loongarch/include -DCONFIG_LOONGARCH=146 CFLAGS += $(shell echo 'vld $$vr0, $$zero, 0' | \47 gcc -c -x assembler - >/dev/null 2>&1 && \48 rm ./-.o && echo -DCONFIG_CPU_HAS_LSX=1)49 CFLAGS += $(shell echo 'xvld $$xr0, $$zero, 0' | \50 gcc -c -x assembler - >/dev/null 2>&1 && \51 rm ./-.o && echo -DCONFIG_CPU_HAS_LASX=1)52endif53 54ifeq ($(IS_X86),yes)55 OBJS += mmx.o sse1.o sse2.o avx2.o recov_ssse3.o recov_avx2.o avx512.o recov_avx512.o56 CFLAGS += -DCONFIG_X8657 CFLAGS += $(shell echo "vpmovm2b %k1, %zmm5" | \58 gcc -c -x assembler - >/dev/null 2>&1 && \59 rm ./-.o && echo -DCONFIG_AS_AVX512=1)60else ifeq ($(HAS_NEON),yes)61 OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o62 CFLAGS += -DCONFIG_KERNEL_MODE_NEON=163else ifeq ($(HAS_ALTIVEC),yes)64 CFLAGS += -DCONFIG_ALTIVEC65 OBJS += altivec1.o altivec2.o altivec4.o altivec8.o \66 vpermxor1.o vpermxor2.o vpermxor4.o vpermxor8.o67else ifeq ($(ARCH),loongarch64)68 OBJS += loongarch_simd.o recov_loongarch_simd.o69endif70 71.c.o:72 $(CC) $(CFLAGS) -c -o $@ $<73 74%.c: ../%.c75 cp -f $< $@76 77%.uc: ../%.uc78 cp -f $< $@79 80all: raid6.a raid6test81 82raid6.a: $(OBJS)83 rm -f $@84 $(AR) cq $@ $^85 $(RANLIB) $@86 87raid6test: test.c raid6.a88 $(CC) $(CFLAGS) -o raid6test $^89 90neon1.c: neon.uc ../unroll.awk91 $(AWK) ../unroll.awk -vN=1 < neon.uc > $@92 93neon2.c: neon.uc ../unroll.awk94 $(AWK) ../unroll.awk -vN=2 < neon.uc > $@95 96neon4.c: neon.uc ../unroll.awk97 $(AWK) ../unroll.awk -vN=4 < neon.uc > $@98 99neon8.c: neon.uc ../unroll.awk100 $(AWK) ../unroll.awk -vN=8 < neon.uc > $@101 102altivec1.c: altivec.uc ../unroll.awk103 $(AWK) ../unroll.awk -vN=1 < altivec.uc > $@104 105altivec2.c: altivec.uc ../unroll.awk106 $(AWK) ../unroll.awk -vN=2 < altivec.uc > $@107 108altivec4.c: altivec.uc ../unroll.awk109 $(AWK) ../unroll.awk -vN=4 < altivec.uc > $@110 111altivec8.c: altivec.uc ../unroll.awk112 $(AWK) ../unroll.awk -vN=8 < altivec.uc > $@113 114vpermxor1.c: vpermxor.uc ../unroll.awk115 $(AWK) ../unroll.awk -vN=1 < vpermxor.uc > $@116 117vpermxor2.c: vpermxor.uc ../unroll.awk118 $(AWK) ../unroll.awk -vN=2 < vpermxor.uc > $@119 120vpermxor4.c: vpermxor.uc ../unroll.awk121 $(AWK) ../unroll.awk -vN=4 < vpermxor.uc > $@122 123vpermxor8.c: vpermxor.uc ../unroll.awk124 $(AWK) ../unroll.awk -vN=8 < vpermxor.uc > $@125 126int1.c: int.uc ../unroll.awk127 $(AWK) ../unroll.awk -vN=1 < int.uc > $@128 129int2.c: int.uc ../unroll.awk130 $(AWK) ../unroll.awk -vN=2 < int.uc > $@131 132int4.c: int.uc ../unroll.awk133 $(AWK) ../unroll.awk -vN=4 < int.uc > $@134 135int8.c: int.uc ../unroll.awk136 $(AWK) ../unroll.awk -vN=8 < int.uc > $@137 138int16.c: int.uc ../unroll.awk139 $(AWK) ../unroll.awk -vN=16 < int.uc > $@140 141int32.c: int.uc ../unroll.awk142 $(AWK) ../unroll.awk -vN=32 < int.uc > $@143 144tables.c: mktables145 ./mktables > tables.c146 147clean:148 rm -f *.o *.a mktables mktables.c *.uc int*.c altivec*.c vpermxor*.c neon*.c tables.c raid6test149 150spotless: clean151 rm -f *~152