1 # Stockfish, a UCI chess playing engine derived from Glaurung 2.1
2 # Copyright (C) 2004-2021 The Stockfish developers (see AUTHORS file)
4 # Stockfish is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # Stockfish is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 ### ==========================================================================
19 ### Section 1. General Configuration
20 ### ==========================================================================
29 ### Installation dir definitions
31 BINDIR = $(PREFIX)/bin
33 ### Built-in benchmark for pgo-builds
35 PGOBENCH = ./$(EXE) bench
37 PGOBENCH = $(SDE_PATH) -- ./$(EXE) bench
40 ### Source and object files
41 SRCS = benchmark.cpp bitbase.cpp bitboard.cpp endgame.cpp evaluate.cpp main.cpp \
42 material.cpp misc.cpp movegen.cpp movepick.cpp pawns.cpp position.cpp psqt.cpp \
43 search.cpp thread.cpp timeman.cpp tt.cpp uci.cpp ucioption.cpp tune.cpp syzygy/tbprobe.cpp \
44 nnue/evaluate_nnue.cpp nnue/features/half_ka_v2_hm.cpp
46 OBJS = $(notdir $(SRCS:.cpp=.o))
48 VPATH = syzygy:nnue:nnue/features
50 ### Establish the operating system name
51 KERNEL = $(shell uname -s)
52 ifeq ($(KERNEL),Linux)
53 OS = $(shell uname -o)
56 ### ==========================================================================
57 ### Section 2. High-level Configuration
58 ### ==========================================================================
60 # flag --- Comp switch --- Description
61 # ----------------------------------------------------------------------------
63 # debug = yes/no --- -DNDEBUG --- Enable/Disable debug mode
64 # sanitize = none/<sanitizer> ... (-fsanitize )
65 # --- ( undefined ) --- enable undefined behavior checks
66 # --- ( thread ) --- enable threading error checks
67 # --- ( address ) --- enable memory access checks
68 # --- ...etc... --- see compiler documentation for supported sanitizers
69 # optimize = yes/no --- (-O3/-fast etc.) --- Enable/Disable optimizations
70 # arch = (name) --- (-arch) --- Target architecture
71 # bits = 64/32 --- -DIS_64BIT --- 64-/32-bit operating system
72 # prefetch = yes/no --- -DUSE_PREFETCH --- Use prefetch asm-instruction
73 # popcnt = yes/no --- -DUSE_POPCNT --- Use popcnt asm-instruction
74 # pext = yes/no --- -DUSE_PEXT --- Use pext x86_64 asm-instruction
75 # sse = yes/no --- -msse --- Use Intel Streaming SIMD Extensions
76 # mmx = yes/no --- -mmmx --- Use Intel MMX instructions
77 # sse2 = yes/no --- -msse2 --- Use Intel Streaming SIMD Extensions 2
78 # ssse3 = yes/no --- -mssse3 --- Use Intel Supplemental Streaming SIMD Extensions 3
79 # sse41 = yes/no --- -msse4.1 --- Use Intel Streaming SIMD Extensions 4.1
80 # avx2 = yes/no --- -mavx2 --- Use Intel Advanced Vector Extensions 2
81 # avx512 = yes/no --- -mavx512bw --- Use Intel Advanced Vector Extensions 512
82 # vnni256 = yes/no --- -mavx512vnni --- Use Intel Vector Neural Network Instructions 256
83 # vnni512 = yes/no --- -mavx512vnni --- Use Intel Vector Neural Network Instructions 512
84 # neon = yes/no --- -DUSE_NEON --- Use ARM SIMD architecture
86 # Note that Makefile is space sensitive, so when adding new architectures
87 # or modifying existing flags, you have to make sure there are no extra spaces
88 # at the end of the line for flag values.
90 # Example of use for these flags:
91 # make build ARCH=x86-64-avx512 debug=on sanitize="address undefined"
94 ### 2.1. General and architecture defaults
98 help_skip_sanity = yes
100 # explicitly check for the list of supported architectures (as listed with make help),
101 # the user can override with `make ARCH=x86-32-vnni256 SUPPORTED_ARCH=true`
102 ifeq ($(ARCH), $(filter $(ARCH), \
103 x86-64-vnni512 x86-64-vnni256 x86-64-avx512 x86-64-bmi2 x86-64-avx2 \
104 x86-64-sse41-popcnt x86-64-modern x86-64-ssse3 x86-64-sse3-popcnt \
105 x86-64 x86-32-sse41-popcnt x86-32-sse2 x86-32 ppc-64 ppc-32 e2k \
106 armv7 armv7-neon armv8 apple-silicon general-64 general-32))
131 ### 2.2 Architecture specific
133 ifeq ($(findstring x86,$(ARCH)),x86)
137 ifeq ($(findstring x86-32,$(ARCH)),x86-32)
148 ifeq ($(findstring -sse,$(ARCH)),-sse)
152 ifeq ($(findstring -popcnt,$(ARCH)),-popcnt)
156 ifeq ($(findstring -mmx,$(ARCH)),-mmx)
160 ifeq ($(findstring -sse2,$(ARCH)),-sse2)
165 ifeq ($(findstring -ssse3,$(ARCH)),-ssse3)
171 ifeq ($(findstring -sse41,$(ARCH)),-sse41)
178 ifeq ($(findstring -modern,$(ARCH)),-modern)
186 ifeq ($(findstring -avx2,$(ARCH)),-avx2)
195 ifeq ($(findstring -bmi2,$(ARCH)),-bmi2)
205 ifeq ($(findstring -avx512,$(ARCH)),-avx512)
216 ifeq ($(findstring -vnni256,$(ARCH)),-vnni256)
227 ifeq ($(findstring -vnni512,$(ARCH)),-vnni512)
243 # 64-bit pext is not available on x86-32
250 # all other architectures
252 ifeq ($(ARCH),general-32)
257 ifeq ($(ARCH),general-64)
267 ifeq ($(ARCH),armv7-neon)
282 ifeq ($(ARCH),apple-silicon)
289 ifeq ($(ARCH),ppc-32)
294 ifeq ($(ARCH),ppc-64)
300 ifeq ($(findstring e2k,$(ARCH)),e2k)
313 ### ==========================================================================
314 ### Section 3. Low-level Configuration
315 ### ==========================================================================
317 ### 3.1 Selecting compiler (default = gcc)
318 CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++17 $(EXTRACXXFLAGS)
319 DEPENDFLAGS += -std=c++17
320 LDFLAGS += $(EXTRALDFLAGS)
329 CXXFLAGS += -pedantic -Wextra -Wshadow
331 ifeq ($(arch),$(filter $(arch),armv7 armv8))
333 CXXFLAGS += -m$(bits)
337 CXXFLAGS += -m$(bits)
341 ifeq ($(arch),$(filter $(arch),armv7))
345 ifneq ($(KERNEL),Darwin)
346 LDFLAGS += -Wl,--no-as-needed
353 ifeq ($(KERNEL),Linux)
355 ifeq ($(shell which x86_64-w64-mingw32-c++-posix),)
356 CXX=x86_64-w64-mingw32-c++
358 CXX=x86_64-w64-mingw32-c++-posix
361 ifeq ($(shell which i686-w64-mingw32-c++-posix),)
362 CXX=i686-w64-mingw32-c++
364 CXX=i686-w64-mingw32-c++-posix
371 CXXFLAGS += -pedantic -Wextra -Wshadow
378 CXXFLAGS += -diag-disable 1476,10120 -Wcheck -Wabi -Wdeprecated -strict-ansi
384 CXXFLAGS += -pedantic -Wextra -Wshadow
386 ifneq ($(KERNEL),Darwin)
387 ifneq ($(KERNEL),OpenBSD)
388 ifneq ($(KERNEL),FreeBSD)
389 ifneq ($(RTLIB),compiler-rt)
396 ifeq ($(arch),$(filter $(arch),armv7 armv8))
398 CXXFLAGS += -m$(bits)
402 CXXFLAGS += -m$(bits)
407 ifeq ($(KERNEL),Darwin)
408 CXXFLAGS += -mmacosx-version-min=10.14
409 LDFLAGS += -mmacosx-version-min=10.14
411 CXXFLAGS += -arch $(arch)
412 LDFLAGS += -arch $(arch)
417 # To cross-compile for Android, NDK version r21 or later is recommended.
418 # In earlier NDK versions, you'll need to pass -fno-addrsig if using GNU binutils.
419 # Currently we don't know how to make PGO builds with the NDK yet.
421 CXXFLAGS += -stdlib=libc++ -fPIE
424 CXX=armv7a-linux-androideabi16-clang++
425 CXXFLAGS += -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon
426 STRIP=arm-linux-androideabi-strip
429 CXX=aarch64-linux-android21-clang++
430 STRIP=aarch64-linux-android-strip
432 LDFLAGS += -static-libstdc++ -pie -lm -latomic
436 profile_make = icc-profile-make
437 profile_use = icc-profile-use
438 else ifeq ($(comp),clang)
439 profile_make = clang-profile-make
440 profile_use = clang-profile-use
442 profile_make = gcc-profile-make
443 profile_use = gcc-profile-use
446 ### Travis CI script uses COMPILER to overwrite CXX
451 ### Allow overwriting CXX from command line
456 ### Sometimes gcc is really clang
458 gccversion = $(shell $(CXX) --version)
459 gccisclang = $(findstring clang,$(gccversion))
460 ifneq ($(gccisclang),)
461 profile_make = clang-profile-make
462 profile_use = clang-profile-use
466 ### On mingw use Windows threads, otherwise POSIX
467 ifneq ($(comp),mingw)
468 CXXFLAGS += -DUSE_PTHREADS
469 # On Android Bionic's C library comes with its own pthread implementation bundled in
470 ifneq ($(OS),Android)
471 # Haiku has pthreads in its libroot, so only link it in on other platforms
472 ifneq ($(KERNEL),Haiku)
487 ### 3.2.2 Debugging with undefined behavior sanitizers
488 ifneq ($(sanitize),none)
489 CXXFLAGS += -g3 $(addprefix -fsanitize=,$(sanitize))
490 LDFLAGS += $(addprefix -fsanitize=,$(sanitize))
494 ifeq ($(optimize),yes)
499 ifeq ($(OS), Android)
500 CXXFLAGS += -fno-gcse -mthumb -march=armv7-a -mfloat-abi=softfp
504 ifeq ($(comp),$(filter $(comp),gcc clang icc))
505 ifeq ($(KERNEL),Darwin)
506 CXXFLAGS += -mdynamic-no-pic
511 CXXFLAGS += -fexperimental-new-pass-manager
517 CXXFLAGS += -DIS_64BIT
521 ifeq ($(prefetch),yes)
526 CXXFLAGS += -DNO_PREFETCH
531 ifeq ($(arch),$(filter $(arch),ppc64 armv7 armv8 arm64))
532 CXXFLAGS += -DUSE_POPCNT
533 else ifeq ($(comp),icc)
534 CXXFLAGS += -msse3 -DUSE_POPCNT
536 CXXFLAGS += -msse3 -mpopcnt -DUSE_POPCNT
541 CXXFLAGS += -DUSE_AVX2
542 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
548 CXXFLAGS += -DUSE_AVX512
549 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
550 CXXFLAGS += -mavx512f -mavx512bw
554 ifeq ($(vnni256),yes)
555 CXXFLAGS += -DUSE_VNNI
556 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
557 CXXFLAGS += -mavx512f -mavx512bw -mavx512vnni -mavx512dq -mavx512vl -mprefer-vector-width=256
561 ifeq ($(vnni512),yes)
562 CXXFLAGS += -DUSE_VNNI
563 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
564 CXXFLAGS += -mavx512vnni -mavx512dq -mavx512vl
569 CXXFLAGS += -DUSE_SSE41
570 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
576 CXXFLAGS += -DUSE_SSSE3
577 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
583 CXXFLAGS += -DUSE_SSE2
584 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
590 CXXFLAGS += -DUSE_MMX
591 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
597 CXXFLAGS += -DUSE_NEON
598 ifeq ($(KERNEL),Linux)
600 ifneq ($(arch),armv8)
601 CXXFLAGS += -mfpu=neon
609 CXXFLAGS += -DUSE_PEXT
610 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
615 ### 3.8 Link Time Optimization
616 ### This is a mix of compile and link time options because the lto link phase
617 ### needs access to the optimization flags.
618 ifeq ($(optimize),yes)
622 ifneq ($(findstring MINGW,$(KERNEL)),)
623 CXXFLAGS += -fuse-ld=lld
624 else ifneq ($(findstring MSYS,$(KERNEL)),)
625 CXXFLAGS += -fuse-ld=lld
627 LDFLAGS += $(CXXFLAGS)
629 # GCC and CLANG use different methods for parallelizing LTO and CLANG pretends to be
630 # GCC on some systems.
631 else ifeq ($(comp),gcc)
632 ifeq ($(gccisclang),)
634 LDFLAGS += $(CXXFLAGS) -flto=jobserver
635 ifneq ($(findstring MINGW,$(KERNEL)),)
636 LDFLAGS += -save-temps
637 else ifneq ($(findstring MSYS,$(KERNEL)),)
638 LDFLAGS += -save-temps
642 LDFLAGS += $(CXXFLAGS)
645 # To use LTO and static linking on windows, the tool chain requires a recent gcc:
646 # gcc version 10.1 in msys2 or TDM-GCC version 9.2 are known to work, older might not.
647 # So, only enable it for a cross from Linux by default.
648 else ifeq ($(comp),mingw)
649 ifeq ($(KERNEL),Linux)
652 LDFLAGS += $(CXXFLAGS) -flto=jobserver
659 ### 3.9 Android 5 can only run position independent executables. Note that this
660 ### breaks Android 4.0 and earlier.
661 ifeq ($(OS), Android)
663 LDFLAGS += -fPIE -pie
666 ### ==========================================================================
667 ### Section 4. Public Targets
668 ### ==========================================================================
673 @echo "To compile stockfish, type: "
675 @echo "make target ARCH=arch [COMP=compiler] [COMPCXX=cxx]"
677 @echo "Supported targets:"
679 @echo "help > Display architecture details"
680 @echo "build > Standard build"
681 @echo "net > Download the default nnue net"
682 @echo "profile-build > Faster build (with profile-guided optimization)"
683 @echo "strip > Strip executable"
684 @echo "install > Install executable"
685 @echo "clean > Clean up"
687 @echo "Supported archs:"
689 @echo "x86-64-vnni512 > x86 64-bit with vnni support 512bit wide"
690 @echo "x86-64-vnni256 > x86 64-bit with vnni support 256bit wide"
691 @echo "x86-64-avx512 > x86 64-bit with avx512 support"
692 @echo "x86-64-bmi2 > x86 64-bit with bmi2 support"
693 @echo "x86-64-avx2 > x86 64-bit with avx2 support"
694 @echo "x86-64-sse41-popcnt > x86 64-bit with sse41 and popcnt support"
695 @echo "x86-64-modern > common modern CPU, currently x86-64-sse41-popcnt"
696 @echo "x86-64-ssse3 > x86 64-bit with ssse3 support"
697 @echo "x86-64-sse3-popcnt > x86 64-bit with sse3 and popcnt support"
698 @echo "x86-64 > x86 64-bit generic (with sse2 support)"
699 @echo "x86-32-sse41-popcnt > x86 32-bit with sse41 and popcnt support"
700 @echo "x86-32-sse2 > x86 32-bit with sse2 support"
701 @echo "x86-32 > x86 32-bit generic (with mmx and sse support)"
702 @echo "ppc-64 > PPC 64-bit"
703 @echo "ppc-32 > PPC 32-bit"
704 @echo "armv7 > ARMv7 32-bit"
705 @echo "armv7-neon > ARMv7 32-bit with popcnt and neon"
706 @echo "armv8 > ARMv8 64-bit with popcnt and neon"
707 @echo "e2k > Elbrus 2000"
708 @echo "apple-silicon > Apple silicon ARM64"
709 @echo "general-64 > unspecified 64-bit"
710 @echo "general-32 > unspecified 32-bit"
712 @echo "Supported compilers:"
714 @echo "gcc > Gnu compiler (default)"
715 @echo "mingw > Gnu compiler with MinGW under Windows"
716 @echo "clang > LLVM Clang compiler"
717 @echo "icc > Intel compiler"
718 @echo "ndk > Google NDK to cross-compile for Android"
720 @echo "Simple examples. If you don't know what to do, you likely want to run: "
722 @echo "make -j build ARCH=x86-64 (A portable, slow compile for 64-bit systems)"
723 @echo "make -j build ARCH=x86-32 (A portable, slow compile for 32-bit systems)"
725 @echo "Advanced examples, for experienced users looking for performance: "
727 @echo "make help ARCH=x86-64-bmi2"
728 @echo "make -j profile-build ARCH=x86-64-bmi2 COMP=gcc COMPCXX=g++-9.0"
729 @echo "make -j build ARCH=x86-64-ssse3 COMP=clang"
731 @echo "-------------------------------"
732 ifeq ($(SUPPORTED_ARCH)$(help_skip_sanity), true)
733 @echo "The selected architecture $(ARCH) will enable the following configuration: "
734 @$(MAKE) ARCH=$(ARCH) COMP=$(COMP) config-sanity
736 @echo "Specify a supported architecture with the ARCH option for more details"
741 .PHONY: help build profile-build strip install clean net objclean profileclean \
742 config-sanity icc-profile-use icc-profile-make gcc-profile-use gcc-profile-make \
743 clang-profile-use clang-profile-make
745 build: net config-sanity
746 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) all
748 profile-build: net config-sanity objclean profileclean
750 @echo "Step 1/4. Building instrumented executable ..."
751 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_make)
753 @echo "Step 2/4. Running benchmark for pgo-build ..."
754 $(PGOBENCH) > /dev/null
756 @echo "Step 3/4. Building optimized executable ..."
757 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) objclean
758 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_use)
760 @echo "Step 4/4. Deleting profile data ..."
761 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) profileclean
767 -mkdir -p -m 755 $(BINDIR)
769 -strip $(BINDIR)/$(EXE)
772 clean: objclean profileclean
773 @rm -f .depend *~ core
775 # evaluation network (nnue)
777 $(eval nnuenet := $(shell grep EvalFileDefaultName evaluate.h | grep define | sed 's/.*\(nn-[a-z0-9]\{12\}.nnue\).*/\1/'))
778 @echo "Default net: $(nnuenet)"
779 $(eval nnuedownloadurl := https://tests.stockfishchess.org/api/nn/$(nnuenet))
780 $(eval curl_or_wget := $(shell if hash curl 2>/dev/null; then echo "curl -skL"; elif hash wget 2>/dev/null; then echo "wget -qO-"; fi))
781 @if test -f "$(nnuenet)"; then \
782 echo "Already available."; \
784 if [ "x$(curl_or_wget)" = "x" ]; then \
785 echo "Automatic download failed: neither curl nor wget is installed. Install one of these tools or download the net manually"; exit 1; \
787 echo "Downloading $(nnuedownloadurl)"; $(curl_or_wget) $(nnuedownloadurl) > $(nnuenet);\
790 $(eval shasum_command := $(shell if hash shasum 2>/dev/null; then echo "shasum -a 256 "; elif hash sha256sum 2>/dev/null; then echo "sha256sum "; fi))
791 @if [ "x$(shasum_command)" != "x" ]; then \
792 if [ "$(nnuenet)" != "nn-"`$(shasum_command) $(nnuenet) | cut -c1-12`".nnue" ]; then \
793 echo "Failed download or $(nnuenet) corrupted, please delete!"; exit 1; \
796 echo "shasum / sha256sum not found, skipping net validation"; \
799 # clean binaries and objects
801 @rm -f $(EXE) *.o ./syzygy/*.o ./nnue/*.o ./nnue/features/*.o
803 # clean auxiliary profiling files
806 @rm -f bench.txt *.gcda *.gcno ./syzygy/*.gcda ./nnue/*.gcda ./nnue/features/*.gcda *.s
807 @rm -f stockfish.profdata *.profraw
808 @rm -f stockfish.exe.lto_wrapper_args
809 @rm -f stockfish.exe.ltrans.out
810 @rm -f ./-lstdc++.res
815 ### ==========================================================================
816 ### Section 5. Private Targets
817 ### ==========================================================================
824 @echo "debug: '$(debug)'"
825 @echo "sanitize: '$(sanitize)'"
826 @echo "optimize: '$(optimize)'"
827 @echo "arch: '$(arch)'"
828 @echo "bits: '$(bits)'"
829 @echo "kernel: '$(KERNEL)'"
831 @echo "prefetch: '$(prefetch)'"
832 @echo "popcnt: '$(popcnt)'"
833 @echo "pext: '$(pext)'"
834 @echo "sse: '$(sse)'"
835 @echo "mmx: '$(mmx)'"
836 @echo "sse2: '$(sse2)'"
837 @echo "ssse3: '$(ssse3)'"
838 @echo "sse41: '$(sse41)'"
839 @echo "avx2: '$(avx2)'"
840 @echo "avx512: '$(avx512)'"
841 @echo "vnni256: '$(vnni256)'"
842 @echo "vnni512: '$(vnni512)'"
843 @echo "neon: '$(neon)'"
847 @echo "CXXFLAGS: $(CXXFLAGS)"
848 @echo "LDFLAGS: $(LDFLAGS)"
850 @echo "Testing config sanity. If this fails, try 'make help' ..."
852 @test "$(debug)" = "yes" || test "$(debug)" = "no"
853 @test "$(optimize)" = "yes" || test "$(optimize)" = "no"
854 @test "$(SUPPORTED_ARCH)" = "true"
855 @test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \
856 test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || test "$(arch)" = "e2k" || \
857 test "$(arch)" = "armv7" || test "$(arch)" = "armv8" || test "$(arch)" = "arm64"
858 @test "$(bits)" = "32" || test "$(bits)" = "64"
859 @test "$(prefetch)" = "yes" || test "$(prefetch)" = "no"
860 @test "$(popcnt)" = "yes" || test "$(popcnt)" = "no"
861 @test "$(pext)" = "yes" || test "$(pext)" = "no"
862 @test "$(sse)" = "yes" || test "$(sse)" = "no"
863 @test "$(mmx)" = "yes" || test "$(mmx)" = "no"
864 @test "$(sse2)" = "yes" || test "$(sse2)" = "no"
865 @test "$(ssse3)" = "yes" || test "$(ssse3)" = "no"
866 @test "$(sse41)" = "yes" || test "$(sse41)" = "no"
867 @test "$(avx2)" = "yes" || test "$(avx2)" = "no"
868 @test "$(avx512)" = "yes" || test "$(avx512)" = "no"
869 @test "$(vnni256)" = "yes" || test "$(vnni256)" = "no"
870 @test "$(vnni512)" = "yes" || test "$(vnni512)" = "no"
871 @test "$(neon)" = "yes" || test "$(neon)" = "no"
872 @test "$(comp)" = "gcc" || test "$(comp)" = "icc" || test "$(comp)" = "mingw" || test "$(comp)" = "clang" \
873 || test "$(comp)" = "armv7a-linux-androideabi16-clang" || test "$(comp)" = "aarch64-linux-android21-clang"
876 +$(CXX) -o $@ $(OBJS) $(LDFLAGS)
879 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
880 EXTRACXXFLAGS='-fprofile-instr-generate ' \
881 EXTRALDFLAGS=' -fprofile-instr-generate' \
885 $(XCRUN) llvm-profdata merge -output=stockfish.profdata *.profraw
886 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
887 EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata' \
888 EXTRALDFLAGS='-fprofile-use ' \
893 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
894 EXTRACXXFLAGS='-fprofile-generate=profdir' \
895 EXTRALDFLAGS='-lgcov' \
899 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
900 EXTRACXXFLAGS='-fprofile-use=profdir -fno-peel-loops -fno-tracer' \
901 EXTRALDFLAGS='-lgcov' \
906 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
907 EXTRACXXFLAGS='-prof-gen=srcpos -prof_dir ./profdir' \
911 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
912 EXTRACXXFLAGS='-prof_use -prof_dir ./profdir' \
916 -@$(CXX) $(DEPENDFLAGS) -MM $(SRCS) > $@ 2> /dev/null