Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #
  2. # This is a simple Makefile to test some of the RAID-6 code
  3. # from userspace.
  4. #
  5. CC = gcc
  6. OPTFLAGS = -O2 # Adjust as desired
  7. CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS)
  8. LD = ld
  9. AWK = awk -f
  10. AR = ar
  11. RANLIB = ranlib
  12. OBJS = int1.o int2.o int4.o int8.o int16.o int32.o recov.o algos.o tables.o
  13. ARCH := $(shell uname -m 2>/dev/null | sed -e /s/i.86/i386/)
  14. ifeq ($(ARCH),i386)
  15. CFLAGS += -DCONFIG_X86_32
  16. IS_X86 = yes
  17. endif
  18. ifeq ($(ARCH),x86_64)
  19. CFLAGS += -DCONFIG_X86_64
  20. IS_X86 = yes
  21. endif
  22. ifeq ($(ARCH),arm)
  23. CFLAGS += -I../../../arch/arm/include -mfpu=neon
  24. HAS_NEON = yes
  25. endif
  26. ifeq ($(ARCH),arm64)
  27. CFLAGS += -I../../../arch/arm64/include
  28. HAS_NEON = yes
  29. endif
  30. ifeq ($(IS_X86),yes)
  31. OBJS += mmx.o sse1.o sse2.o avx2.o recov_ssse3.o recov_avx2.o avx512.o recov_avx512.o
  32. CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1" | \
  33. gcc -c -x assembler - >&/dev/null && \
  34. rm ./-.o && echo -DCONFIG_AS_AVX2=1)
  35. CFLAGS += $(shell echo "vpmovm2b %k1, %zmm5" | \
  36. gcc -c -x assembler - >&/dev/null && \
  37. rm ./-.o && echo -DCONFIG_AS_AVX512=1)
  38. else ifeq ($(HAS_NEON),yes)
  39. OBJS += neon.o neon1.o neon2.o neon4.o neon8.o
  40. CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1
  41. else
  42. HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\
  43. gcc -c -x c - >&/dev/null && \
  44. rm ./-.o && echo yes)
  45. ifeq ($(HAS_ALTIVEC),yes)
  46. OBJS += altivec1.o altivec2.o altivec4.o altivec8.o
  47. endif
  48. endif
  49. ifeq ($(ARCH),tilegx)
  50. OBJS += tilegx8.o
  51. endif
  52. .c.o:
  53. $(CC) $(CFLAGS) -c -o $@ $<
  54. %.c: ../%.c
  55. cp -f $< $@
  56. %.uc: ../%.uc
  57. cp -f $< $@
  58. all: raid6.a raid6test
  59. raid6.a: $(OBJS)
  60. rm -f $@
  61. $(AR) cq $@ $^
  62. $(RANLIB) $@
  63. raid6test: test.c raid6.a
  64. $(CC) $(CFLAGS) -o raid6test $^
  65. neon1.c: neon.uc ../unroll.awk
  66. $(AWK) ../unroll.awk -vN=1 < neon.uc > $@
  67. neon2.c: neon.uc ../unroll.awk
  68. $(AWK) ../unroll.awk -vN=2 < neon.uc > $@
  69. neon4.c: neon.uc ../unroll.awk
  70. $(AWK) ../unroll.awk -vN=4 < neon.uc > $@
  71. neon8.c: neon.uc ../unroll.awk
  72. $(AWK) ../unroll.awk -vN=8 < neon.uc > $@
  73. altivec1.c: altivec.uc ../unroll.awk
  74. $(AWK) ../unroll.awk -vN=1 < altivec.uc > $@
  75. altivec2.c: altivec.uc ../unroll.awk
  76. $(AWK) ../unroll.awk -vN=2 < altivec.uc > $@
  77. altivec4.c: altivec.uc ../unroll.awk
  78. $(AWK) ../unroll.awk -vN=4 < altivec.uc > $@
  79. altivec8.c: altivec.uc ../unroll.awk
  80. $(AWK) ../unroll.awk -vN=8 < altivec.uc > $@
  81. int1.c: int.uc ../unroll.awk
  82. $(AWK) ../unroll.awk -vN=1 < int.uc > $@
  83. int2.c: int.uc ../unroll.awk
  84. $(AWK) ../unroll.awk -vN=2 < int.uc > $@
  85. int4.c: int.uc ../unroll.awk
  86. $(AWK) ../unroll.awk -vN=4 < int.uc > $@
  87. int8.c: int.uc ../unroll.awk
  88. $(AWK) ../unroll.awk -vN=8 < int.uc > $@
  89. int16.c: int.uc ../unroll.awk
  90. $(AWK) ../unroll.awk -vN=16 < int.uc > $@
  91. int32.c: int.uc ../unroll.awk
  92. $(AWK) ../unroll.awk -vN=32 < int.uc > $@
  93. tilegx8.c: tilegx.uc ../unroll.awk
  94. $(AWK) ../unroll.awk -vN=8 < tilegx.uc > $@
  95. tables.c: mktables
  96. ./mktables > tables.c
  97. clean:
  98. rm -f *.o *.a mktables mktables.c *.uc int*.c altivec*.c neon*.c tables.c raid6test
  99. rm -f tilegx*.c
  100. spotless: clean
  101. rm -f *~