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 \
45 hashprobe.grpc.pb.cc hashprobe.pb.cc
46 CLISRCS = client.cpp hashprobe.grpc.pb.cc hashprobe.pb.cc uci.cpp
48 OBJS = $(notdir $(SRCS:.cpp=.o))
49 CLIOBJS = $(notdir $(CLISRCS:.cpp=.o))
51 VPATH = syzygy:nnue:nnue/features
53 ### Establish the operating system name
54 KERNEL = $(shell uname -s)
55 ifeq ($(KERNEL),Linux)
56 OS = $(shell uname -o)
59 ### ==========================================================================
60 ### Section 2. High-level Configuration
61 ### ==========================================================================
63 # flag --- Comp switch --- Description
64 # ----------------------------------------------------------------------------
66 # debug = yes/no --- -DNDEBUG --- Enable/Disable debug mode
67 # sanitize = none/<sanitizer> ... (-fsanitize )
68 # --- ( undefined ) --- enable undefined behavior checks
69 # --- ( thread ) --- enable threading error checks
70 # --- ( address ) --- enable memory access checks
71 # --- ...etc... --- see compiler documentation for supported sanitizers
72 # optimize = yes/no --- (-O3/-fast etc.) --- Enable/Disable optimizations
73 # arch = (name) --- (-arch) --- Target architecture
74 # bits = 64/32 --- -DIS_64BIT --- 64-/32-bit operating system
75 # prefetch = yes/no --- -DUSE_PREFETCH --- Use prefetch asm-instruction
76 # popcnt = yes/no --- -DUSE_POPCNT --- Use popcnt asm-instruction
77 # pext = yes/no --- -DUSE_PEXT --- Use pext x86_64 asm-instruction
78 # sse = yes/no --- -msse --- Use Intel Streaming SIMD Extensions
79 # mmx = yes/no --- -mmmx --- Use Intel MMX instructions
80 # sse2 = yes/no --- -msse2 --- Use Intel Streaming SIMD Extensions 2
81 # ssse3 = yes/no --- -mssse3 --- Use Intel Supplemental Streaming SIMD Extensions 3
82 # sse41 = yes/no --- -msse4.1 --- Use Intel Streaming SIMD Extensions 4.1
83 # avx2 = yes/no --- -mavx2 --- Use Intel Advanced Vector Extensions 2
84 # avx512 = yes/no --- -mavx512bw --- Use Intel Advanced Vector Extensions 512
85 # vnni256 = yes/no --- -mavx512vnni --- Use Intel Vector Neural Network Instructions 256
86 # vnni512 = yes/no --- -mavx512vnni --- Use Intel Vector Neural Network Instructions 512
87 # neon = yes/no --- -DUSE_NEON --- Use ARM SIMD architecture
89 # Note that Makefile is space sensitive, so when adding new architectures
90 # or modifying existing flags, you have to make sure there are no extra spaces
91 # at the end of the line for flag values.
93 # Example of use for these flags:
94 # make build ARCH=x86-64-avx512 debug=on sanitize="address undefined"
97 ### 2.1. General and architecture defaults
101 help_skip_sanity = yes
103 # explicitly check for the list of supported architectures (as listed with make help),
104 # the user can override with `make ARCH=x86-32-vnni256 SUPPORTED_ARCH=true`
105 ifeq ($(ARCH), $(filter $(ARCH), \
106 x86-64-vnni512 x86-64-vnni256 x86-64-avx512 x86-64-bmi2 x86-64-avx2 \
107 x86-64-sse41-popcnt x86-64-modern x86-64-ssse3 x86-64-sse3-popcnt \
108 x86-64 x86-32-sse41-popcnt x86-32-sse2 x86-32 ppc-64 ppc-32 e2k \
109 armv7 armv7-neon armv8 apple-silicon general-64 general-32))
134 ### 2.2 Architecture specific
136 ifeq ($(findstring x86,$(ARCH)),x86)
140 ifeq ($(findstring x86-32,$(ARCH)),x86-32)
151 ifeq ($(findstring -sse,$(ARCH)),-sse)
155 ifeq ($(findstring -popcnt,$(ARCH)),-popcnt)
159 ifeq ($(findstring -mmx,$(ARCH)),-mmx)
163 ifeq ($(findstring -sse2,$(ARCH)),-sse2)
168 ifeq ($(findstring -ssse3,$(ARCH)),-ssse3)
174 ifeq ($(findstring -sse41,$(ARCH)),-sse41)
181 ifeq ($(findstring -modern,$(ARCH)),-modern)
189 ifeq ($(findstring -avx2,$(ARCH)),-avx2)
198 ifeq ($(findstring -bmi2,$(ARCH)),-bmi2)
208 ifeq ($(findstring -avx512,$(ARCH)),-avx512)
219 ifeq ($(findstring -vnni256,$(ARCH)),-vnni256)
230 ifeq ($(findstring -vnni512,$(ARCH)),-vnni512)
246 # 64-bit pext is not available on x86-32
253 # all other architectures
255 ifeq ($(ARCH),general-32)
260 ifeq ($(ARCH),general-64)
270 ifeq ($(ARCH),armv7-neon)
285 ifeq ($(ARCH),apple-silicon)
292 ifeq ($(ARCH),ppc-32)
297 ifeq ($(ARCH),ppc-64)
303 ifeq ($(findstring e2k,$(ARCH)),e2k)
316 ### ==========================================================================
317 ### Section 3. Low-level Configuration
318 ### ==========================================================================
320 ### 3.1 Selecting compiler (default = gcc)
321 CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++17 $(EXTRACXXFLAGS)
322 DEPENDFLAGS += -std=c++17
323 LDFLAGS += $(EXTRALDFLAGS)
332 CXXFLAGS += -pedantic -Wextra
334 ifeq ($(arch),$(filter $(arch),armv7 armv8))
336 CXXFLAGS += -m$(bits)
340 CXXFLAGS += -m$(bits)
344 ifeq ($(arch),$(filter $(arch),armv7))
348 ifneq ($(KERNEL),Darwin)
349 LDFLAGS += -Wl,--no-as-needed
356 ifeq ($(KERNEL),Linux)
358 ifeq ($(shell which x86_64-w64-mingw32-c++-posix),)
359 CXX=x86_64-w64-mingw32-c++
361 CXX=x86_64-w64-mingw32-c++-posix
364 ifeq ($(shell which i686-w64-mingw32-c++-posix),)
365 CXX=i686-w64-mingw32-c++
367 CXX=i686-w64-mingw32-c++-posix
374 CXXFLAGS += -pedantic -Wextra -Wshadow
381 CXXFLAGS += -diag-disable 1476,10120 -Wcheck -Wabi -Wdeprecated -strict-ansi
387 CXXFLAGS += -pedantic -Wextra -Wshadow
389 ifneq ($(KERNEL),Darwin)
390 ifneq ($(KERNEL),OpenBSD)
391 ifneq ($(KERNEL),FreeBSD)
392 ifneq ($(RTLIB),compiler-rt)
399 ifeq ($(arch),$(filter $(arch),armv7 armv8))
401 CXXFLAGS += -m$(bits)
405 CXXFLAGS += -m$(bits)
410 ifeq ($(KERNEL),Darwin)
411 CXXFLAGS += -mmacosx-version-min=10.14
412 LDFLAGS += -mmacosx-version-min=10.14
414 CXXFLAGS += -arch $(arch)
415 LDFLAGS += -arch $(arch)
420 # To cross-compile for Android, NDK version r21 or later is recommended.
421 # In earlier NDK versions, you'll need to pass -fno-addrsig if using GNU binutils.
422 # Currently we don't know how to make PGO builds with the NDK yet.
424 CXXFLAGS += -stdlib=libc++ -fPIE
427 CXX=armv7a-linux-androideabi16-clang++
428 CXXFLAGS += -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon
429 STRIP=arm-linux-androideabi-strip
432 CXX=aarch64-linux-android21-clang++
433 STRIP=aarch64-linux-android-strip
435 LDFLAGS += -static-libstdc++ -pie -lm -latomic
439 profile_make = icc-profile-make
440 profile_use = icc-profile-use
441 else ifeq ($(comp),clang)
442 profile_make = clang-profile-make
443 profile_use = clang-profile-use
445 profile_make = gcc-profile-make
446 profile_use = gcc-profile-use
449 ### Travis CI script uses COMPILER to overwrite CXX
454 ### Allow overwriting CXX from command line
459 ### Sometimes gcc is really clang
461 gccversion = $(shell $(CXX) --version)
462 gccisclang = $(findstring clang,$(gccversion))
463 ifneq ($(gccisclang),)
464 profile_make = clang-profile-make
465 profile_use = clang-profile-use
469 ### On mingw use Windows threads, otherwise POSIX
470 ifneq ($(comp),mingw)
471 CXXFLAGS += -DUSE_PTHREADS
472 # On Android Bionic's C library comes with its own pthread implementation bundled in
473 ifneq ($(OS),Android)
474 # Haiku has pthreads in its libroot, so only link it in on other platforms
475 ifneq ($(KERNEL),Haiku)
490 ### 3.2.2 Debugging with undefined behavior sanitizers
491 ifneq ($(sanitize),none)
492 CXXFLAGS += -g3 $(addprefix -fsanitize=,$(sanitize))
493 LDFLAGS += $(addprefix -fsanitize=,$(sanitize))
497 ifeq ($(optimize),yes)
502 ifeq ($(OS), Android)
503 CXXFLAGS += -fno-gcse -mthumb -march=armv7-a -mfloat-abi=softfp
507 ifeq ($(comp),$(filter $(comp),gcc clang icc))
508 ifeq ($(KERNEL),Darwin)
509 CXXFLAGS += -mdynamic-no-pic
514 CXXFLAGS += -fexperimental-new-pass-manager
520 CXXFLAGS += -DIS_64BIT
524 ifeq ($(prefetch),yes)
529 CXXFLAGS += -DNO_PREFETCH
534 ifeq ($(arch),$(filter $(arch),ppc64 armv7 armv8 arm64))
535 CXXFLAGS += -DUSE_POPCNT
536 else ifeq ($(comp),icc)
537 CXXFLAGS += -msse3 -DUSE_POPCNT
539 CXXFLAGS += -msse3 -mpopcnt -DUSE_POPCNT
544 CXXFLAGS += -DUSE_AVX2
545 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
551 CXXFLAGS += -DUSE_AVX512
552 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
553 CXXFLAGS += -mavx512f -mavx512bw
557 ifeq ($(vnni256),yes)
558 CXXFLAGS += -DUSE_VNNI
559 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
560 CXXFLAGS += -mavx512f -mavx512bw -mavx512vnni -mavx512dq -mavx512vl -mprefer-vector-width=256
564 ifeq ($(vnni512),yes)
565 CXXFLAGS += -DUSE_VNNI
566 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
567 CXXFLAGS += -mavx512vnni -mavx512dq -mavx512vl
572 CXXFLAGS += -DUSE_SSE41
573 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
579 CXXFLAGS += -DUSE_SSSE3
580 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
586 CXXFLAGS += -DUSE_SSE2
587 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
593 CXXFLAGS += -DUSE_MMX
594 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
600 CXXFLAGS += -DUSE_NEON
601 ifeq ($(KERNEL),Linux)
603 ifneq ($(arch),armv8)
604 CXXFLAGS += -mfpu=neon
612 CXXFLAGS += -DUSE_PEXT
613 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
618 ### 3.8 Link Time Optimization
619 ### This is a mix of compile and link time options because the lto link phase
620 ### needs access to the optimization flags.
621 ifeq ($(optimize),yes)
625 ifneq ($(findstring MINGW,$(KERNEL)),)
626 CXXFLAGS += -fuse-ld=lld
627 else ifneq ($(findstring MSYS,$(KERNEL)),)
628 CXXFLAGS += -fuse-ld=lld
630 LDFLAGS += $(CXXFLAGS)
632 # GCC and CLANG use different methods for parallelizing LTO and CLANG pretends to be
633 # GCC on some systems.
634 else ifeq ($(comp),gcc)
635 ifeq ($(gccisclang),)
637 LDFLAGS += $(CXXFLAGS) -flto=jobserver
638 ifneq ($(findstring MINGW,$(KERNEL)),)
639 LDFLAGS += -save-temps
640 else ifneq ($(findstring MSYS,$(KERNEL)),)
641 LDFLAGS += -save-temps
645 LDFLAGS += $(CXXFLAGS)
648 # To use LTO and static linking on windows, the tool chain requires a recent gcc:
649 # gcc version 10.1 in msys2 or TDM-GCC version 9.2 are known to work, older might not.
650 # So, only enable it for a cross from Linux by default.
651 else ifeq ($(comp),mingw)
652 ifeq ($(KERNEL),Linux)
655 LDFLAGS += $(CXXFLAGS) -flto=jobserver
662 ### 3.9 Android 5 can only run position independent executables. Note that this
663 ### breaks Android 4.0 and earlier.
664 ifeq ($(OS), Android)
666 LDFLAGS += -fPIE -pie
669 ### ==========================================================================
670 ### Section 4. Public Targets
671 ### ==========================================================================
676 @echo "To compile stockfish, type: "
678 @echo "make target ARCH=arch [COMP=compiler] [COMPCXX=cxx]"
680 @echo "Supported targets:"
682 @echo "help > Display architecture details"
683 @echo "build > Standard build"
684 @echo "net > Download the default nnue net"
685 @echo "profile-build > Faster build (with profile-guided optimization)"
686 @echo "strip > Strip executable"
687 @echo "install > Install executable"
688 @echo "clean > Clean up"
690 @echo "Supported archs:"
692 @echo "x86-64-vnni512 > x86 64-bit with vnni support 512bit wide"
693 @echo "x86-64-vnni256 > x86 64-bit with vnni support 256bit wide"
694 @echo "x86-64-avx512 > x86 64-bit with avx512 support"
695 @echo "x86-64-bmi2 > x86 64-bit with bmi2 support"
696 @echo "x86-64-avx2 > x86 64-bit with avx2 support"
697 @echo "x86-64-sse41-popcnt > x86 64-bit with sse41 and popcnt support"
698 @echo "x86-64-modern > common modern CPU, currently x86-64-sse41-popcnt"
699 @echo "x86-64-ssse3 > x86 64-bit with ssse3 support"
700 @echo "x86-64-sse3-popcnt > x86 64-bit with sse3 and popcnt support"
701 @echo "x86-64 > x86 64-bit generic (with sse2 support)"
702 @echo "x86-32-sse41-popcnt > x86 32-bit with sse41 and popcnt support"
703 @echo "x86-32-sse2 > x86 32-bit with sse2 support"
704 @echo "x86-32 > x86 32-bit generic (with mmx and sse support)"
705 @echo "ppc-64 > PPC 64-bit"
706 @echo "ppc-32 > PPC 32-bit"
707 @echo "armv7 > ARMv7 32-bit"
708 @echo "armv7-neon > ARMv7 32-bit with popcnt and neon"
709 @echo "armv8 > ARMv8 64-bit with popcnt and neon"
710 @echo "e2k > Elbrus 2000"
711 @echo "apple-silicon > Apple silicon ARM64"
712 @echo "general-64 > unspecified 64-bit"
713 @echo "general-32 > unspecified 32-bit"
715 @echo "Supported compilers:"
717 @echo "gcc > Gnu compiler (default)"
718 @echo "mingw > Gnu compiler with MinGW under Windows"
719 @echo "clang > LLVM Clang compiler"
720 @echo "icc > Intel compiler"
721 @echo "ndk > Google NDK to cross-compile for Android"
723 @echo "Simple examples. If you don't know what to do, you likely want to run: "
725 @echo "make -j build ARCH=x86-64 (A portable, slow compile for 64-bit systems)"
726 @echo "make -j build ARCH=x86-32 (A portable, slow compile for 32-bit systems)"
728 @echo "Advanced examples, for experienced users looking for performance: "
730 @echo "make help ARCH=x86-64-bmi2"
731 @echo "make -j profile-build ARCH=x86-64-bmi2 COMP=gcc COMPCXX=g++-9.0"
732 @echo "make -j build ARCH=x86-64-ssse3 COMP=clang"
734 @echo "-------------------------------"
735 ifeq ($(SUPPORTED_ARCH)$(help_skip_sanity), true)
736 @echo "The selected architecture $(ARCH) will enable the following configuration: "
737 @$(MAKE) ARCH=$(ARCH) COMP=$(COMP) config-sanity
739 @echo "Specify a supported architecture with the ARCH option for more details"
744 .PHONY: help build profile-build strip install clean net objclean profileclean \
745 config-sanity icc-profile-use icc-profile-make gcc-profile-use gcc-profile-make \
746 clang-profile-use clang-profile-make
748 build: net config-sanity
749 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) all
751 profile-build: net config-sanity objclean profileclean
753 @echo "Step 1/4. Building instrumented executable ..."
754 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_make)
756 @echo "Step 2/4. Running benchmark for pgo-build ..."
757 $(PGOBENCH) > /dev/null
759 @echo "Step 3/4. Building optimized executable ..."
760 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) objclean
761 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_use)
763 @echo "Step 4/4. Deleting profile data ..."
764 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) profileclean
770 -mkdir -p -m 755 $(BINDIR)
772 -strip $(BINDIR)/$(EXE)
775 clean: objclean profileclean
776 @rm -f .depend *~ core
778 # evaluation network (nnue)
780 $(eval nnuenet := $(shell grep EvalFileDefaultName evaluate.h | grep define | sed 's/.*\(nn-[a-z0-9]\{12\}.nnue\).*/\1/'))
781 @echo "Default net: $(nnuenet)"
782 $(eval nnuedownloadurl := https://tests.stockfishchess.org/api/nn/$(nnuenet))
783 $(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))
784 @if test -f "$(nnuenet)"; then \
785 echo "Already available."; \
787 if [ "x$(curl_or_wget)" = "x" ]; then \
788 echo "Automatic download failed: neither curl nor wget is installed. Install one of these tools or download the net manually"; exit 1; \
790 echo "Downloading $(nnuedownloadurl)"; $(curl_or_wget) $(nnuedownloadurl) > $(nnuenet);\
793 $(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))
794 @if [ "x$(shasum_command)" != "x" ]; then \
795 if [ "$(nnuenet)" != "nn-"`$(shasum_command) $(nnuenet) | cut -c1-12`".nnue" ]; then \
796 echo "Failed download or $(nnuenet) corrupted, please delete!"; exit 1; \
799 echo "shasum / sha256sum not found, skipping net validation"; \
802 # clean binaries and objects
804 @rm -f $(EXE) *.o ./syzygy/*.o ./nnue/*.o ./nnue/features/*.o
806 # clean auxiliary profiling files
809 @rm -f bench.txt *.gcda *.gcno ./syzygy/*.gcda ./nnue/*.gcda ./nnue/features/*.gcda *.s
810 @rm -f stockfish.profdata *.profraw
811 @rm -f stockfish.exe.lto_wrapper_args
812 @rm -f stockfish.exe.ltrans.out
813 @rm -f ./-lstdc++.res
818 ### ==========================================================================
819 ### Section 5. Private Targets
820 ### ==========================================================================
822 all: $(EXE) client .depend
827 @echo "debug: '$(debug)'"
828 @echo "sanitize: '$(sanitize)'"
829 @echo "optimize: '$(optimize)'"
830 @echo "arch: '$(arch)'"
831 @echo "bits: '$(bits)'"
832 @echo "kernel: '$(KERNEL)'"
834 @echo "prefetch: '$(prefetch)'"
835 @echo "popcnt: '$(popcnt)'"
836 @echo "pext: '$(pext)'"
837 @echo "sse: '$(sse)'"
838 @echo "mmx: '$(mmx)'"
839 @echo "sse2: '$(sse2)'"
840 @echo "ssse3: '$(ssse3)'"
841 @echo "sse41: '$(sse41)'"
842 @echo "avx2: '$(avx2)'"
843 @echo "avx512: '$(avx512)'"
844 @echo "vnni256: '$(vnni256)'"
845 @echo "vnni512: '$(vnni512)'"
846 @echo "neon: '$(neon)'"
850 @echo "CXXFLAGS: $(CXXFLAGS)"
851 @echo "LDFLAGS: $(LDFLAGS)"
853 @echo "Testing config sanity. If this fails, try 'make help' ..."
855 @test "$(debug)" = "yes" || test "$(debug)" = "no"
856 @test "$(optimize)" = "yes" || test "$(optimize)" = "no"
857 @test "$(SUPPORTED_ARCH)" = "true"
858 @test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \
859 test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || test "$(arch)" = "e2k" || \
860 test "$(arch)" = "armv7" || test "$(arch)" = "armv8" || test "$(arch)" = "arm64"
861 @test "$(bits)" = "32" || test "$(bits)" = "64"
862 @test "$(prefetch)" = "yes" || test "$(prefetch)" = "no"
863 @test "$(popcnt)" = "yes" || test "$(popcnt)" = "no"
864 @test "$(pext)" = "yes" || test "$(pext)" = "no"
865 @test "$(sse)" = "yes" || test "$(sse)" = "no"
866 @test "$(mmx)" = "yes" || test "$(mmx)" = "no"
867 @test "$(sse2)" = "yes" || test "$(sse2)" = "no"
868 @test "$(ssse3)" = "yes" || test "$(ssse3)" = "no"
869 @test "$(sse41)" = "yes" || test "$(sse41)" = "no"
870 @test "$(avx2)" = "yes" || test "$(avx2)" = "no"
871 @test "$(avx512)" = "yes" || test "$(avx512)" = "no"
872 @test "$(vnni256)" = "yes" || test "$(vnni256)" = "no"
873 @test "$(vnni512)" = "yes" || test "$(vnni512)" = "no"
874 @test "$(neon)" = "yes" || test "$(neon)" = "no"
875 @test "$(comp)" = "gcc" || test "$(comp)" = "icc" || test "$(comp)" = "mingw" || test "$(comp)" = "clang" \
876 || test "$(comp)" = "armv7a-linux-androideabi16-clang" || test "$(comp)" = "aarch64-linux-android21-clang"
879 +$(CXX) -o $@ $(OBJS) $(LDFLAGS)
882 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
883 EXTRACXXFLAGS='-fprofile-instr-generate ' \
884 EXTRALDFLAGS=' -fprofile-instr-generate' \
888 $(XCRUN) llvm-profdata merge -output=stockfish.profdata *.profraw
889 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
890 EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata' \
891 EXTRALDFLAGS='-fprofile-use ' \
896 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
897 EXTRACXXFLAGS='-fprofile-generate=profdir' \
898 EXTRALDFLAGS='-lgcov' \
902 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
903 EXTRACXXFLAGS='-fprofile-use=profdir -fno-peel-loops -fno-tracer' \
904 EXTRALDFLAGS='-lgcov' \
909 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
910 EXTRACXXFLAGS='-prof-gen=srcpos -prof_dir ./profdir' \
914 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
915 EXTRACXXFLAGS='-prof_use -prof_dir ./profdir' \
922 GRPC_CPP_PLUGIN = grpc_cpp_plugin
923 GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
925 %.grpc.pb.h %.grpc.pb.cc: %.proto
926 $(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
932 %.pb.h %.pb.cc: %.proto
933 $(PROTOC) -I $(PROTOS_PATH) --cpp_out=. $<
935 #LDFLAGS += -Wl,-Bstatic -Wl,-\( -lprotobuf -lgrpc++_unsecure -lgrpc_unsecure -lgrpc -lz -Wl,-\) -Wl,-Bdynamic -ldl
936 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 /usr/lib/x86_64-linux-gnu/libgpr.a /usr/lib/x86_64-linux-gnu/libabsl_str_format_internal.a /usr/lib/x86_64-linux-gnu/libabsl_strings.a /usr/lib/x86_64-linux-gnu/libabsl_flags_marshalling.a /usr/lib/x86_64-linux-gnu/libabsl_throw_delegate.a /usr/lib/x86_64-linux-gnu/libabsl_raw_logging_internal.a /usr/lib/x86_64-linux-gnu/libabsl_base.a /usr/lib/x86_64-linux-gnu/libabsl_int128.a /usr/lib/x86_64-linux-gnu/libabsl_bad_optional_access.a -ldl -lz
937 #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
940 $(CXX) -o $@ $(CLIOBJS) $(LDFLAGS)
945 -@$(CXX) $(DEPENDFLAGS) -MM $(SRCS) > $@ 2> /dev/null