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
24
src/Makefile
24
src/Makefile
|
@ -215,10 +215,15 @@ endif
|
||||||
ifeq ($(comp),icc)
|
ifeq ($(comp),icc)
|
||||||
profile_make = icc-profile-make
|
profile_make = icc-profile-make
|
||||||
profile_use = icc-profile-use
|
profile_use = icc-profile-use
|
||||||
|
else
|
||||||
|
ifeq ($(comp),clang)
|
||||||
|
profile_make = clang-profile-make
|
||||||
|
profile_use = clang-profile-use
|
||||||
else
|
else
|
||||||
profile_make = gcc-profile-make
|
profile_make = gcc-profile-make
|
||||||
profile_use = gcc-profile-use
|
profile_use = gcc-profile-use
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(KERNEL),Darwin)
|
ifeq ($(KERNEL),Darwin)
|
||||||
CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.9
|
CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.9
|
||||||
|
@ -414,7 +419,8 @@ help:
|
||||||
|
|
||||||
|
|
||||||
.PHONY: help build profile-build strip install clean objclean profileclean 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
|
build: config-sanity
|
||||||
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) all
|
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) all
|
||||||
|
@ -454,6 +460,7 @@ objclean:
|
||||||
profileclean:
|
profileclean:
|
||||||
@rm -rf profdir
|
@rm -rf profdir
|
||||||
@rm -f bench.txt *.gcda ./syzygy/*.gcda *.gcno ./syzygy/*.gcno
|
@rm -f bench.txt *.gcda ./syzygy/*.gcda *.gcno ./syzygy/*.gcno
|
||||||
|
@rm -f stockfish.profdata *.profraw
|
||||||
|
|
||||||
default:
|
default:
|
||||||
help
|
help
|
||||||
|
@ -501,9 +508,22 @@ config-sanity:
|
||||||
$(EXE): $(OBJS)
|
$(EXE): $(OBJS)
|
||||||
$(CXX) -o $@ $(OBJS) $(LDFLAGS)
|
$(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:
|
gcc-profile-make:
|
||||||
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
|
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) \
|
||||||
EXTRACXXFLAGS='-fprofile-generate' \
|
EXTRACXXFLAGS='-fprofile-generate'\
|
||||||
EXTRALDFLAGS='-lgcov' \
|
EXTRALDFLAGS='-lgcov' \
|
||||||
all
|
all
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue