mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Add support for gcc-profile
It's now possible to build PGO builds with GCC Patch from Oystein Johansen Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
0c9c5032e8
commit
52fd1a3d37
1 changed files with 31 additions and 5 deletions
34
src/Makefile
34
src/Makefile
|
@ -25,7 +25,6 @@ EXE = stockfish
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
BINDIR = $(PREFIX)/bin
|
BINDIR = $(PREFIX)/bin
|
||||||
|
|
||||||
|
|
||||||
### ==========================================================================
|
### ==========================================================================
|
||||||
### Compiler speed switches for both GCC and ICC. These settings are generally
|
### Compiler speed switches for both GCC and ICC. These settings are generally
|
||||||
### fast on a broad range of systems, but may be changed experimentally
|
### fast on a broad range of systems, but may be changed experimentally
|
||||||
|
@ -57,7 +56,6 @@ ICCFLAGS-OSX += -DNDEBUG
|
||||||
### ==========================================================================
|
### ==========================================================================
|
||||||
PGOBENCH = ./$(EXE) bench 32 1 10 default depth
|
PGOBENCH = ./$(EXE) bench 32 1 10 default depth
|
||||||
|
|
||||||
|
|
||||||
### General compiler settings. Do not change
|
### General compiler settings. Do not change
|
||||||
GCCFLAGS += -g -Wall -fno-exceptions -fno-rtti
|
GCCFLAGS += -g -Wall -fno-exceptions -fno-rtti
|
||||||
ICCFLAGS += -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503
|
ICCFLAGS += -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503
|
||||||
|
@ -84,6 +82,7 @@ help:
|
||||||
@echo "Makefile options:"
|
@echo "Makefile options:"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "make > Default: Compiler = g++"
|
@echo "make > Default: Compiler = g++"
|
||||||
|
@echo "make gcc-profile > Compiler = g++ + automatic pgo-build"
|
||||||
@echo "make gcc-popcnt > Compiler = g++ + popcnt-support"
|
@echo "make gcc-popcnt > Compiler = g++ + popcnt-support"
|
||||||
@echo "make icc > Compiler = icpc"
|
@echo "make icc > Compiler = icpc"
|
||||||
@echo "make icc-profile > Compiler = icpc + automatic pgo-build"
|
@echo "make icc-profile > Compiler = icpc + automatic pgo-build"
|
||||||
|
@ -117,13 +116,40 @@ gcc:
|
||||||
CXXFLAGS="$(GCCFLAGS)" \
|
CXXFLAGS="$(GCCFLAGS)" \
|
||||||
all
|
all
|
||||||
|
|
||||||
|
gcc-profile-make:
|
||||||
|
$(MAKE) \
|
||||||
|
CXX='g++' \
|
||||||
|
CXXFLAGS="$(GCCFLAGS)" \
|
||||||
|
CXXFLAGS+='-fprofile-generate' \
|
||||||
|
LDFLAGS="$(LDFLAGS)" \
|
||||||
|
LDFLAGS+=" -lgcov" \
|
||||||
|
all
|
||||||
|
|
||||||
|
gcc-profile-use:
|
||||||
|
$(MAKE) \
|
||||||
|
CXX='g++' \
|
||||||
|
CXXFLAGS="$(GCCFLAGS)" \
|
||||||
|
CXXFLAGS+='-fprofile-use' \
|
||||||
|
all
|
||||||
|
|
||||||
|
gcc-profile:
|
||||||
|
@touch *.cpp *.h
|
||||||
|
$(MAKE) gcc-profile-make
|
||||||
|
@echo ""
|
||||||
|
@echo "Running benchmark for pgo-build ..."
|
||||||
|
@$(PGOBENCH) > /dev/null
|
||||||
|
@echo "Benchmark finished. Build final executable now ..."
|
||||||
|
@echo ""
|
||||||
|
@touch *.cpp *.h
|
||||||
|
$(MAKE) gcc-profile-use
|
||||||
|
@rm -rf *.gcda bench.txt
|
||||||
|
|
||||||
gcc-popcnt:
|
gcc-popcnt:
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
CXX='g++' \
|
CXX='g++' \
|
||||||
CXXFLAGS="$(GCCFLAGS) -DUSE_POPCNT" \
|
CXXFLAGS="$(GCCFLAGS) -DUSE_POPCNT" \
|
||||||
all
|
all
|
||||||
|
|
||||||
|
|
||||||
icc:
|
icc:
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
CXX='icpc' \
|
CXX='icpc' \
|
||||||
|
@ -320,7 +346,7 @@ strip:
|
||||||
|
|
||||||
### Compilation. Do not change
|
### Compilation. Do not change
|
||||||
$(EXE): $(OBJS)
|
$(EXE): $(OBJS)
|
||||||
$(CXX) $(LDFLAGS) -o $@ $(OBJS)
|
$(CXX) -o $@ $(OBJS) $(LDFLAGS)
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
install: default
|
install: default
|
||||||
|
|
Loading…
Add table
Reference in a new issue