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
34 PGOBENCH = ./$(EXE) bench
36 ### Source and object files
37 SRCS = benchmark.cpp bitbase.cpp bitboard.cpp endgame.cpp evaluate.cpp main.cpp \
38 material.cpp misc.cpp movegen.cpp movepick.cpp pawns.cpp position.cpp psqt.cpp \
39 search.cpp thread.cpp timeman.cpp tt.cpp uci.cpp ucioption.cpp tune.cpp syzygy/tbprobe.cpp \
40 nnue/evaluate_nnue.cpp nnue/features/half_kp.cpp \
41 hashprobe.grpc.pb.cc hashprobe.pb.cc
42 CLISRCS = client.cpp hashprobe.grpc.pb.cc hashprobe.pb.cc uci.cpp
44 OBJS = $(notdir $(SRCS:.cpp=.o))
45 CLIOBJS = $(notdir $(CLISRCS:.cpp=.o))
47 VPATH = syzygy:nnue:nnue/features
49 ### Establish the operating system name
50 KERNEL = $(shell uname -s)
51 ifeq ($(KERNEL),Linux)
52 OS = $(shell uname -o)
55 ### ==========================================================================
56 ### Section 2. High-level Configuration
57 ### ==========================================================================
59 # flag --- Comp switch --- Description
60 # ----------------------------------------------------------------------------
62 # debug = yes/no --- -DNDEBUG --- Enable/Disable debug mode
63 # sanitize = undefined/thread/no (-fsanitize )
64 # --- ( undefined ) --- enable undefined behavior checks
65 # --- ( thread ) --- enable threading error checks
66 # optimize = yes/no --- (-O3/-fast etc.) --- Enable/Disable optimizations
67 # arch = (name) --- (-arch) --- Target architecture
68 # bits = 64/32 --- -DIS_64BIT --- 64-/32-bit operating system
69 # prefetch = yes/no --- -DUSE_PREFETCH --- Use prefetch asm-instruction
70 # popcnt = yes/no --- -DUSE_POPCNT --- Use popcnt asm-instruction
71 # pext = yes/no --- -DUSE_PEXT --- Use pext x86_64 asm-instruction
72 # sse = yes/no --- -msse --- Use Intel Streaming SIMD Extensions
73 # mmx = yes/no --- -mmmx --- Use Intel MMX instructions
74 # sse2 = yes/no --- -msse2 --- Use Intel Streaming SIMD Extensions 2
75 # ssse3 = yes/no --- -mssse3 --- Use Intel Supplemental Streaming SIMD Extensions 3
76 # sse41 = yes/no --- -msse4.1 --- Use Intel Streaming SIMD Extensions 4.1
77 # avx2 = yes/no --- -mavx2 --- Use Intel Advanced Vector Extensions 2
78 # avx512 = yes/no --- -mavx512bw --- Use Intel Advanced Vector Extensions 512
79 # vnni256 = yes/no --- -mavx512vnni --- Use Intel Vector Neural Network Instructions 256
80 # vnni512 = yes/no --- -mavx512vnni --- Use Intel Vector Neural Network Instructions 512
81 # neon = yes/no --- -DUSE_NEON --- Use ARM SIMD architecture
83 # Note that Makefile is space sensitive, so when adding new architectures
84 # or modifying existing flags, you have to make sure there are no extra spaces
85 # at the end of the line for flag values.
87 ### 2.1. General and architecture defaults
91 help_skip_sanity = yes
93 # explicitly check for the list of supported architectures (as listed with make help),
94 # the user can override with `make ARCH=x86-32-vnni256 SUPPORTED_ARCH=true`
95 ifeq ($(ARCH), $(filter $(ARCH), \
96 x86-64-vnni512 x86-64-vnni256 x86-64-avx512 x86-64-bmi2 x86-64-avx2 \
97 x86-64-sse41-popcnt x86-64-modern x86-64-ssse3 x86-64-sse3-popcnt \
98 x86-64 x86-32-sse41-popcnt x86-32-sse2 x86-32 ppc-64 ppc-32 \
99 armv7 armv7-neon armv8 apple-silicon general-64 general-32))
124 ### 2.2 Architecture specific
126 ifeq ($(findstring x86,$(ARCH)),x86)
130 ifeq ($(findstring x86-32,$(ARCH)),x86-32)
141 ifeq ($(findstring -sse,$(ARCH)),-sse)
145 ifeq ($(findstring -popcnt,$(ARCH)),-popcnt)
149 ifeq ($(findstring -mmx,$(ARCH)),-mmx)
153 ifeq ($(findstring -sse2,$(ARCH)),-sse2)
158 ifeq ($(findstring -ssse3,$(ARCH)),-ssse3)
164 ifeq ($(findstring -sse41,$(ARCH)),-sse41)
171 ifeq ($(findstring -modern,$(ARCH)),-modern)
179 ifeq ($(findstring -avx2,$(ARCH)),-avx2)
188 ifeq ($(findstring -bmi2,$(ARCH)),-bmi2)
198 ifeq ($(findstring -avx512,$(ARCH)),-avx512)
209 ifeq ($(findstring -vnni256,$(ARCH)),-vnni256)
220 ifeq ($(findstring -vnni512,$(ARCH)),-vnni512)
236 # 64-bit pext is not available on x86-32
243 # all other architectures
245 ifeq ($(ARCH),general-32)
250 ifeq ($(ARCH),general-64)
260 ifeq ($(ARCH),armv7-neon)
275 ifeq ($(ARCH),apple-silicon)
282 ifeq ($(ARCH),ppc-32)
287 ifeq ($(ARCH),ppc-64)
295 ### ==========================================================================
296 ### Section 3. Low-level Configuration
297 ### ==========================================================================
299 ### 3.1 Selecting compiler (default = gcc)
300 CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++17 $(EXTRACXXFLAGS)
301 DEPENDFLAGS += -std=c++17
302 LDFLAGS += $(EXTRALDFLAGS)
311 CXXFLAGS += -pedantic -Wextra
313 ifeq ($(arch),$(filter $(arch),armv7 armv8))
315 CXXFLAGS += -m$(bits)
319 CXXFLAGS += -m$(bits)
323 ifeq ($(arch),$(filter $(arch),armv7))
327 ifneq ($(KERNEL),Darwin)
328 LDFLAGS += -Wl,--no-as-needed
335 ifeq ($(KERNEL),Linux)
337 ifeq ($(shell which x86_64-w64-mingw32-c++-posix),)
338 CXX=x86_64-w64-mingw32-c++
340 CXX=x86_64-w64-mingw32-c++-posix
343 ifeq ($(shell which i686-w64-mingw32-c++-posix),)
344 CXX=i686-w64-mingw32-c++
346 CXX=i686-w64-mingw32-c++-posix
353 CXXFLAGS += -Wextra -Wshadow
360 CXXFLAGS += -diag-disable 1476,10120 -Wcheck -Wabi -Wdeprecated -strict-ansi
366 CXXFLAGS += -pedantic -Wextra -Wshadow
368 ifneq ($(KERNEL),Darwin)
369 ifneq ($(KERNEL),OpenBSD)
370 ifneq ($(KERNEL),FreeBSD)
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
487 CXXFLAGS += -fexperimental-new-pass-manager
493 CXXFLAGS += -DIS_64BIT
497 ifeq ($(prefetch),yes)
502 CXXFLAGS += -DNO_PREFETCH
507 ifeq ($(arch),$(filter $(arch),ppc64 armv7 armv8 arm64))
508 CXXFLAGS += -DUSE_POPCNT
509 else ifeq ($(comp),icc)
510 CXXFLAGS += -msse3 -DUSE_POPCNT
512 CXXFLAGS += -msse3 -mpopcnt -DUSE_POPCNT
518 CXXFLAGS += -DUSE_AVX2
519 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
525 CXXFLAGS += -DUSE_AVX512
526 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
527 CXXFLAGS += -mavx512f -mavx512bw
531 ifeq ($(vnni256),yes)
532 CXXFLAGS += -DUSE_VNNI
533 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
534 CXXFLAGS += -mavx512f -mavx512bw -mavx512vnni -mavx512dq -mavx512vl -mprefer-vector-width=256
538 ifeq ($(vnni512),yes)
539 CXXFLAGS += -DUSE_VNNI
540 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
541 CXXFLAGS += -mavx512vnni -mavx512dq -mavx512vl
546 CXXFLAGS += -DUSE_SSE41
547 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
553 CXXFLAGS += -DUSE_SSSE3
554 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
560 CXXFLAGS += -DUSE_SSE2
561 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
567 CXXFLAGS += -DUSE_MMX
568 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
574 CXXFLAGS += -DUSE_NEON
575 ifeq ($(KERNEL),Linux)
577 ifneq ($(arch),armv8)
578 CXXFLAGS += -mfpu=neon
586 CXXFLAGS += -DUSE_PEXT
587 ifeq ($(comp),$(filter $(comp),gcc clang mingw))
592 ### 3.8 Link Time Optimization
593 ### This is a mix of compile and link time options because the lto link phase
594 ### needs access to the optimization flags.
595 ifeq ($(optimize),yes)
599 ifneq ($(findstring MINGW,$(KERNEL)),)
600 CXXFLAGS += -fuse-ld=lld
601 else ifneq ($(findstring MSYS,$(KERNEL)),)
602 CXXFLAGS += -fuse-ld=lld
604 LDFLAGS += $(CXXFLAGS)
606 # GCC and CLANG use different methods for parallelizing LTO and CLANG pretends to be
607 # GCC on some systems.
608 else ifeq ($(comp),gcc)
609 ifeq ($(gccisclang),)
611 LDFLAGS += $(CXXFLAGS) -flto=jobserver
612 ifneq ($(findstring MINGW,$(KERNEL)),)
613 LDFLAGS += -save-temps
614 else ifneq ($(findstring MSYS,$(KERNEL)),)
615 LDFLAGS += -save-temps
619 LDFLAGS += $(CXXFLAGS)
622 # To use LTO and static linking on windows, the tool chain requires a recent gcc:
623 # gcc version 10.1 in msys2 or TDM-GCC version 9.2 are known to work, older might not.
624 # So, only enable it for a cross from Linux by default.
625 else ifeq ($(comp),mingw)
626 ifeq ($(KERNEL),Linux)
629 LDFLAGS += $(CXXFLAGS) -flto=jobserver
636 ### 3.9 Android 5 can only run position independent executables. Note that this
637 ### breaks Android 4.0 and earlier.
638 ifeq ($(OS), Android)
640 LDFLAGS += -fPIE -pie
643 ### ==========================================================================
644 ### Section 4. Public Targets
645 ### ==========================================================================
650 @echo "To compile stockfish, type: "
652 @echo "make target ARCH=arch [COMP=compiler] [COMPCXX=cxx]"
654 @echo "Supported targets:"
656 @echo "help > Display architecture details"
657 @echo "build > Standard build"
658 @echo "net > Download the default nnue net"
659 @echo "profile-build > Faster build (with profile-guided optimization)"
660 @echo "strip > Strip executable"
661 @echo "install > Install executable"
662 @echo "clean > Clean up"
664 @echo "Supported archs:"
666 @echo "x86-64-vnni512 > x86 64-bit with vnni support 512bit wide"
667 @echo "x86-64-vnni256 > x86 64-bit with vnni support 256bit wide"
668 @echo "x86-64-avx512 > x86 64-bit with avx512 support"
669 @echo "x86-64-bmi2 > x86 64-bit with bmi2 support"
670 @echo "x86-64-avx2 > x86 64-bit with avx2 support"
671 @echo "x86-64-sse41-popcnt > x86 64-bit with sse41 and popcnt support"
672 @echo "x86-64-modern > common modern CPU, currently x86-64-sse41-popcnt"
673 @echo "x86-64-ssse3 > x86 64-bit with ssse3 support"
674 @echo "x86-64-sse3-popcnt > x86 64-bit with sse3 and popcnt support"
675 @echo "x86-64 > x86 64-bit generic (with sse2 support)"
676 @echo "x86-32-sse41-popcnt > x86 32-bit with sse41 and popcnt support"
677 @echo "x86-32-sse2 > x86 32-bit with sse2 support"
678 @echo "x86-32 > x86 32-bit generic (with mmx and sse support)"
679 @echo "ppc-64 > PPC 64-bit"
680 @echo "ppc-32 > PPC 32-bit"
681 @echo "armv7 > ARMv7 32-bit"
682 @echo "armv7-neon > ARMv7 32-bit with popcnt and neon"
683 @echo "armv8 > ARMv8 64-bit with popcnt and neon"
684 @echo "apple-silicon > Apple silicon ARM64"
685 @echo "general-64 > unspecified 64-bit"
686 @echo "general-32 > unspecified 32-bit"
688 @echo "Supported compilers:"
690 @echo "gcc > Gnu compiler (default)"
691 @echo "mingw > Gnu compiler with MinGW under Windows"
692 @echo "clang > LLVM Clang compiler"
693 @echo "icc > Intel compiler"
694 @echo "ndk > Google NDK to cross-compile for Android"
696 @echo "Simple examples. If you don't know what to do, you likely want to run: "
698 @echo "make -j build ARCH=x86-64 (A portable, slow compile for 64-bit systems)"
699 @echo "make -j build ARCH=x86-32 (A portable, slow compile for 32-bit systems)"
701 @echo "Advanced examples, for experienced users looking for performance: "
703 @echo "make help ARCH=x86-64-bmi2"
704 @echo "make -j profile-build ARCH=x86-64-bmi2 COMP=gcc COMPCXX=g++-9.0"
705 @echo "make -j build ARCH=x86-64-ssse3 COMP=clang"
707 @echo "-------------------------------"
708 ifeq ($(SUPPORTED_ARCH)$(help_skip_sanity), true)
709 @echo "The selected architecture $(ARCH) will enable the following configuration: "
710 @$(MAKE) ARCH=$(ARCH) COMP=$(COMP) config-sanity
712 @echo "Specify a supported architecture with the ARCH option for more details"
717 .PHONY: help build profile-build strip install clean net objclean profileclean \
718 config-sanity icc-profile-use icc-profile-make gcc-profile-use gcc-profile-make \
719 clang-profile-use clang-profile-make
721 build: net config-sanity
722 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) all
724 profile-build: net config-sanity objclean profileclean
726 @echo "Step 1/4. Building instrumented executable ..."
727 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_make)
729 @echo "Step 2/4. Running benchmark for pgo-build ..."
730 $(PGOBENCH) > /dev/null
732 @echo "Step 3/4. Building optimized executable ..."
733 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) objclean
734 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_use)
736 @echo "Step 4/4. Deleting profile data ..."
737 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) profileclean
743 -mkdir -p -m 755 $(BINDIR)
745 -strip $(BINDIR)/$(EXE)
748 clean: objclean profileclean
749 @rm -f .depend *~ core
751 # evaluation network (nnue)
753 $(eval nnuenet := $(shell grep EvalFileDefaultName evaluate.h | grep define | sed 's/.*\(nn-[a-z0-9]\{12\}.nnue\).*/\1/'))
754 @echo "Default net: $(nnuenet)"
755 $(eval nnuedownloadurl := https://tests.stockfishchess.org/api/nn/$(nnuenet))
756 $(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))
757 @if test -f "$(nnuenet)"; then \
758 echo "Already available."; \
760 if [ "x$(curl_or_wget)" = "x" ]; then \
761 echo "Automatic download failed: neither curl nor wget is installed. Install one of these tools or download the net manually"; exit 1; \
763 echo "Downloading $(nnuedownloadurl)"; $(curl_or_wget) $(nnuedownloadurl) > $(nnuenet);\
766 $(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))
767 @if [ "x$(shasum_command)" != "x" ]; then \
768 if [ "$(nnuenet)" != "nn-"`$(shasum_command) $(nnuenet) | cut -c1-12`".nnue" ]; then \
769 echo "Failed download or $(nnuenet) corrupted, please delete!"; exit 1; \
772 echo "shasum / sha256sum not found, skipping net validation"; \
775 # clean binaries and objects
777 @rm -f $(EXE) *.o ./syzygy/*.o ./nnue/*.o ./nnue/features/*.o
779 # clean auxiliary profiling files
782 @rm -f bench.txt *.gcda *.gcno ./syzygy/*.gcda ./nnue/*.gcda ./nnue/features/*.gcda *.s
783 @rm -f stockfish.profdata *.profraw
788 ### ==========================================================================
789 ### Section 5. Private Targets
790 ### ==========================================================================
792 all: $(EXE) client .depend
797 @echo "debug: '$(debug)'"
798 @echo "sanitize: '$(sanitize)'"
799 @echo "optimize: '$(optimize)'"
800 @echo "arch: '$(arch)'"
801 @echo "bits: '$(bits)'"
802 @echo "kernel: '$(KERNEL)'"
804 @echo "prefetch: '$(prefetch)'"
805 @echo "popcnt: '$(popcnt)'"
806 @echo "pext: '$(pext)'"
807 @echo "sse: '$(sse)'"
808 @echo "mmx: '$(mmx)'"
809 @echo "sse2: '$(sse2)'"
810 @echo "ssse3: '$(ssse3)'"
811 @echo "sse41: '$(sse41)'"
812 @echo "avx2: '$(avx2)'"
813 @echo "avx512: '$(avx512)'"
814 @echo "vnni256: '$(vnni256)'"
815 @echo "vnni512: '$(vnni512)'"
816 @echo "neon: '$(neon)'"
820 @echo "CXXFLAGS: $(CXXFLAGS)"
821 @echo "LDFLAGS: $(LDFLAGS)"
823 @echo "Testing config sanity. If this fails, try 'make help' ..."
825 @test "$(debug)" = "yes" || test "$(debug)" = "no"
826 @test "$(sanitize)" = "undefined" || test "$(sanitize)" = "thread" || test "$(sanitize)" = "address" || test "$(sanitize)" = "no"
827 @test "$(optimize)" = "yes" || test "$(optimize)" = "no"
828 @test "$(SUPPORTED_ARCH)" = "true"
829 @test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \
830 test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || \
831 test "$(arch)" = "armv7" || test "$(arch)" = "armv8" || test "$(arch)" = "arm64"
832 @test "$(bits)" = "32" || test "$(bits)" = "64"
833 @test "$(prefetch)" = "yes" || test "$(prefetch)" = "no"
834 @test "$(popcnt)" = "yes" || test "$(popcnt)" = "no"
835 @test "$(pext)" = "yes" || test "$(pext)" = "no"
836 @test "$(sse)" = "yes" || test "$(sse)" = "no"
837 @test "$(mmx)" = "yes" || test "$(mmx)" = "no"
838 @test "$(sse2)" = "yes" || test "$(sse2)" = "no"
839 @test "$(ssse3)" = "yes" || test "$(ssse3)" = "no"
840 @test "$(sse41)" = "yes" || test "$(sse41)" = "no"
841 @test "$(avx2)" = "yes" || test "$(avx2)" = "no"
842 @test "$(avx512)" = "yes" || test "$(avx512)" = "no"
843 @test "$(vnni256)" = "yes" || test "$(vnni256)" = "no"
844 @test "$(vnni512)" = "yes" || test "$(vnni512)" = "no"
845 @test "$(neon)" = "yes" || test "$(neon)" = "no"
846 @test "$(comp)" = "gcc" || test "$(comp)" = "icc" || test "$(comp)" = "mingw" || test "$(comp)" = "clang" \
847 || test "$(comp)" = "armv7a-linux-androideabi16-clang" || test "$(comp)" = "aarch64-linux-android21-clang"
850 +$(CXX) -o $@ $(OBJS) $(LDFLAGS)
853 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
854 EXTRACXXFLAGS='-fprofile-instr-generate ' \
855 EXTRALDFLAGS=' -fprofile-instr-generate' \
859 $(XCRUN) llvm-profdata merge -output=stockfish.profdata *.profraw
860 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
861 EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata' \
862 EXTRALDFLAGS='-fprofile-use ' \
866 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
867 EXTRACXXFLAGS='-fprofile-generate' \
868 EXTRALDFLAGS='-lgcov' \
872 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
873 EXTRACXXFLAGS='-fprofile-use -fno-peel-loops -fno-tracer' \
874 EXTRALDFLAGS='-lgcov' \
879 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
880 EXTRACXXFLAGS='-prof-gen=srcpos -prof_dir ./profdir' \
884 $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
885 EXTRACXXFLAGS='-prof_use -prof_dir ./profdir' \
892 GRPC_CPP_PLUGIN = grpc_cpp_plugin
893 GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
895 %.grpc.pb.h %.grpc.pb.cc: %.proto
896 $(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
902 %.pb.h %.pb.cc: %.proto
903 $(PROTOC) -I $(PROTOS_PATH) --cpp_out=. $<
905 #LDFLAGS += -Wl,-Bstatic -Wl,-\( -lprotobuf -lgrpc++_unsecure -lgrpc_unsecure -lgrpc -lz -Wl,-\) -Wl,-Bdynamic -ldl
906 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
907 #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
910 $(CXX) -o $@ $(CLIOBJS) $(LDFLAGS)
915 -@$(CXX) $(DEPENDFLAGS) -MM $(SRCS) > $@ 2> /dev/null