]> git.sesse.net Git - stockfish/blobdiff - src/Makefile
Fixes build failure on Apple M1 Silicon
[stockfish] / src / Makefile
index 3cf97873d8a7411eaf26a8c68a1b1fb0b7c0d02c..f00df79fa410bbff21e693ebf31f7d4ac550c4fc 100644 (file)
@@ -459,6 +459,9 @@ else ifeq ($(comp),clang)
 else
        profile_make = gcc-profile-make
        profile_use = gcc-profile-use
+       ifeq ($(KERNEL),Darwin)
+               EXTRAPROFILEFLAGS = -fvisibility=hidden
+       endif
 endif
 
 ### Travis CI script uses COMPILER to overwrite CXX
@@ -519,11 +522,17 @@ ifeq ($(optimize),yes)
                endif
        endif
 
-       ifeq ($(comp),$(filter $(comp),gcc clang icc))
-               ifeq ($(KERNEL),Darwin)
-                       CXXFLAGS += -mdynamic-no-pic
-               endif
-       endif
+    ifeq ($(KERNEL),Darwin)
+        ifeq ($(comp),$(filter $(comp),clang icc))
+            CXXFLAGS += -mdynamic-no-pic
+        endif
+
+        ifeq ($(comp),gcc)
+            ifneq ($(arch),arm64)
+                CXXFLAGS += -mdynamic-no-pic
+            endif
+        endif
+    endif
 
        ifeq ($(comp),clang)
                CXXFLAGS += -fexperimental-new-pass-manager
@@ -920,12 +929,14 @@ gcc-profile-make:
        @mkdir -p profdir
        $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
        EXTRACXXFLAGS='-fprofile-generate=profdir' \
+       EXTRACXXFLAGS+=$(EXTRAPROFILEFLAGS) \
        EXTRALDFLAGS='-lgcov' \
        all
 
 gcc-profile-use:
        $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
        EXTRACXXFLAGS='-fprofile-use=profdir -fno-peel-loops -fno-tracer' \
+       EXTRACXXFLAGS+=$(EXTRAPROFILEFLAGS) \
        EXTRALDFLAGS='-lgcov' \
        all