]> git.sesse.net Git - stockfish/blobdiff - src/Makefile
Add popcnt-support in Makefile
[stockfish] / src / Makefile
index 7ca0495e3f4c76495503b96db16020e45b669179..b975522704447da17b150b694c92d9ad7333a2e5 100644 (file)
@@ -26,8 +26,9 @@ EXE = stockfish
 ### Compiler speed switches for both GCC and ICC. These settings are generally
 ### fast on a broad range of systems, but may be changed experimentally
 ### ==========================================================================
-GCCFLAGS = -O3
-ICCFLAGS = -fast
+GCCFLAGS = -O3 -msse
+ICCFLAGS = -fast -msse
+ICCFLAGS-OSX = -fast -mdynamic-no-pic
 
 
 ### ==========================================================================
@@ -35,6 +36,15 @@ ICCFLAGS = -fast
 ### ==========================================================================
 GCCFLAGS += -DNDEBUG
 ICCFLAGS += -DNDEBUG
+ICCFLAGS-OSX += -DNDEBUG
+
+
+### ==========================================================================
+### Enable/disable compile for a big-endian CPU, disabled by default
+### ==========================================================================
+GCCFLAGS += -DNBIGENDIAN
+ICCFLAGS += -DNBIGENDIAN
+ICCFLAGS-OSX += -DNBIGENDIAN
 
 
 ### ==========================================================================
@@ -45,8 +55,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
@@ -71,10 +82,15 @@ help:
        @echo "make                >  Default: Compiler = g++"
        @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 strip          >  Strip executable"
        @echo "make clean          >  Clean up"
        @echo ""
@@ -126,6 +142,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 +207,88 @@ 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
+
+
 
 strip:
        strip $(EXE)
@@ -169,6 +301,6 @@ $(EXE): $(OBJS)
 
 ### Dependencies. Do not change
 .depend:
-       $(CXX) -MM $(OBJS:.o=.cpp) > $@
+       $(CXX) -msse -MM $(OBJS:.o=.cpp) > $@
 
 include .depend