1 # Stockfish, a UCI chess playing engine derived from Glaurung 2.1
2 # Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
3 # Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
4 # Copyright (C) 2015-2019 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
6 # Stockfish is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # Stockfish is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ### ==========================================================================
21 ### Section 1. General Configuration
22 ### ==========================================================================
31 ### Installation dir definitions
33 BINDIR = $(PREFIX)/bin
35 ### Built-in benchmark for pgo-builds
36 PGOBENCH = ./$(EXE) bench
38 ### Source and object files
39 SRCS = benchmark.cpp bitbase.cpp bitboard.cpp endgame.cpp evaluate.cpp main.cpp \
40 material.cpp misc.cpp movegen.cpp movepick.cpp pawns.cpp position.cpp psqt.cpp \
41 search.cpp thread.cpp timeman.cpp tt.cpp uci.cpp ucioption.cpp tune.cpp syzygy/tbprobe.cpp \
42 nnue/evaluate_nnue.cpp nnue/features/half_kp.cpp \
43 hashprobe.grpc.pb.cc hashprobe.pb.cc
44 CLISRCS = client.cpp hashprobe.grpc.pb.cc hashprobe.pb.cc uci.cpp
46 OBJS = $(notdir $(SRCS:.cpp=.o))
47 CLIOBJS = $(notdir $(CLISRCS:.cpp=.o))
49 VPATH = syzygy:nnue:nnue/features
51 ### Establish the operating system name
52 KERNEL = $(shell uname -s)
53 ifeq ($(KERNEL),Linux)
54 OS = $(shell uname -o)
57 ### ==========================================================================
58 ### Section 2. High-level Configuration
59 ### ==========================================================================
61 # flag --- Comp switch --- Description
62 # ----------------------------------------------------------------------------
64 # debug = yes/no --- -DNDEBUG --- Enable/Disable debug mode
65 # sanitize = undefined/thread/no (-fsanitize )
66 # --- ( undefined ) --- enable undefined behavior checks
67 # --- ( thread ) --- enable threading error checks
68 # optimize = yes/no --- (-O3/-fast etc.) --- Enable/Disable optimizations
69 # arch = (name) --- (-arch) --- Target architecture
70 # bits = 64/32 --- -DIS_64BIT --- 64-/32-bit operating system
71 # prefetch = yes/no --- -DUSE_PREFETCH --- Use prefetch asm-instruction
72 # popcnt = yes/no --- -DUSE_POPCNT --- Use popcnt asm-instruction
73 # pext = yes/no --- -DUSE_PEXT --- Use pext x86_64 asm-instruction
74 # sse = yes/no --- -msse --- Use Intel Streaming SIMD Extensions
75 # mmx = yes/no --- -mmmx --- Use Intel MMX instructions
76 # sse2 = yes/no --- -msse2 --- Use Intel Streaming SIMD Extensions 2
77 # ssse3 = yes/no --- -mssse3 --- Use Intel Supplemental Streaming SIMD Extensions 3
78 # sse41 = yes/no --- -msse4.1 --- Use Intel Streaming SIMD Extensions 4.1
79 # avx2 = yes/no --- -mavx2 --- Use Intel Advanced Vector Extensions 2
80 # avx512 = yes/no --- -mavx512bw --- Use Intel Advanced Vector Extensions 512
81 # vnni256 = yes/no --- -mavx512vnni --- Use Intel Vector Neural Network Instructions 256
82 # vnni512 = yes/no --- -mavx512vnni --- Use Intel Vector Neural Network Instructions 512
83 # neon = yes/no --- -DUSE_NEON --- Use ARM SIMD architecture
85 # Note that Makefile is space sensitive, so when adding new architectures
86 # or modifying existing flags, you have to make sure there are no extra spaces
87 # at the end of the line for flag values.
89 ### 2.1. General and architecture defaults
93 help_skip_sanity = yes
95 # explicitly check for the list of supported architectures (as listed with make help),
96 # the user can override with `make ARCH=x86-32-vnni256 SUPPORTED_ARCH=true`
97 ifeq ($(ARCH), $(filter $(ARCH), \
98 x86-64-vnni512 x86-64-vnni256 x86-64-avx512 x86-64-bmi2 x86-64-avx2 \
99 x86-64-sse41-popcnt x86-64-modern x86-64-ssse3 x86-64-sse3-popcnt \
100 x86-64 x86-32-sse41-popcnt x86-32-sse2 x86-32 ppc-64 ppc-32 \
101 armv7 armv7-neon armv8 apple-silicon general-64 general-32))
126 ### 2.2 Architecture specific
128 ifeq ($(findstring x86,$(ARCH)),x86)
132 ifeq ($(findstring x86-32,$(ARCH)),x86-32)
143 ifeq ($(findstring -sse,$(ARCH)),-sse)
147 ifeq ($(findstring -popcnt,$(ARCH)),-popcnt)
151 ifeq ($(findstring -mmx,$(ARCH)),-mmx)
155 ifeq ($(findstring -sse2,$(ARCH)),-sse2)
160 ifeq ($(findstring -ssse3,$(ARCH)),-ssse3)
166 ifeq ($(findstring -sse41,$(ARCH)),-sse41)
173 ifeq ($(findstring -modern,$(ARCH)),-modern)
181 ifeq ($(findstring -avx2,$(ARCH)),-avx2)
190 ifeq ($(findstring -bmi2,$(ARCH)),-bmi2)
200 ifeq ($(findstring -avx512,$(ARCH)),-avx512)
211 ifeq ($(findstring -vnni256,$(ARCH)),-vnni256)
222 ifeq ($(findstring -vnni512,$(ARCH)),-vnni512)
238 # 64-bit pext is not available on x86-32
245 # all other architectures
247 ifeq ($(ARCH),general-32)
252 ifeq ($(ARCH),general-64)
262 ifeq ($(ARCH),armv7-neon)
277 ifeq ($(ARCH),apple-silicon)
284 ifeq ($(ARCH),ppc-32)
289 ifeq ($(ARCH),ppc-64)
297 ### ==========================================================================
298 ### Section 3. Low-level Configuration
299 ### ==========================================================================
301 ### 3.1 Selecting compiler (default = gcc)
302 CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++17 $(EXTRACXXFLAGS)
303 DEPENDFLAGS += -std=c++17
304 LDFLAGS += $(EXTRALDFLAGS)
313 CXXFLAGS += -pedantic -Wextra
315 ifeq ($(arch),$(filter $(arch),armv7 armv8))
317 CXXFLAGS += -m$(bits)
321 CXXFLAGS += -m$(bits)
325 ifeq ($(arch),$(filter $(arch),armv7))
329 ifneq ($(KERNEL),Darwin)
330 LDFLAGS += -Wl,--no-as-needed
337 ifeq ($(KERNEL),Linux)
339 ifeq ($(shell which x86_64-w64-mingw32-c++-posix),)
340 CXX=x86_64-w64-mingw32-c++
342 CXX=x86_64-w64-mingw32-c++-posix
345 ifeq ($(shell which i686-w64-mingw32-c++-posix),)
346 CXX=i686-w64-mingw32-c++
348 CXX=i686-w64-mingw32-c++-posix
355 CXXFLAGS += -Wextra -Wshadow
362 CXXFLAGS += -diag-disable 1476,10120 -Wcheck -Wabi -Wdeprecated -strict-ansi
368 CXXFLAGS += -pedantic -Wextra -Wshadow
370 ifneq ($(KERNEL),Darwin)
371 ifneq ($(KERNEL),OpenBSD)
376 ifeq ($(arch),$(filter $(arch),armv7 armv8))
378 CXXFLAGS += -m$(bits)
382 CXXFLAGS += -m$(bits)
387 ifeq ($(KERNEL),Darwin)
388 CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.14
389 LDFLAGS += -arch $(arch) -mmacosx-version-min=10.14
393 # To cross-compile for Android, NDK version r21 or later is recommended.
394 # In earlier NDK versions, you'll need to pass -fno-addrsig if using GNU binutils.
395 # Currently we don't know how to make PGO builds with the NDK yet.
397 CXXFLAGS += -stdlib=libc++ -fPIE
400 CXX=armv7a-linux-androideabi16-clang++
401 CXXFLAGS += -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon
402 STRIP=arm-linux-androideabi-strip
405 CXX=aarch64-linux-android21-clang++
406 STRIP=aarch64-linux-android-strip
408 LDFLAGS += -static-libstdc++ -pie -lm -latomic
412 profile_make = icc-profile-make
413 profile_use = icc-profile-use
414 else ifeq ($(comp),clang)
415 profile_make = clang-profile-make
416 profile_use = clang-profile-use
418 profile_make = gcc-profile-make
419 profile_use = gcc-profile-use
422 ### Travis CI script uses COMPILER to overwrite CXX
427 ### Allow overwriting CXX from command line
432 ### Sometimes gcc is really clang
434 gccversion = $(shell $(CXX) --version)
435 gccisclang = $(findstring clang,$(gccversion))
436 ifneq ($(gccisclang),)
437 profile_make = clang-profile-make
438 profile_use = clang-profile-use
442 ### On mingw use Windows threads, otherwise POSIX
443 ifneq ($(comp),mingw)
444 CXXFLAGS += -DUSE_PTHREADS
445 # On Android Bionic's C library comes with its own pthread implementation bundled in
446 ifneq ($(OS),Android)
447 # Haiku has pthreads in its libroot, so only link it in on other platforms
448 ifneq ($(KERNEL),Haiku)
463 ### 3.2.2 Debugging with undefined behavior sanitizers
464 ifneq ($(sanitize),no)
465 CXXFLAGS += -g3 -fsanitize=$(sanitize)
466 LDFLAGS += -fsanitize=$(sanitize)
470 ifeq ($(optimize),yes)
475 ifeq ($(OS), Android)
476 CXXFLAGS += -fno-gcse -mthumb -march=armv7-a -mfloat-abi=softfp
480 ifeq ($(comp),$(filter $(comp),gcc clang icc))
481 ifeq ($(KERNEL),Darwin)
482 CXXFLAGS += -mdynamic-no-pic
489 CXXFLAGS += -DIS_64BIT
493 ifeq ($(prefetch),yes)
498 CXXFLAGS += -DNO_PREFETCH
503 ifeq ($(arch),$(filter $(arch),ppc64 armv7 armv8 arm64))
504 CXXFLAGS += -DUSE_POPCNT
505 else ifeq ($(comp),icc)
506 CXXFLAGS += -msse3 -DUSE_POPCNT
508 CXXFLAGS += -msse3 -mpopcnt -DUSE_POPCNT
514 CXXFLAGS += -DUSE_AVX2
515 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
521 CXXFLAGS += -DUSE_AVX512
522 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
523 CXXFLAGS += -mavx512f -mavx512bw
527 ifeq ($(vnni256),yes)
528 CXXFLAGS += -DUSE_VNNI
529 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
530 CXXFLAGS += -mavx512f -mavx512bw -mavx512vnni -mavx512dq -mavx512vl -mprefer-vector-width=256
534 ifeq ($(vnni512),yes)
535 CXXFLAGS += -DUSE_VNNI
536 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
537 CXXFLAGS += -mavx512vnni -mavx512dq -mavx512vl
542 CXXFLAGS += -DUSE_SSE41
543 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
549 CXXFLAGS += -DUSE_SSSE3
550 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
556 CXXFLAGS += -DUSE_SSE2
557 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
563 CXXFLAGS += -DUSE_MMX
564 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
570 CXXFLAGS += -DUSE_NEON
571 ifeq ($(KERNEL),Linux)
573 ifneq ($(arch),armv8)
574 CXXFLAGS += -mfpu=neon
582 CXXFLAGS += -DUSE_PEXT
583 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
588 ### 3.8 Link Time Optimization
589 ### This is a mix of compile and link time options because the lto link phase
590 ### needs access to the optimization flags.
591 ifeq ($(optimize),yes)
594 CXXFLAGS += -flto=thin
595 ifneq ($(findstring MINGW,$(KERNEL)),)
596 CXXFLAGS += -fuse-ld=lld
597 else ifneq ($(findstring MSYS,$(KERNEL)),)
598 CXXFLAGS += -fuse-ld=lld
600 LDFLAGS += $(CXXFLAGS)
602 # GCC and CLANG use different methods for parallelizing LTO and CLANG pretends to be
603 # GCC on some systems.
604 else ifeq ($(comp),gcc)
605 ifeq ($(gccisclang),)
607 LDFLAGS += $(CXXFLAGS) -flto=jobserver
608 ifneq ($(findstring MINGW,$(KERNEL)),)
609 LDFLAGS += -save-temps
610 else ifneq ($(findstring MSYS,$(KERNEL)),)
611 LDFLAGS += -save-temps
614 CXXFLAGS += -flto=thin
615 LDFLAGS += $(CXXFLAGS)
618 # To use LTO and static linking on windows, the tool chain requires a recent gcc:
619 # gcc version 10.1 in msys2 or TDM-GCC version 9.2 are known to work, older might not.
620 # So, only enable it for a cross from Linux by default.
621 else ifeq ($(comp),mingw)
622 ifeq ($(KERNEL),Linux)
625 LDFLAGS += $(CXXFLAGS) -flto=jobserver
632 ### 3.9 Android 5 can only run position independent executables. Note that this
633 ### breaks Android 4.0 and earlier.
634 ifeq ($(OS), Android)
636 LDFLAGS += -fPIE -pie
639 ### ==========================================================================
640 ### Section 4. Public Targets
641 ### ==========================================================================
646 @echo "To compile stockfish, type: "
648 @echo "make target ARCH=arch [COMP=compiler] [COMPCXX=cxx]"
650 @echo "Supported targets:"
652 @echo "help > Display architecture details"
653 @echo "build > Standard build"
654 @echo "net > Download the default nnue net"
655 @echo "profile-build > Faster build (with profile-guided optimization)"
656 @echo "strip > Strip executable"
657 @echo "install > Install executable"
658 @echo "clean > Clean up"
660 @echo "Supported archs:"
662 @echo "x86-64-vnni512 > x86 64-bit with vnni support 512bit wide"
663 @echo "x86-64-vnni256 > x86 64-bit with vnni support 256bit wide"
664 @echo "x86-64-avx512 > x86 64-bit with avx512 support"
665 @echo "x86-64-bmi2 > x86 64-bit with bmi2 support"
666 @echo "x86-64-avx2 > x86 64-bit with avx2 support"
667 @echo "x86-64-sse41-popcnt > x86 64-bit with sse41 and popcnt support"
668 @echo "x86-64-modern > common modern CPU, currently x86-64-sse41-popcnt"
669 @echo "x86-64-ssse3 > x86 64-bit with ssse3 support"
670 @echo "x86-64-sse3-popcnt > x86 64-bit with sse3 and popcnt support"
671 @echo "x86-64 > x86 64-bit generic (with sse2 support)"
672 @echo "x86-32-sse41-popcnt > x86 32-bit with sse41 and popcnt support"
673 @echo "x86-32-sse2 > x86 32-bit with sse2 support"
674 @echo "x86-32 > x86 32-bit generic (with mmx and sse support)"
675 @echo "ppc-64 > PPC 64-bit"
676 @echo "ppc-32 > PPC 32-bit"
677 @echo "armv7 > ARMv7 32-bit"
678 @echo "armv7-neon > ARMv7 32-bit with popcnt and neon"
679 @echo "armv8 > ARMv8 64-bit with popcnt and neon"
680 @echo "apple-silicon > Apple silicon ARM64"
681 @echo "general-64 > unspecified 64-bit"
682 @echo "general-32 > unspecified 32-bit"
684 @echo "Supported compilers:"
686 @echo "gcc > Gnu compiler (default)"
687 @echo "mingw > Gnu compiler with MinGW under Windows"
688 @echo "clang > LLVM Clang compiler"
689 @echo "icc > Intel compiler"
690 @echo "ndk > Google NDK to cross-compile for Android"
692 @echo "Simple examples. If you don't know what to do, you likely want to run: "
694 @echo "make -j build ARCH=x86-64 (A portable, slow compile for 64-bit systems)"
695 @echo "make -j build ARCH=x86-32 (A portable, slow compile for 32-bit systems)"
697 @echo "Advanced examples, for experienced users looking for performance: "
699 @echo "make help ARCH=x86-64-bmi2"
700 @echo "make -j profile-build ARCH=x86-64-bmi2 COMP=gcc COMPCXX=g++-9.0"
701 @echo "make -j build ARCH=x86-64-ssse3 COMP=clang"
703 @echo "-------------------------------"
704 ifeq ($(SUPPORTED_ARCH)$(help_skip_sanity), true)
705 @echo "The selected architecture $(ARCH) will enable the following configuration: "
706 @$(MAKE) ARCH=$(ARCH) COMP=$(COMP) config-sanity
708 @echo "Specify a supported architecture with the ARCH option for more details"
713 .PHONY: help build profile-build strip install clean net objclean profileclean \
714 config-sanity icc-profile-use icc-profile-make gcc-profile-use gcc-profile-make \
715 clang-profile-use clang-profile-make
717 build: net config-sanity
718 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) all
720 profile-build: net config-sanity objclean profileclean
722 @echo "Step 1/4. Building instrumented executable ..."
723 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_make)
725 @echo "Step 2/4. Running benchmark for pgo-build ..."
726 $(PGOBENCH) > /dev/null
728 @echo "Step 3/4. Building optimized executable ..."
729 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) objclean
730 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_use)
732 @echo "Step 4/4. Deleting profile data ..."
733 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) profileclean
739 -mkdir -p -m 755 $(BINDIR)
741 -strip $(BINDIR)/$(EXE)
744 clean: objclean profileclean
745 @rm -f .depend *~ core
747 # evaluation network (nnue)
749 $(eval nnuenet := $(shell grep EvalFileDefaultName evaluate.h | grep define | sed 's/.*\(nn-[a-z0-9]\{12\}.nnue\).*/\1/'))
750 @echo "Default net: $(nnuenet)"
751 $(eval nnuedownloadurl := https://tests.stockfishchess.org/api/nn/$(nnuenet))
752 $(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))
753 @if test -f "$(nnuenet)"; then \
754 echo "Already available."; \
756 if [ "x$(curl_or_wget)" = "x" ]; then \
757 echo "Automatic download failed: neither curl nor wget is installed. Install one of these tools or download the net manually"; exit 1; \
759 echo "Downloading $(nnuedownloadurl)"; $(curl_or_wget) $(nnuedownloadurl) > $(nnuenet);\
762 $(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))
763 @if [ "x$(shasum_command)" != "x" ]; then \
764 if [ "$(nnuenet)" != "nn-"`$(shasum_command) $(nnuenet) | cut -c1-12`".nnue" ]; then \
765 echo "Failed download or $(nnuenet) corrupted, please delete!"; exit 1; \
768 echo "shasum / sha256sum not found, skipping net validation"; \
771 # clean binaries and objects
773 @rm -f $(EXE) *.o ./syzygy/*.o ./nnue/*.o ./nnue/features/*.o
775 # clean auxiliary profiling files
778 @rm -f bench.txt *.gcda *.gcno ./syzygy/*.gcda ./nnue/*.gcda ./nnue/features/*.gcda *.s
779 @rm -f stockfish.profdata *.profraw
784 ### ==========================================================================
785 ### Section 5. Private Targets
786 ### ==========================================================================
788 all: $(EXE) client .depend
793 @echo "debug: '$(debug)'"
794 @echo "sanitize: '$(sanitize)'"
795 @echo "optimize: '$(optimize)'"
796 @echo "arch: '$(arch)'"
797 @echo "bits: '$(bits)'"
798 @echo "kernel: '$(KERNEL)'"
800 @echo "prefetch: '$(prefetch)'"
801 @echo "popcnt: '$(popcnt)'"
802 @echo "pext: '$(pext)'"
803 @echo "sse: '$(sse)'"
804 @echo "mmx: '$(mmx)'"
805 @echo "sse2: '$(sse2)'"
806 @echo "ssse3: '$(ssse3)'"
807 @echo "sse41: '$(sse41)'"
808 @echo "avx2: '$(avx2)'"
809 @echo "avx512: '$(avx512)'"
810 @echo "vnni256: '$(vnni256)'"
811 @echo "vnni512: '$(vnni512)'"
812 @echo "neon: '$(neon)'"
816 @echo "CXXFLAGS: $(CXXFLAGS)"
817 @echo "LDFLAGS: $(LDFLAGS)"
819 @echo "Testing config sanity. If this fails, try 'make help' ..."
821 @test "$(debug)" = "yes" || test "$(debug)" = "no"
822 @test "$(sanitize)" = "undefined" || test "$(sanitize)" = "thread" || test "$(sanitize)" = "address" || test "$(sanitize)" = "no"
823 @test "$(optimize)" = "yes" || test "$(optimize)" = "no"
824 @test "$(SUPPORTED_ARCH)" = "true"
825 @test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \
826 test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || \
827 test "$(arch)" = "armv7" || test "$(arch)" = "armv8" || test "$(arch)" = "arm64"
828 @test "$(bits)" = "32" || test "$(bits)" = "64"
829 @test "$(prefetch)" = "yes" || test "$(prefetch)" = "no"
830 @test "$(popcnt)" = "yes" || test "$(popcnt)" = "no"
831 @test "$(pext)" = "yes" || test "$(pext)" = "no"
832 @test "$(sse)" = "yes" || test "$(sse)" = "no"
833 @test "$(mmx)" = "yes" || test "$(mmx)" = "no"
834 @test "$(sse2)" = "yes" || test "$(sse2)" = "no"
835 @test "$(ssse3)" = "yes" || test "$(ssse3)" = "no"
836 @test "$(sse41)" = "yes" || test "$(sse41)" = "no"
837 @test "$(avx2)" = "yes" || test "$(avx2)" = "no"
838 @test "$(avx512)" = "yes" || test "$(avx512)" = "no"
839 @test "$(vnni256)" = "yes" || test "$(vnni256)" = "no"
840 @test "$(vnni512)" = "yes" || test "$(vnni512)" = "no"
841 @test "$(neon)" = "yes" || test "$(neon)" = "no"
842 @test "$(comp)" = "gcc" || test "$(comp)" = "icc" || test "$(comp)" = "mingw" || test "$(comp)" = "clang" \
843 || test "$(comp)" = "armv7a-linux-androideabi16-clang" || test "$(comp)" = "aarch64-linux-android21-clang"
846 +$(CXX) -o $@ $(OBJS) $(LDFLAGS)
849 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
850 EXTRACXXFLAGS='-fprofile-instr-generate ' \
851 EXTRALDFLAGS=' -fprofile-instr-generate' \
855 $(XCRUN) llvm-profdata merge -output=stockfish.profdata *.profraw
856 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
857 EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata' \
858 EXTRALDFLAGS='-fprofile-use ' \
862 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
863 EXTRACXXFLAGS='-fprofile-generate' \
864 EXTRALDFLAGS='-lgcov' \
868 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
869 EXTRACXXFLAGS='-fprofile-use -fno-peel-loops -fno-tracer' \
870 EXTRALDFLAGS='-lgcov' \
875 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
876 EXTRACXXFLAGS='-prof-gen=srcpos -prof_dir ./profdir' \
880 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
881 EXTRACXXFLAGS='-prof_use -prof_dir ./profdir' \
888 GRPC_CPP_PLUGIN = grpc_cpp_plugin
889 GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
891 %.grpc.pb.h %.grpc.pb.cc: %.proto
892 $(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
898 %.pb.h %.pb.cc: %.proto
899 $(PROTOC) -I $(PROTOS_PATH) --cpp_out=. $<
901 #LDFLAGS += -Wl,-Bstatic -Wl,-\( -lprotobuf -lgrpc++_unsecure -lgrpc_unsecure -lgrpc -lz -Wl,-\) -Wl,-Bdynamic -ldl
902 LDFLAGS += /usr/lib/x86_64-linux-gnu/libprotobuf.a /usr/lib/x86_64-linux-gnu/libgrpc++_unsecure.a /usr/lib/x86_64-linux-gnu/libgrpc_unsecure.a /usr/lib/x86_64-linux-gnu/libgrpc.a /usr/lib/x86_64-linux-gnu/libcares.a -ldl -lz
903 #LDFLAGS += /usr/lib/x86_64-linux-gnu/libprotobuf.a /usr/lib/libgrpc++_unsecure.a /usr/lib/libgrpc_unsecure.a /usr/lib/libgrpc.a /usr/lib/x86_64-linux-gnu/libcares.a -ldl -lz
906 $(CXX) -o $@ $(CLIOBJS) $(LDFLAGS)
911 -@$(CXX) $(DEPENDFLAGS) -MM $(SRCS) > $@ 2> /dev/null