mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Fix PGO Build for clang
This fixes https://github.com/official-stockfish/Stockfish/issues/167. Additional improvments by Joost VandeVondele.
This commit is contained in:
parent
8f30d233f8
commit
fbb2ffacfd
1 changed files with 22 additions and 2 deletions
22
src/Makefile
22
src/Makefile
|
@ -215,10 +215,15 @@ endif
|
|||
ifeq ($(comp),icc)
|
||||
profile_make = icc-profile-make
|
||||
profile_use = icc-profile-use
|
||||
else
|
||||
ifeq ($(comp),clang)
|
||||
profile_make = clang-profile-make
|
||||
profile_use = clang-profile-use
|
||||
else
|
||||
profile_make = gcc-profile-make
|
||||
profile_use = gcc-profile-use
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(KERNEL),Darwin)
|
||||
CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.9
|
||||
|
@ -414,7 +419,8 @@ help:
|
|||
|
||||
|
||||
.PHONY: help build profile-build strip install clean objclean profileclean help \
|
||||
config-sanity icc-profile-use icc-profile-make gcc-profile-use gcc-profile-make
|
||||
config-sanity icc-profile-use icc-profile-make gcc-profile-use gcc-profile-make \
|
||||
clang-profile-use clang-profile-make
|
||||
|
||||
build: config-sanity
|
||||
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) all
|
||||
|
@ -454,6 +460,7 @@ objclean:
|
|||
profileclean:
|
||||
@rm -rf profdir
|
||||
@rm -f bench.txt *.gcda ./syzygy/*.gcda *.gcno ./syzygy/*.gcno
|
||||
@rm -f stockfish.profdata *.profraw
|
||||
|
||||
default:
|
||||
help
|
||||
|
@ -501,6 +508,19 @@ config-sanity:
|
|||
$(EXE): $(OBJS)
|
||||
$(CXX) -o $@ $(OBJS) $(LDFLAGS)
|
||||
|
||||
clang-profile-make:
|
||||
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
|
||||
EXTRACXXFLAGS='-fprofile-instr-generate ' \
|
||||
EXTRALDFLAGS=' -fprofile-instr-generate' \
|
||||
all
|
||||
|
||||
clang-profile-use:
|
||||
llvm-profdata merge -output=stockfish.profdata *.profraw
|
||||
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
|
||||
EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata' \
|
||||
EXTRALDFLAGS='-fprofile-use ' \
|
||||
all
|
||||
|
||||
gcc-profile-make:
|
||||
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
|
||||
EXTRACXXFLAGS='-fprofile-generate'\
|
||||
|
|
Loading…
Add table
Reference in a new issue