2 MYINCLUDES
= -I..
/..
/..
/common
-I..
/..
/..
/include -I..
/..
/src
-I..
/..
/include -I..
/jansson
5 MYSRCS
= hardnested_bruteforce.c
7 cpu_arch
= $(shell uname
-m
)
10 ifneq ($(findstring 86, $(cpu_arch
)), )
13 ifneq ($(findstring amd64
, $(cpu_arch
)), )
16 ifneq ($(findstring arm
, $(cpu_arch
)), )
19 ifneq ($(findstring arm64
, $(cpu_arch
)), )
22 ifneq ($(findstring aarch64
, $(cpu_arch
)), )
25 ifneq ($(findstring iP
, $(cpu_arch
)), )
29 ifneq ($(IS_SIMD_ARCH
), )
30 MULTIARCHSRCS
= hardnested_bf_core.c hardnested_bitarray_core.c
32 ifeq ($(MULTIARCHSRCS
), )
33 MYCFLAGS
+= -DNOSIMD_BUILD
34 MYSRCS
+= hardnested_bf_core.c hardnested_bitarray_core.c
37 LIB_A
= libhardnested.a
39 MYOBJS
= $(MYSRCS
:%.c
=$(OBJDIR
)/%.o
)
40 ifneq ($(findstring arm
, $(IS_SIMD_ARCH
)), )
41 MYOBJS
+= $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_NOSIMD.o
) \
42 $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_NEON.o
)
44 MYOBJS
+= $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_NOSIMD.o
) \
45 $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_MMX.o
) \
46 $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_SSE2.o
) \
47 $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_AVX.o
) \
48 $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_AVX2.o
)
51 SUPPORTS_AVX512
:= $(shell echo |
$(CC
) -E
-mavx512f
- > /dev
/null
2>&1 && echo
"True" )
53 HARD_SWITCH_NOSIMD
= -mno-mmx
-mno-sse2
-mno-avx
-mno-avx2
-DNOSIMD_BUILD
55 HARD_SWITCH_MMX
= -mmmx
-mno-sse2
-mno-avx
-mno-avx2
56 HARD_SWITCH_SSE2
= -mmmx
-msse2
-mno-avx
-mno-avx2
57 HARD_SWITCH_AVX
= -mmmx
-msse2
-mavx
-mno-avx2
58 HARD_SWITCH_AVX2
= -mmmx
-msse2
-mavx
-mavx2
59 HARD_SWITCH_AVX512
= -mmmx
-msse2
-mavx
-mavx2
-mavx512f
60 ifeq ($(IS_SIMD_ARCH
), arm64
)
62 HARD_SWITCH_NOSIMD
= -DNOSIMD_BUILD
64 ifeq ($(IS_SIMD_ARCH
), arm
)
66 HARD_SWITCH_NEON
= -mfpu
=neon
67 HARD_SWITCH_NOSIMD
= -DNOSIMD_BUILD
69 ifeq "$(SUPPORTS_AVX512)" "True"
70 HARD_SWITCH_NOSIMD
+= -mno-avx512f
71 HARD_SWITCH_MMX
+= -mno-avx512f
72 HARD_SWITCH_SSE2
+= -mno-avx512f
73 HARD_SWITCH_AVX
+= -mno-avx512f
74 HARD_SWITCH_AVX2
+= -mno-avx512f
75 MYOBJS
+= $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_AVX512.o
)
78 include ..
/..
/..
/Makefile.host
80 $(OBJDIR
)/%_NOSIMD.o
: %.c
$(OBJDIR
)/%_NOSIMD.d
83 $(OBJDIR
)/%_NOSIMD.o
: %.c
$(OBJDIR
)/%_NOSIMD.d
84 $(info [-] CC
(NOSIMD
) $<)
85 $(Q
)$(MKDIR
) $(dir $@
)
86 $(Q
)$(CC
) $(DEPFLAGS
:%.Td
=%_NOSIMD.Td
) $(CFLAGS
) $(HARD_SWITCH_NOSIMD
) -c
-o
$@
$<
87 $(Q
)$(MV
) -f
$(OBJDIR
)/$*_NOSIMD.Td
$(OBJDIR
)/$*_NOSIMD.d
&& $(TOUCH
) $@
89 $(OBJDIR
)/%_NEON.o
: %.c
$(OBJDIR
)/%_NEON.d
90 $(info [-] CC
(NEON
) $<)
91 $(Q
)$(MKDIR
) $(dir $@
)
92 $(Q
)$(CC
) $(DEPFLAGS
:%.Td
=%_NEON.Td
) $(CFLAGS
) $(HARD_SWITCH_NEON
) -c
-o
$@
$<
93 $(Q
)$(MV
) -f
$(OBJDIR
)/$*_NEON.Td
$(OBJDIR
)/$*_NEON.d
&& $(TOUCH
) $@
95 $(OBJDIR
)/%_MMX.o
: %.c
$(OBJDIR
)/%_MMX.d
96 $(info [-] CC
(MMX
) $<)
97 $(Q
)$(MKDIR
) $(dir $@
)
98 $(Q
)$(CC
) $(DEPFLAGS
:%.Td
=%_MMX.Td
) $(CFLAGS
) $(HARD_SWITCH_MMX
) -c
-o
$@
$<
99 $(Q
)$(MV
) -f
$(OBJDIR
)/$*_MMX.Td
$(OBJDIR
)/$*_MMX.d
&& $(TOUCH
) $@
101 $(OBJDIR
)/%_SSE2.o
: %.c
$(OBJDIR
)/%_SSE2.d
102 $(info [-] CC
(SSE2
) $<)
103 $(Q
)$(MKDIR
) $(dir $@
)
104 $(Q
)$(CC
) $(DEPFLAGS
:%.Td
=%_SSE2.Td
) $(CFLAGS
) $(HARD_SWITCH_SSE2
) -c
-o
$@
$<
105 $(Q
)$(MV
) -f
$(OBJDIR
)/$*_SSE2.Td
$(OBJDIR
)/$*_SSE2.d
&& $(TOUCH
) $@
107 $(OBJDIR
)/%_AVX.o
: %.c
$(OBJDIR
)/%_AVX.d
108 $(info [-] CC
(AVX
) $<)
109 $(Q
)$(MKDIR
) $(dir $@
)
110 $(Q
)$(CC
) $(DEPFLAGS
:%.Td
=%_AVX.Td
) $(CFLAGS
) $(HARD_SWITCH_AVX
) -c
-o
$@
$<
111 $(Q
)$(MV
) -f
$(OBJDIR
)/$*_AVX.Td
$(OBJDIR
)/$*_AVX.d
&& $(TOUCH
) $@
113 $(OBJDIR
)/%_AVX2.o
: %.c
$(OBJDIR
)/%_AVX2.d
114 $(info [-] CC
(AVX2
) $<)
115 $(Q
)$(MKDIR
) $(dir $@
)
116 $(Q
)$(CC
) $(DEPFLAGS
:%.Td
=%_AVX2.Td
) $(CFLAGS
) $(HARD_SWITCH_AVX2
) -c
-o
$@
$<
117 $(Q
)$(MV
) -f
$(OBJDIR
)/$*_AVX2.Td
$(OBJDIR
)/$*_AVX2.d
&& $(TOUCH
) $@
119 $(OBJDIR
)/%_AVX512.o
: %.c
$(OBJDIR
)/%_AVX512.d
120 $(info [-] CC
(AVX512
) $<)
121 $(Q
)$(MKDIR
) $(dir $@
)
122 $(Q
)$(CC
) $(DEPFLAGS
:%.Td
=%_AVX512.Td
) $(CFLAGS
) $(HARD_SWITCH_AVX512
) -c
-o
$@
$<
123 $(Q
)$(MV
) -f
$(OBJDIR
)/$*_AVX512.Td
$(OBJDIR
)/$*_AVX512.d
&& $(TOUCH
) $@