]> git.sesse.net Git - stockfish/blobdiff - src/Makefile
Check ARCH=.... variable
[stockfish] / src / Makefile
index 2e85a144733981c7e6c1939024940086a7b8b176..703aa23020ff6164510ce3ce2ffda2fef2957afa 100644 (file)
@@ -85,8 +85,15 @@ endif
 
 ### 2.1. General and architecture defaults
 
-ifeq ($(ARCH),)
-    empty_arch = yes
+# explicitly check for the list of supported architectures (as listed with make help),
+# the user can override with `make ARCH=x86-32-vnni256 SUPPORTED_ARCH=true`
+ifeq ($(ARCH),$(filter $(ARCH),x86-64-vnni512 x86-64-vnni256 x86-64-avx512 x86-64-bmi2 x86-64-avx2 \
+                               x86-64-sse41-popcnt x86-64-modern x86-64-ssse3 x86-64-sse3-popcnt \
+                               x86-64 x86-32-sse41-popcnt x86-32-sse2 x86-32 ppc-64 ppc-32 \
+                               armv7 armv7-neon armv8 apple-silicon general-64 general-32))
+   SUPPORTED_ARCH=true
+else
+   SUPPORTED_ARCH=false
 endif
 
 optimize = yes
@@ -625,6 +632,7 @@ endif
 ### Section 4. Public Targets
 ### ==========================================================================
 
+
 help:
        @echo ""
        @echo "To compile stockfish, type: "
@@ -684,10 +692,12 @@ help:
        @echo "make -j profile-build ARCH=x86-64-bmi2 COMP=gcc COMPCXX=g++-9.0"
        @echo "make -j build ARCH=x86-64-ssse3 COMP=clang"
        @echo ""
-ifneq ($(empty_arch), yes)
        @echo "-------------------------------"
+ifeq ($(SUPPORTED_ARCH), true)
        @echo "The selected architecture $(ARCH) will enable the following configuration: "
        @$(MAKE) ARCH=$(ARCH) COMP=$(COMP) config-sanity
+else
+       @echo "Specify a supported architecture with the ARCH option for more details"
 endif
 
 
@@ -802,6 +812,7 @@ config-sanity:
        @test "$(debug)" = "yes" || test "$(debug)" = "no"
        @test "$(sanitize)" = "undefined" || test "$(sanitize)" = "thread" || test "$(sanitize)" = "address" || test "$(sanitize)" = "no"
        @test "$(optimize)" = "yes" || test "$(optimize)" = "no"
+       @test "$(SUPPORTED_ARCH)" = "true"
        @test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \
         test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || \
         test "$(arch)" = "armv7" || test "$(arch)" = "armv8" || test "$(arch)" = "arm64"