Rev 183 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 96 | pmbaty | 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 |
||
| 185 | pmbaty | 4 | # Copyright (C) 2015-2019 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad |
| 96 | pmbaty | 5 | # |
| 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. |
||
| 10 | # |
||
| 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. |
||
| 15 | # |
||
| 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/>. |
||
| 18 | |||
| 19 | |||
| 20 | ### ========================================================================== |
||
| 21 | ### Section 1. General Configuration |
||
| 22 | ### ========================================================================== |
||
| 23 | |||
| 24 | ### Executable name |
||
| 185 | pmbaty | 25 | ifeq ($(COMP),mingw) |
| 26 | EXE = stockfish.exe |
||
| 182 | pmbaty | 27 | else |
| 185 | pmbaty | 28 | EXE = stockfish |
| 182 | pmbaty | 29 | endif |
| 96 | pmbaty | 30 | |
| 31 | ### Installation dir definitions |
||
| 32 | PREFIX = /usr/local |
||
| 33 | BINDIR = $(PREFIX)/bin |
||
| 34 | |||
| 35 | ### Built-in benchmark for pgo-builds |
||
| 154 | pmbaty | 36 | PGOBENCH = ./$(EXE) bench |
| 96 | pmbaty | 37 | |
| 38 | ### Object files |
||
| 39 | OBJS = benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o \ |
||
| 40 | material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o \ |
||
| 41 | search.o thread.o timeman.o tt.o uci.o ucioption.o syzygy/tbprobe.o |
||
| 42 | |||
| 185 | pmbaty | 43 | ### Establish the operating system name |
| 44 | KERNEL = $(shell uname -s) |
||
| 45 | ifeq ($(KERNEL),Linux) |
||
| 46 | OS = $(shell uname -o) |
||
| 47 | endif |
||
| 48 | |||
| 96 | pmbaty | 49 | ### ========================================================================== |
| 50 | ### Section 2. High-level Configuration |
||
| 51 | ### ========================================================================== |
||
| 52 | # |
||
| 53 | # flag --- Comp switch --- Description |
||
| 54 | # ---------------------------------------------------------------------------- |
||
| 55 | # |
||
| 56 | # debug = yes/no --- -DNDEBUG --- Enable/Disable debug mode |
||
| 169 | pmbaty | 57 | # sanitize = undefined/thread/no (-fsanitize ) |
| 58 | # --- ( undefined ) --- enable undefined behavior checks |
||
| 59 | # --- ( thread ) --- enable threading error checks |
||
| 96 | pmbaty | 60 | # optimize = yes/no --- (-O3/-fast etc.) --- Enable/Disable optimizations |
| 61 | # arch = (name) --- (-arch) --- Target architecture |
||
| 62 | # bits = 64/32 --- -DIS_64BIT --- 64-/32-bit operating system |
||
| 154 | pmbaty | 63 | # prefetch = yes/no --- -DUSE_PREFETCH --- Use prefetch asm-instruction |
| 64 | # popcnt = yes/no --- -DUSE_POPCNT --- Use popcnt asm-instruction |
||
| 96 | pmbaty | 65 | # sse = yes/no --- -msse --- Use Intel Streaming SIMD Extensions |
| 66 | # pext = yes/no --- -DUSE_PEXT --- Use pext x86_64 asm-instruction |
||
| 67 | # |
||
| 68 | # Note that Makefile is space sensitive, so when adding new architectures |
||
| 69 | # or modifying existing flags, you have to make sure there are no extra spaces |
||
| 70 | # at the end of the line for flag values. |
||
| 71 | |||
| 72 | ### 2.1. General and architecture defaults |
||
| 73 | optimize = yes |
||
| 74 | debug = no |
||
| 185 | pmbaty | 75 | sanitize = no |
| 96 | pmbaty | 76 | bits = 32 |
| 77 | prefetch = no |
||
| 78 | popcnt = no |
||
| 79 | sse = no |
||
| 80 | pext = no |
||
| 81 | |||
| 82 | ### 2.2 Architecture specific |
||
| 83 | |||
| 84 | ifeq ($(ARCH),general-32) |
||
| 85 | arch = any |
||
| 86 | endif |
||
| 87 | |||
| 88 | ifeq ($(ARCH),x86-32-old) |
||
| 89 | arch = i386 |
||
| 90 | endif |
||
| 91 | |||
| 92 | ifeq ($(ARCH),x86-32) |
||
| 93 | arch = i386 |
||
| 94 | prefetch = yes |
||
| 95 | sse = yes |
||
| 96 | endif |
||
| 97 | |||
| 98 | ifeq ($(ARCH),general-64) |
||
| 99 | arch = any |
||
| 100 | bits = 64 |
||
| 101 | endif |
||
| 102 | |||
| 103 | ifeq ($(ARCH),x86-64) |
||
| 104 | arch = x86_64 |
||
| 105 | bits = 64 |
||
| 106 | prefetch = yes |
||
| 107 | sse = yes |
||
| 108 | endif |
||
| 109 | |||
| 110 | ifeq ($(ARCH),x86-64-modern) |
||
| 111 | arch = x86_64 |
||
| 112 | bits = 64 |
||
| 113 | prefetch = yes |
||
| 114 | popcnt = yes |
||
| 115 | sse = yes |
||
| 116 | endif |
||
| 117 | |||
| 118 | ifeq ($(ARCH),x86-64-bmi2) |
||
| 119 | arch = x86_64 |
||
| 120 | bits = 64 |
||
| 121 | prefetch = yes |
||
| 122 | popcnt = yes |
||
| 123 | sse = yes |
||
| 124 | pext = yes |
||
| 125 | endif |
||
| 126 | |||
| 127 | ifeq ($(ARCH),armv7) |
||
| 128 | arch = armv7 |
||
| 129 | prefetch = yes |
||
| 130 | endif |
||
| 131 | |||
| 132 | ifeq ($(ARCH),ppc-32) |
||
| 133 | arch = ppc |
||
| 134 | endif |
||
| 135 | |||
| 136 | ifeq ($(ARCH),ppc-64) |
||
| 137 | arch = ppc64 |
||
| 138 | bits = 64 |
||
| 139 | endif |
||
| 140 | |||
| 141 | |||
| 142 | ### ========================================================================== |
||
| 143 | ### Section 3. Low-level configuration |
||
| 144 | ### ========================================================================== |
||
| 145 | |||
| 146 | ### 3.1 Selecting compiler (default = gcc) |
||
| 147 | |||
| 169 | pmbaty | 148 | CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++11 $(EXTRACXXFLAGS) |
| 96 | pmbaty | 149 | DEPENDFLAGS += -std=c++11 |
| 150 | LDFLAGS += $(EXTRALDFLAGS) |
||
| 151 | |||
| 185 | pmbaty | 152 | ifeq ($(COMP),) |
| 153 | COMP=gcc |
||
| 154 | endif |
||
| 96 | pmbaty | 155 | |
| 156 | ifeq ($(COMP),gcc) |
||
| 157 | comp=gcc |
||
| 158 | CXX=g++ |
||
| 159 | CXXFLAGS += -pedantic -Wextra -Wshadow |
||
| 154 | pmbaty | 160 | |
| 161 | ifeq ($(ARCH),armv7) |
||
| 162 | ifeq ($(OS),Android) |
||
| 163 | CXXFLAGS += -m$(bits) |
||
| 169 | pmbaty | 164 | LDFLAGS += -m$(bits) |
| 154 | pmbaty | 165 | endif |
| 166 | else |
||
| 167 | CXXFLAGS += -m$(bits) |
||
| 169 | pmbaty | 168 | LDFLAGS += -m$(bits) |
| 154 | pmbaty | 169 | endif |
| 170 | |||
| 171 | ifneq ($(KERNEL),Darwin) |
||
| 96 | pmbaty | 172 | LDFLAGS += -Wl,--no-as-needed |
| 173 | endif |
||
| 174 | endif |
||
| 175 | |||
| 176 | ifeq ($(COMP),mingw) |
||
| 177 | comp=mingw |
||
| 178 | |||
| 154 | pmbaty | 179 | ifeq ($(KERNEL),Linux) |
| 96 | pmbaty | 180 | ifeq ($(bits),64) |
| 181 | ifeq ($(shell which x86_64-w64-mingw32-c++-posix),) |
||
| 182 | CXX=x86_64-w64-mingw32-c++ |
||
| 183 | else |
||
| 184 | CXX=x86_64-w64-mingw32-c++-posix |
||
| 185 | endif |
||
| 186 | else |
||
| 187 | ifeq ($(shell which i686-w64-mingw32-c++-posix),) |
||
| 188 | CXX=i686-w64-mingw32-c++ |
||
| 189 | else |
||
| 190 | CXX=i686-w64-mingw32-c++-posix |
||
| 191 | endif |
||
| 192 | endif |
||
| 193 | else |
||
| 194 | CXX=g++ |
||
| 195 | endif |
||
| 196 | |||
| 197 | CXXFLAGS += -Wextra -Wshadow |
||
| 198 | LDFLAGS += -static |
||
| 199 | endif |
||
| 200 | |||
| 201 | ifeq ($(COMP),icc) |
||
| 202 | comp=icc |
||
| 203 | CXX=icpc |
||
| 204 | CXXFLAGS += -diag-disable 1476,10120 -Wcheck -Wabi -Wdeprecated -strict-ansi |
||
| 205 | endif |
||
| 206 | |||
| 207 | ifeq ($(COMP),clang) |
||
| 208 | comp=clang |
||
| 209 | CXX=clang++ |
||
| 210 | CXXFLAGS += -pedantic -Wextra -Wshadow |
||
| 154 | pmbaty | 211 | |
| 185 | pmbaty | 212 | ifneq ($(KERNEL),Darwin) |
| 213 | ifneq ($(KERNEL),OpenBSD) |
||
| 214 | LDFLAGS += -latomic |
||
| 215 | endif |
||
| 216 | endif |
||
| 217 | |||
| 154 | pmbaty | 218 | ifeq ($(ARCH),armv7) |
| 219 | ifeq ($(OS),Android) |
||
| 220 | CXXFLAGS += -m$(bits) |
||
| 221 | LDFLAGS += -m$(bits) |
||
| 222 | endif |
||
| 223 | else |
||
| 224 | CXXFLAGS += -m$(bits) |
||
| 225 | LDFLAGS += -m$(bits) |
||
| 226 | endif |
||
| 96 | pmbaty | 227 | endif |
| 228 | |||
| 229 | ifeq ($(comp),icc) |
||
| 230 | profile_make = icc-profile-make |
||
| 231 | profile_use = icc-profile-use |
||
| 232 | else |
||
| 169 | pmbaty | 233 | ifeq ($(comp),clang) |
| 234 | profile_make = clang-profile-make |
||
| 235 | profile_use = clang-profile-use |
||
| 236 | else |
||
| 96 | pmbaty | 237 | profile_make = gcc-profile-make |
| 238 | profile_use = gcc-profile-use |
||
| 239 | endif |
||
| 169 | pmbaty | 240 | endif |
| 96 | pmbaty | 241 | |
| 154 | pmbaty | 242 | ifeq ($(KERNEL),Darwin) |
| 96 | pmbaty | 243 | CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.9 |
| 244 | LDFLAGS += -arch $(arch) -mmacosx-version-min=10.9 |
||
| 245 | endif |
||
| 246 | |||
| 247 | ### Travis CI script uses COMPILER to overwrite CXX |
||
| 248 | ifdef COMPILER |
||
| 249 | COMPCXX=$(COMPILER) |
||
| 250 | endif |
||
| 251 | |||
| 252 | ### Allow overwriting CXX from command line |
||
| 253 | ifdef COMPCXX |
||
| 254 | CXX=$(COMPCXX) |
||
| 255 | endif |
||
| 256 | |||
| 183 | pmbaty | 257 | ### On mingw use Windows threads, otherwise POSIX |
| 258 | ifneq ($(comp),mingw) |
||
| 185 | pmbaty | 259 | # On Android Bionic's C library comes with its own pthread implementation bundled in |
| 260 | ifneq ($(OS),Android) |
||
| 261 | # Haiku has pthreads in its libroot, so only link it in on other platforms |
||
| 262 | ifneq ($(KERNEL),Haiku) |
||
| 263 | LDFLAGS += -lpthread |
||
| 96 | pmbaty | 264 | endif |
| 265 | endif |
||
| 266 | endif |
||
| 267 | |||
| 154 | pmbaty | 268 | ### 3.2.1 Debugging |
| 96 | pmbaty | 269 | ifeq ($(debug),no) |
| 270 | CXXFLAGS += -DNDEBUG |
||
| 271 | else |
||
| 272 | CXXFLAGS += -g |
||
| 273 | endif |
||
| 274 | |||
| 154 | pmbaty | 275 | ### 3.2.2 Debugging with undefined behavior sanitizers |
| 169 | pmbaty | 276 | ifneq ($(sanitize),no) |
| 185 | pmbaty | 277 | CXXFLAGS += -g3 -fsanitize=$(sanitize) -fuse-ld=gold |
| 278 | LDFLAGS += -fsanitize=$(sanitize) -fuse-ld=gold |
||
| 154 | pmbaty | 279 | endif |
| 280 | |||
| 281 | ### 3.3 Optimization |
||
| 96 | pmbaty | 282 | ifeq ($(optimize),yes) |
| 283 | |||
| 154 | pmbaty | 284 | CXXFLAGS += -O3 |
| 285 | |||
| 96 | pmbaty | 286 | ifeq ($(comp),gcc) |
| 154 | pmbaty | 287 | ifeq ($(OS), Android) |
| 96 | pmbaty | 288 | CXXFLAGS += -fno-gcse -mthumb -march=armv7-a -mfloat-abi=softfp |
| 289 | endif |
||
| 290 | endif |
||
| 185 | pmbaty | 291 | |
| 292 | ifeq ($(comp),$(filter $(comp),gcc clang icc)) |
||
| 154 | pmbaty | 293 | ifeq ($(KERNEL),Darwin) |
| 294 | CXXFLAGS += -mdynamic-no-pic |
||
| 96 | pmbaty | 295 | endif |
| 296 | endif |
||
| 297 | endif |
||
| 298 | |||
| 154 | pmbaty | 299 | ### 3.4 Bits |
| 96 | pmbaty | 300 | ifeq ($(bits),64) |
| 301 | CXXFLAGS += -DIS_64BIT |
||
| 302 | endif |
||
| 303 | |||
| 154 | pmbaty | 304 | ### 3.5 prefetch |
| 96 | pmbaty | 305 | ifeq ($(prefetch),yes) |
| 306 | ifeq ($(sse),yes) |
||
| 307 | CXXFLAGS += -msse |
||
| 308 | DEPENDFLAGS += -msse |
||
| 309 | endif |
||
| 310 | else |
||
| 311 | CXXFLAGS += -DNO_PREFETCH |
||
| 312 | endif |
||
| 313 | |||
| 154 | pmbaty | 314 | ### 3.6 popcnt |
| 96 | pmbaty | 315 | ifeq ($(popcnt),yes) |
| 316 | ifeq ($(comp),icc) |
||
| 317 | CXXFLAGS += -msse3 -DUSE_POPCNT |
||
| 318 | else |
||
| 319 | CXXFLAGS += -msse3 -mpopcnt -DUSE_POPCNT |
||
| 320 | endif |
||
| 321 | endif |
||
| 322 | |||
| 154 | pmbaty | 323 | ### 3.7 pext |
| 96 | pmbaty | 324 | ifeq ($(pext),yes) |
| 325 | CXXFLAGS += -DUSE_PEXT |
||
| 326 | ifeq ($(comp),$(filter $(comp),gcc clang mingw)) |
||
| 154 | pmbaty | 327 | CXXFLAGS += -mbmi2 |
| 96 | pmbaty | 328 | endif |
| 329 | endif |
||
| 330 | |||
| 154 | pmbaty | 331 | ### 3.8 Link Time Optimization, it works since gcc 4.5 but not on mingw under Windows. |
| 96 | pmbaty | 332 | ### This is a mix of compile and link time options because the lto link phase |
| 333 | ### needs access to the optimization flags. |
||
| 185 | pmbaty | 334 | ifeq ($(optimize),yes) |
| 335 | ifeq ($(debug), no) |
||
| 336 | ifeq ($(comp),$(filter $(comp),gcc clang)) |
||
| 96 | pmbaty | 337 | CXXFLAGS += -flto |
| 338 | LDFLAGS += $(CXXFLAGS) |
||
| 339 | endif |
||
| 340 | |||
| 185 | pmbaty | 341 | ifeq ($(comp),mingw) |
| 154 | pmbaty | 342 | ifeq ($(KERNEL),Linux) |
| 96 | pmbaty | 343 | CXXFLAGS += -flto |
| 344 | LDFLAGS += $(CXXFLAGS) |
||
| 345 | endif |
||
| 346 | endif |
||
| 347 | endif |
||
| 185 | pmbaty | 348 | endif |
| 96 | pmbaty | 349 | |
| 154 | pmbaty | 350 | ### 3.9 Android 5 can only run position independent executables. Note that this |
| 96 | pmbaty | 351 | ### breaks Android 4.0 and earlier. |
| 154 | pmbaty | 352 | ifeq ($(OS), Android) |
| 96 | pmbaty | 353 | CXXFLAGS += -fPIE |
| 354 | LDFLAGS += -fPIE -pie |
||
| 355 | endif |
||
| 356 | |||
| 357 | |||
| 358 | ### ========================================================================== |
||
| 359 | ### Section 4. Public targets |
||
| 360 | ### ========================================================================== |
||
| 361 | |||
| 362 | help: |
||
| 363 | @echo "" |
||
| 364 | @echo "To compile stockfish, type: " |
||
| 365 | @echo "" |
||
| 366 | @echo "make target ARCH=arch [COMP=compiler] [COMPCXX=cxx]" |
||
| 367 | @echo "" |
||
| 368 | @echo "Supported targets:" |
||
| 369 | @echo "" |
||
| 370 | @echo "build > Standard build" |
||
| 371 | @echo "profile-build > PGO build" |
||
| 372 | @echo "strip > Strip executable" |
||
| 373 | @echo "install > Install executable" |
||
| 374 | @echo "clean > Clean up" |
||
| 375 | @echo "" |
||
| 376 | @echo "Supported archs:" |
||
| 377 | @echo "" |
||
| 378 | @echo "x86-64 > x86 64-bit" |
||
| 379 | @echo "x86-64-modern > x86 64-bit with popcnt support" |
||
| 380 | @echo "x86-64-bmi2 > x86 64-bit with pext support" |
||
| 381 | @echo "x86-32 > x86 32-bit with SSE support" |
||
| 382 | @echo "x86-32-old > x86 32-bit fall back for old hardware" |
||
| 383 | @echo "ppc-64 > PPC 64-bit" |
||
| 384 | @echo "ppc-32 > PPC 32-bit" |
||
| 385 | @echo "armv7 > ARMv7 32-bit" |
||
| 386 | @echo "general-64 > unspecified 64-bit" |
||
| 387 | @echo "general-32 > unspecified 32-bit" |
||
| 388 | @echo "" |
||
| 389 | @echo "Supported compilers:" |
||
| 390 | @echo "" |
||
| 391 | @echo "gcc > Gnu compiler (default)" |
||
| 392 | @echo "mingw > Gnu compiler with MinGW under Windows" |
||
| 393 | @echo "clang > LLVM Clang compiler" |
||
| 394 | @echo "icc > Intel compiler" |
||
| 395 | @echo "" |
||
| 396 | @echo "Simple examples. If you don't know what to do, you likely want to run: " |
||
| 397 | @echo "" |
||
| 398 | @echo "make build ARCH=x86-64 (This is for 64-bit systems)" |
||
| 399 | @echo "make build ARCH=x86-32 (This is for 32-bit systems)" |
||
| 400 | @echo "" |
||
| 401 | @echo "Advanced examples, for experienced users: " |
||
| 402 | @echo "" |
||
| 403 | @echo "make build ARCH=x86-64 COMP=clang" |
||
| 404 | @echo "make profile-build ARCH=x86-64-modern COMP=gcc COMPCXX=g++-4.8" |
||
| 405 | @echo "" |
||
| 406 | |||
| 407 | |||
| 169 | pmbaty | 408 | .PHONY: help build profile-build strip install clean objclean profileclean help \ |
| 409 | config-sanity icc-profile-use icc-profile-make gcc-profile-use gcc-profile-make \ |
||
| 410 | clang-profile-use clang-profile-make |
||
| 411 | |||
| 412 | build: config-sanity |
||
| 96 | pmbaty | 413 | $(MAKE) ARCH=$(ARCH) COMP=$(COMP) all |
| 414 | |||
| 169 | pmbaty | 415 | profile-build: config-sanity objclean profileclean |
| 96 | pmbaty | 416 | @echo "" |
| 169 | pmbaty | 417 | @echo "Step 1/4. Building instrumented executable ..." |
| 96 | pmbaty | 418 | $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_make) |
| 419 | @echo "" |
||
| 420 | @echo "Step 2/4. Running benchmark for pgo-build ..." |
||
| 421 | $(PGOBENCH) > /dev/null |
||
| 422 | @echo "" |
||
| 169 | pmbaty | 423 | @echo "Step 3/4. Building optimized executable ..." |
| 424 | $(MAKE) ARCH=$(ARCH) COMP=$(COMP) objclean |
||
| 96 | pmbaty | 425 | $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_use) |
| 426 | @echo "" |
||
| 427 | @echo "Step 4/4. Deleting profile data ..." |
||
| 169 | pmbaty | 428 | $(MAKE) ARCH=$(ARCH) COMP=$(COMP) profileclean |
| 96 | pmbaty | 429 | |
| 430 | strip: |
||
| 431 | strip $(EXE) |
||
| 432 | |||
| 433 | install: |
||
| 434 | -mkdir -p -m 755 $(BINDIR) |
||
| 435 | -cp $(EXE) $(BINDIR) |
||
| 436 | -strip $(BINDIR)/$(EXE) |
||
| 437 | |||
| 169 | pmbaty | 438 | #clean all |
| 439 | clean: objclean profileclean |
||
| 440 | @rm -f .depend *~ core |
||
| 96 | pmbaty | 441 | |
| 169 | pmbaty | 442 | # clean binaries and objects |
| 443 | objclean: |
||
| 185 | pmbaty | 444 | @rm -f $(EXE) *.o ./syzygy/*.o |
| 169 | pmbaty | 445 | |
| 446 | # clean auxiliary profiling files |
||
| 447 | profileclean: |
||
| 448 | @rm -rf profdir |
||
| 449 | @rm -f bench.txt *.gcda ./syzygy/*.gcda *.gcno ./syzygy/*.gcno |
||
| 450 | @rm -f stockfish.profdata *.profraw |
||
| 451 | |||
| 96 | pmbaty | 452 | default: |
| 453 | help |
||
| 454 | |||
| 455 | ### ========================================================================== |
||
| 456 | ### Section 5. Private targets |
||
| 457 | ### ========================================================================== |
||
| 458 | |||
| 459 | all: $(EXE) .depend |
||
| 460 | |||
| 461 | config-sanity: |
||
| 462 | @echo "" |
||
| 463 | @echo "Config:" |
||
| 464 | @echo "debug: '$(debug)'" |
||
| 169 | pmbaty | 465 | @echo "sanitize: '$(sanitize)'" |
| 96 | pmbaty | 466 | @echo "optimize: '$(optimize)'" |
| 467 | @echo "arch: '$(arch)'" |
||
| 468 | @echo "bits: '$(bits)'" |
||
| 154 | pmbaty | 469 | @echo "kernel: '$(KERNEL)'" |
| 470 | @echo "os: '$(OS)'" |
||
| 96 | pmbaty | 471 | @echo "prefetch: '$(prefetch)'" |
| 472 | @echo "popcnt: '$(popcnt)'" |
||
| 473 | @echo "sse: '$(sse)'" |
||
| 474 | @echo "pext: '$(pext)'" |
||
| 475 | @echo "" |
||
| 476 | @echo "Flags:" |
||
| 477 | @echo "CXX: $(CXX)" |
||
| 478 | @echo "CXXFLAGS: $(CXXFLAGS)" |
||
| 479 | @echo "LDFLAGS: $(LDFLAGS)" |
||
| 480 | @echo "" |
||
| 481 | @echo "Testing config sanity. If this fails, try 'make help' ..." |
||
| 482 | @echo "" |
||
| 483 | @test "$(debug)" = "yes" || test "$(debug)" = "no" |
||
| 169 | pmbaty | 484 | @test "$(sanitize)" = "undefined" || test "$(sanitize)" = "thread" || test "$(sanitize)" = "no" |
| 96 | pmbaty | 485 | @test "$(optimize)" = "yes" || test "$(optimize)" = "no" |
| 486 | @test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \ |
||
| 487 | test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || test "$(arch)" = "armv7" |
||
| 488 | @test "$(bits)" = "32" || test "$(bits)" = "64" |
||
| 489 | @test "$(prefetch)" = "yes" || test "$(prefetch)" = "no" |
||
| 490 | @test "$(popcnt)" = "yes" || test "$(popcnt)" = "no" |
||
| 491 | @test "$(sse)" = "yes" || test "$(sse)" = "no" |
||
| 492 | @test "$(pext)" = "yes" || test "$(pext)" = "no" |
||
| 493 | @test "$(comp)" = "gcc" || test "$(comp)" = "icc" || test "$(comp)" = "mingw" || test "$(comp)" = "clang" |
||
| 494 | |||
| 495 | $(EXE): $(OBJS) |
||
| 496 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) |
||
| 497 | |||
| 169 | pmbaty | 498 | clang-profile-make: |
| 499 | $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ |
||
| 500 | EXTRACXXFLAGS='-fprofile-instr-generate ' \ |
||
| 501 | EXTRALDFLAGS=' -fprofile-instr-generate' \ |
||
| 502 | all |
||
| 96 | pmbaty | 503 | |
| 169 | pmbaty | 504 | clang-profile-use: |
| 505 | llvm-profdata merge -output=stockfish.profdata *.profraw |
||
| 506 | $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ |
||
| 507 | EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata' \ |
||
| 508 | EXTRALDFLAGS='-fprofile-use ' \ |
||
| 509 | all |
||
| 510 | |||
| 96 | pmbaty | 511 | gcc-profile-make: |
| 512 | $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ |
||
| 513 | EXTRACXXFLAGS='-fprofile-generate' \ |
||
| 514 | EXTRALDFLAGS='-lgcov' \ |
||
| 515 | all |
||
| 516 | |||
| 517 | gcc-profile-use: |
||
| 518 | $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ |
||
| 519 | EXTRACXXFLAGS='-fprofile-use -fno-peel-loops -fno-tracer' \ |
||
| 520 | EXTRALDFLAGS='-lgcov' \ |
||
| 521 | all |
||
| 522 | |||
| 523 | icc-profile-make: |
||
| 169 | pmbaty | 524 | @mkdir -p profdir |
| 96 | pmbaty | 525 | $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ |
| 526 | EXTRACXXFLAGS='-prof-gen=srcpos -prof_dir ./profdir' \ |
||
| 527 | all |
||
| 528 | |||
| 529 | icc-profile-use: |
||
| 530 | $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ |
||
| 531 | EXTRACXXFLAGS='-prof_use -prof_dir ./profdir' \ |
||
| 532 | all |
||
| 533 | |||
| 534 | .depend: |
||
| 535 | -@$(CXX) $(DEPENDFLAGS) -MM $(OBJS:.o=.cpp) > $@ 2> /dev/null |
||
| 536 | |||
| 537 | -include .depend |
||
| 538 |