Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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
  32. CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1" | \
  33. gcc -c -x assembler - >&/dev/null && \
  34. rm ./-.o && echo -DCONFIG_AS_AVX2=1)
  35. else ifeq ($(HAS_NEON),yes)
  36. OBJS += neon.o neon1.o neon2.o neon4.o neon8.o
  37. CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1
  38. else
  39. HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\
  40. gcc -c -x c - >&/dev/null && \
  41. rm ./-.o && echo yes)
  42. ifeq ($(HAS_ALTIVEC),yes)
  43. OBJS += altivec1.o altivec2.o altivec4.o altivec8.o
  44. endif
  45. endif
  46. ifeq ($(ARCH),tilegx)
  47. OBJS += tilegx8.o
  48. endif
  49. .c.o:
  50. $(CC) $(CFLAGS) -c -o $@ $<
  51. %.c: ../%.c
  52. cp -f $< $@
  53. %.uc: ../%.uc
  54. cp -f $< $@
  55. all: raid6.a raid6test
  56. raid6.a: $(OBJS)
  57. rm -f $@
  58. $(AR) cq $@ $^
  59. $(RANLIB) $@
  60. raid6test: test.c raid6.a
  61. $(CC) $(CFLAGS) -o raid6test $^
  62. neon1.c: neon.uc ../unroll.awk
  63. $(AWK) ../unroll.awk -vN=1 < neon.uc > $@
  64. neon2.c: neon.uc ../unroll.awk
  65. $(AWK) ../unroll.awk -vN=2 < neon.uc > $@
  66. neon4.c: neon.uc ../unroll.awk
  67. $(AWK) ../unroll.awk -vN=4 < neon.uc > $@
  68. neon8.c: neon.uc ../unroll.awk
  69. $(AWK) ../unroll.awk -vN=8 < neon.uc > $@
  70. altivec1.c: altivec.uc ../unroll.awk
  71. $(AWK) ../unroll.awk -vN=1 < altivec.uc > $@
  72. altivec2.c: altivec.uc ../unroll.awk
  73. $(AWK) ../unroll.awk -vN=2 < altivec.uc > $@
  74. altivec4.c: altivec.uc ../unroll.awk
  75. $(AWK) ../unroll.awk -vN=4 < altivec.uc > $@
  76. altivec8.c: altivec.uc ../unroll.awk
  77. $(AWK) ../unroll.awk -vN=8 < altivec.uc > $@
  78. int1.c: int.uc ../unroll.awk
  79. $(AWK) ../unroll.awk -vN=1 < int.uc > $@
  80. int2.c: int.uc ../unroll.awk
  81. $(AWK) ../unroll.awk -vN=2 < int.uc > $@
  82. int4.c: int.uc ../unroll.awk
  83. $(AWK) ../unroll.awk -vN=4 < int.uc > $@
  84. int8.c: int.uc ../unroll.awk
  85. $(AWK) ../unroll.awk -vN=8 < int.uc > $@
  86. int16.c: int.uc ../unroll.awk
  87. $(AWK) ../unroll.awk -vN=16 < int.uc > $@
  88. int32.c: int.uc ../unroll.awk
  89. $(AWK) ../unroll.awk -vN=32 < int.uc > $@
  90. tilegx8.c: tilegx.uc ../unroll.awk
  91. $(AWK) ../unroll.awk -vN=8 < tilegx.uc > $@
  92. tables.c: mktables
  93. ./mktables > tables.c
  94. clean:
  95. rm -f *.o *.a mktables mktables.c *.uc int*.c altivec*.c neon*.c tables.c raid6test
  96. rm -f tilegx*.c
  97. spotless: clean
  98. rm -f *~