X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2FMakefile;h=748a739e254551daedf022a8efbe0b3e53e21b77;hp=ff3405f7883c08e2cc379ca76d6bf6c312629bd4;hb=3a558a3d8b1400e0bafe0ba5c368c65542462a36;hpb=fd12e8cb239180607559bb805e233f7ea704a67c diff --git a/src/Makefile b/src/Makefile index ff3405f7..748a739e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -21,6 +21,10 @@ ### Executable name. Do not change EXE = stockfish +### Installation dir definitions +PREFIX = /usr/local +BINDIR = $(PREFIX)/bin + ### ========================================================================== ### Compiler speed switches for both GCC and ICC. These settings are generally @@ -28,6 +32,7 @@ EXE = stockfish ### ========================================================================== GCCFLAGS = -O3 -msse ICCFLAGS = -fast -msse +ICCFLAGS-OSX = -fast -mdynamic-no-pic ### ========================================================================== @@ -35,6 +40,15 @@ ICCFLAGS = -fast -msse ### ========================================================================== GCCFLAGS += -DNDEBUG ICCFLAGS += -DNDEBUG +ICCFLAGS-OSX += -DNDEBUG + + +### ========================================================================== +### Remove below comments to compile for a big-endian machine +### ========================================================================== +#GCCFLAGS += -DBIGENDIAN +#ICCFLAGS += -DBIGENDIAN +#ICCFLAGS-OSX += -DBIGENDIAN ### ========================================================================== @@ -45,8 +59,9 @@ PGOBENCH = ./$(EXE) bench 32 1 10 default depth ### General compiler settings. Do not change -GCCFLAGS += -g -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing -ICCFLAGS += -g -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing -wd383,869,981,10187,10188,11505,11503 +GCCFLAGS += -g -Wall -fno-exceptions -fno-rtti +ICCFLAGS += -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503 +ICCFLAGS-OSX += -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503 ### General linker settings. Do not change @@ -69,20 +84,30 @@ help: @echo "Makefile options:" @echo "" @echo "make > Default: Compiler = g++" + @echo "make gcc-popcnt > Compiler = g++ + popcnt-support" @echo "make icc > Compiler = icpc" @echo "make icc-profile > Compiler = icpc + automatic pgo-build" + @echo "make icc-profile-popcnt > Compiler = icpc + automatic pgo-build + popcnt-support" @echo "make osx-ppc32 > PPC-Mac OS X 32 bit. Compiler = g++" @echo "make osx-ppc64 > PPC-Mac OS X 64 bit. Compiler = g++" @echo "make osx-x86 > x86-Mac OS X 32 bit. Compiler = g++" @echo "make osx-x86_64 > x86-Mac OS X 64 bit. Compiler = g++" + @echo "make osx-icc32 > x86-Mac OS X 32 bit. Compiler = icpc" + @echo "make osx-icc64 > x86-Mac OS X 64 bit. Compiler = icpc" + @echo "make osx-icc32-profile > OSX 32 bit. Compiler = icpc + automatic pgo-build" + @echo "make osx-icc64-profile > OSX 64 bit. Compiler = icpc + automatic pgo-build" + @echo "make hpux > HP-UX. Compiler = aCC" @echo "make strip > Strip executable" @echo "make clean > Clean up" @echo "" all: $(EXE) .depend +test check: default + @$(PGOBENCH) + clean: - $(RM) *.o .depend *~ $(EXE) + $(RM) *.o .depend *~ $(EXE) core bench.txt ### Possible targets. You may add your own ones here @@ -92,6 +117,13 @@ gcc: CXXFLAGS="$(GCCFLAGS)" \ all +gcc-popcnt: + $(MAKE) \ + CXX='g++' \ + CXXFLAGS="$(GCCFLAGS) -DUSE_POPCNT" \ + all + + icc: $(MAKE) \ CXX='icpc' \ @@ -126,6 +158,40 @@ icc-profile: $(MAKE) icc-profile-use @rm -rf profdir bench.txt +icc-profile-make-with-popcnt: + $(MAKE) \ + CXX='icpc' \ + CXXFLAGS="$(ICCFLAGS) -DUSE_POPCNT" \ + CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \ + all + +icc-profile-use-with-popcnt: + $(MAKE) \ + CXX='icpc' \ + CXXFLAGS="$(ICCFLAGS) -DUSE_POPCNT" \ + CXXFLAGS+='-prof_use -prof_dir ./profdir' \ + all + +icc-profile-popcnt: + @rm -rf profdir + @mkdir profdir + @touch *.cpp *.h + $(MAKE) icc-profile-make + @echo "" + @echo "Running benchmark for pgo-build (popcnt disabled)..." + @$(PGOBENCH) > /dev/null + @touch *.cpp *.h + $(MAKE) icc-profile-make-with-popcnt + @echo "" + @echo "Running benchmark for pgo-build (popcnt enabled)..." + @$(PGOBENCH) > /dev/null + @echo "Benchmarks finished. Build final executable now ..." + @echo "" + @touch *.cpp *.h + $(MAKE) icc-profile-use-with-popcnt + @rm -rf profdir bench.txt + + osx-ppc32: $(MAKE) \ CXX='g++' \ @@ -157,6 +223,94 @@ osx-x86_64: CXXFLAGS+='-arch x86_64' \ LDFLAGS+='-arch x86_64' \ all + +osx-icc32: + $(MAKE) \ + CXX='icpc' \ + CXXFLAGS="$(ICCFLAGS-OSX)" \ + CXXFLAGS+='-arch i386' \ + LDFLAGS+='-arch i386' \ + all + +osx-icc64: + $(MAKE) \ + CXX='icpc' \ + CXXFLAGS="$(ICCFLAGS-OSX)" \ + CXXFLAGS+='-arch x86_64' \ + LDFLAGS+='-arch x86_64' \ + all + +osx-icc32-profile-make: + $(MAKE) \ + CXX='icpc' \ + CXXFLAGS="$(ICCFLAGS-OSX)" \ + CXXFLAGS+='-arch i386' \ + CXXFLAGS+='-prof_gen -prof_dir ./profdir' \ + LDFLAGS+='-arch i386' \ + all + +osx-icc32-profile-use: + $(MAKE) \ + CXX='icpc' \ + CXXFLAGS="$(ICCFLAGS-OSX)" \ + CXXFLAGS+='-arch i386' \ + CXXFLAGS+='-prof_use -prof_dir ./profdir' \ + LDFLAGS+='-arch i386' \ + all + +osx-icc32-profile: + @rm -rf profdir + @mkdir profdir + @touch *.cpp *.h + $(MAKE) osx-icc32-profile-make + @echo "" + @echo "Running benchmark for pgo-build ..." + @$(PGOBENCH) > /dev/null + @echo "Benchmark finished. Build final executable now ..." + @echo "" + @touch *.cpp *.h + $(MAKE) osx-icc32-profile-use + @rm -rf profdir bench.txt + +osx-icc64-profile-make: + $(MAKE) \ + CXX='icpc' \ + CXXFLAGS="$(ICCFLAGS-OSX)" \ + CXXFLAGS+='-arch x86_64' \ + CXXFLAGS+='-prof_gen -prof_dir ./profdir' \ + LDFLAGS+='-arch x86_64' \ + all + +osx-icc64-profile-use: + $(MAKE) \ + CXX='icpc' \ + CXXFLAGS="$(ICCFLAGS-OSX)" \ + CXXFLAGS+='-arch x86_64' \ + CXXFLAGS+='-prof_use -prof_dir ./profdir' \ + LDFLAGS+='-arch x86_64' \ + all + +osx-icc64-profile: + @rm -rf profdir + @mkdir profdir + @touch *.cpp *.h + $(MAKE) osx-icc64-profile-make + @echo "" + @echo "Running benchmark for pgo-build ..." + @$(PGOBENCH) > /dev/null + @echo "Benchmark finished. Build final executable now ..." + @echo "" + @touch *.cpp *.h + $(MAKE) osx-icc64-profile-use + @rm -rf profdir bench.txt + +hpux: + $(MAKE) \ + CXX='/opt/aCC/bin/aCC -AA +hpxstd98 -DBIGENDIAN -mt +O3 -DNDEBUG' \ + CXXFLAGS="" \ + LDFLAGS="" \ + all + strip: strip $(EXE) @@ -166,9 +320,14 @@ strip: $(EXE): $(OBJS) $(CXX) $(LDFLAGS) -o $@ $(OBJS) +### Installation +install: default + -mkdir -p -m 755 $(BINDIR) + -cp $(EXE) $(BINDIR) + -strip $(BINDIR)/$(EXE) ### Dependencies. Do not change .depend: - $(CXX) -msse -MM $(OBJS:.o=.cpp) > $@ + -@$(CXX) -msse -MM $(OBJS:.o=.cpp) > $@ 2> /dev/null -include .depend +-include .depend