Makefile 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. # SPDX-License-Identifier: GPL-2.0
  2. obj-$(CONFIG_RAID6_PQ) += raid6_pq.o
  3. raid6_pq-y += algos.o recov.o tables.o int1.o int2.o int4.o \
  4. int8.o int16.o int32.o
  5. raid6_pq-$(CONFIG_X86) += recov_ssse3.o recov_avx2.o mmx.o sse1.o sse2.o avx2.o avx512.o recov_avx512.o
  6. raid6_pq-$(CONFIG_ALTIVEC) += altivec1.o altivec2.o altivec4.o altivec8.o \
  7. vpermxor1.o vpermxor2.o vpermxor4.o vpermxor8.o
  8. raid6_pq-$(CONFIG_KERNEL_MODE_NEON) += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o
  9. raid6_pq-$(CONFIG_S390) += s390vx8.o recov_s390xc.o
  10. hostprogs-y += mktables
  11. quiet_cmd_unroll = UNROLL $@
  12. cmd_unroll = $(AWK) -f$(srctree)/$(src)/unroll.awk -vN=$(UNROLL) \
  13. < $< > $@ || ( rm -f $@ && exit 1 )
  14. ifeq ($(CONFIG_ALTIVEC),y)
  15. altivec_flags := -maltivec $(call cc-option,-mabi=altivec)
  16. ifdef CONFIG_CC_IS_CLANG
  17. # clang ppc port does not yet support -maltivec when -msoft-float is
  18. # enabled. A future release of clang will resolve this
  19. # https://bugs.llvm.org/show_bug.cgi?id=31177
  20. CFLAGS_REMOVE_altivec1.o += -msoft-float
  21. CFLAGS_REMOVE_altivec2.o += -msoft-float
  22. CFLAGS_REMOVE_altivec4.o += -msoft-float
  23. CFLAGS_REMOVE_altivec8.o += -msoft-float
  24. CFLAGS_REMOVE_altivec8.o += -msoft-float
  25. CFLAGS_REMOVE_vpermxor1.o += -msoft-float
  26. CFLAGS_REMOVE_vpermxor2.o += -msoft-float
  27. CFLAGS_REMOVE_vpermxor4.o += -msoft-float
  28. CFLAGS_REMOVE_vpermxor8.o += -msoft-float
  29. endif
  30. endif
  31. # The GCC option -ffreestanding is required in order to compile code containing
  32. # ARM/NEON intrinsics in a non C99-compliant environment (such as the kernel)
  33. ifeq ($(CONFIG_KERNEL_MODE_NEON),y)
  34. NEON_FLAGS := -ffreestanding
  35. ifeq ($(ARCH),arm)
  36. NEON_FLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon
  37. endif
  38. CFLAGS_recov_neon_inner.o += $(NEON_FLAGS)
  39. ifeq ($(ARCH),arm64)
  40. CFLAGS_REMOVE_recov_neon_inner.o += -mgeneral-regs-only
  41. CFLAGS_REMOVE_neon1.o += -mgeneral-regs-only
  42. CFLAGS_REMOVE_neon2.o += -mgeneral-regs-only
  43. CFLAGS_REMOVE_neon4.o += -mgeneral-regs-only
  44. CFLAGS_REMOVE_neon8.o += -mgeneral-regs-only
  45. endif
  46. endif
  47. targets += int1.c
  48. $(obj)/int1.c: UNROLL := 1
  49. $(obj)/int1.c: $(src)/int.uc $(src)/unroll.awk FORCE
  50. $(call if_changed,unroll)
  51. targets += int2.c
  52. $(obj)/int2.c: UNROLL := 2
  53. $(obj)/int2.c: $(src)/int.uc $(src)/unroll.awk FORCE
  54. $(call if_changed,unroll)
  55. targets += int4.c
  56. $(obj)/int4.c: UNROLL := 4
  57. $(obj)/int4.c: $(src)/int.uc $(src)/unroll.awk FORCE
  58. $(call if_changed,unroll)
  59. targets += int8.c
  60. $(obj)/int8.c: UNROLL := 8
  61. $(obj)/int8.c: $(src)/int.uc $(src)/unroll.awk FORCE
  62. $(call if_changed,unroll)
  63. targets += int16.c
  64. $(obj)/int16.c: UNROLL := 16
  65. $(obj)/int16.c: $(src)/int.uc $(src)/unroll.awk FORCE
  66. $(call if_changed,unroll)
  67. targets += int32.c
  68. $(obj)/int32.c: UNROLL := 32
  69. $(obj)/int32.c: $(src)/int.uc $(src)/unroll.awk FORCE
  70. $(call if_changed,unroll)
  71. CFLAGS_altivec1.o += $(altivec_flags)
  72. targets += altivec1.c
  73. $(obj)/altivec1.c: UNROLL := 1
  74. $(obj)/altivec1.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
  75. $(call if_changed,unroll)
  76. CFLAGS_altivec2.o += $(altivec_flags)
  77. targets += altivec2.c
  78. $(obj)/altivec2.c: UNROLL := 2
  79. $(obj)/altivec2.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
  80. $(call if_changed,unroll)
  81. CFLAGS_altivec4.o += $(altivec_flags)
  82. targets += altivec4.c
  83. $(obj)/altivec4.c: UNROLL := 4
  84. $(obj)/altivec4.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
  85. $(call if_changed,unroll)
  86. CFLAGS_altivec8.o += $(altivec_flags)
  87. targets += altivec8.c
  88. $(obj)/altivec8.c: UNROLL := 8
  89. $(obj)/altivec8.c: $(src)/altivec.uc $(src)/unroll.awk FORCE
  90. $(call if_changed,unroll)
  91. CFLAGS_vpermxor1.o += $(altivec_flags)
  92. targets += vpermxor1.c
  93. $(obj)/vpermxor1.c: UNROLL := 1
  94. $(obj)/vpermxor1.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
  95. $(call if_changed,unroll)
  96. CFLAGS_vpermxor2.o += $(altivec_flags)
  97. targets += vpermxor2.c
  98. $(obj)/vpermxor2.c: UNROLL := 2
  99. $(obj)/vpermxor2.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
  100. $(call if_changed,unroll)
  101. CFLAGS_vpermxor4.o += $(altivec_flags)
  102. targets += vpermxor4.c
  103. $(obj)/vpermxor4.c: UNROLL := 4
  104. $(obj)/vpermxor4.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
  105. $(call if_changed,unroll)
  106. CFLAGS_vpermxor8.o += $(altivec_flags)
  107. targets += vpermxor8.c
  108. $(obj)/vpermxor8.c: UNROLL := 8
  109. $(obj)/vpermxor8.c: $(src)/vpermxor.uc $(src)/unroll.awk FORCE
  110. $(call if_changed,unroll)
  111. CFLAGS_neon1.o += $(NEON_FLAGS)
  112. targets += neon1.c
  113. $(obj)/neon1.c: UNROLL := 1
  114. $(obj)/neon1.c: $(src)/neon.uc $(src)/unroll.awk FORCE
  115. $(call if_changed,unroll)
  116. CFLAGS_neon2.o += $(NEON_FLAGS)
  117. targets += neon2.c
  118. $(obj)/neon2.c: UNROLL := 2
  119. $(obj)/neon2.c: $(src)/neon.uc $(src)/unroll.awk FORCE
  120. $(call if_changed,unroll)
  121. CFLAGS_neon4.o += $(NEON_FLAGS)
  122. targets += neon4.c
  123. $(obj)/neon4.c: UNROLL := 4
  124. $(obj)/neon4.c: $(src)/neon.uc $(src)/unroll.awk FORCE
  125. $(call if_changed,unroll)
  126. CFLAGS_neon8.o += $(NEON_FLAGS)
  127. targets += neon8.c
  128. $(obj)/neon8.c: UNROLL := 8
  129. $(obj)/neon8.c: $(src)/neon.uc $(src)/unroll.awk FORCE
  130. $(call if_changed,unroll)
  131. targets += s390vx8.c
  132. $(obj)/s390vx8.c: UNROLL := 8
  133. $(obj)/s390vx8.c: $(src)/s390vx.uc $(src)/unroll.awk FORCE
  134. $(call if_changed,unroll)
  135. quiet_cmd_mktable = TABLE $@
  136. cmd_mktable = $(obj)/mktables > $@ || ( rm -f $@ && exit 1 )
  137. targets += tables.c
  138. $(obj)/tables.c: $(obj)/mktables FORCE
  139. $(call if_changed,mktable)