]> git.sesse.net Git - stockfish/blobdiff - src/Makefile
Add "mingw" compiler to Makefile
[stockfish] / src / Makefile
index 8eef9a4c73f9beb4aa78e1f05c2c7977a27c7157..e8d882aa652e6dc7dae8458277850b88b075b9dd 100644 (file)
@@ -35,8 +35,8 @@ PGOBENCH = ./$(EXE) bench 32 1 10 default depth
 ### Object files
 OBJS = application.o bitboard.o pawns.o material.o endgame.o evaluate.o main.o \
        misc.o move.o movegen.o history.o movepick.o search.o piece.o \
-       position.o direction.o tt.o value.o uci.o ucioption.o \
-       mersenne.o book.o bitbase.o san.o benchmark.o
+       position.o direction.o tt.o uci.o ucioption.o \
+       mersenne.o book.o bitbase.o san.o benchmark.o timeman.o
 
 
 ### ==========================================================================
@@ -200,6 +200,15 @@ ifeq ($(COMP),)
        COMP=gcc
 endif
 
+ifeq ($(COMP),mingw)
+       comp=mingw
+       CXX=g++
+       profile_prepare = gcc-profile-prepare
+       profile_make = gcc-profile-make
+       profile_use = gcc-profile-use
+       profile_clean = gcc-profile-clean
+endif
+
 ifeq ($(COMP),gcc)
        comp=gcc
        CXX=g++
@@ -219,10 +228,18 @@ ifeq ($(COMP),icc)
 endif
 
 ### 3.2 General compiler settings
-CXXFLAGS += -g -Wall -fno-exceptions -fno-rtti $(EXTRACXXFLAGS)
+CXXFLAGS = -g -Wall -Wcast-qual -fno-exceptions -fno-rtti $(EXTRACXXFLAGS)
+
+ifeq ($(comp),gcc)
+       CXXFLAGS += -ansi -pedantic -Wno-long-long -Wextra
+endif
+
+ifeq ($(comp),mingw)
+       CXXFLAGS += -Wno-long-long -Wextra
+endif
 
 ifeq ($(comp),icc)
-       CXXFLAGS += -wd383,869,981,10187,10188,11505,11503
+       CXXFLAGS += -wd383,981,10187,10188,11505,11503 -Wcheck -Wabi -Wdeprecated -strict-ansi
 endif
 
 ifeq ($(os),osx)
@@ -230,7 +247,7 @@ ifeq ($(os),osx)
 endif
 
 ### 3.3 General linker settings
-LDFLAGS += -lpthread $(EXTRALDFLAGS)
+LDFLAGS = -lpthread $(EXTRALDFLAGS)
 
 ifeq ($(os),osx)
        LDFLAGS += -arch $(arch)
@@ -257,6 +274,10 @@ ifeq ($(optimize),yes)
                endif
        endif
 
+       ifeq ($(comp),mingw)
+               CXXFLAGS += -O3
+       endif
+
        ifeq ($(comp),icc)
                CXXFLAGS += -fast
 
@@ -336,6 +357,7 @@ help:
        @echo ""
        @echo "gcc                  > Gnu compiler (default)"
        @echo "icc                  > Intel compiler"
+       @echo "mingw                > Gnu compiler with MinGW under Windows"
        @echo ""
        @echo "Non-standard targets:"
        @echo ""
@@ -408,7 +430,7 @@ install:
        -strip $(BINDIR)/$(EXE)
 
 clean:
-       $(RM) $(EXE) *.o .depend *~ core bench.txt
+       $(RM) $(EXE) *.o .depend *~ core bench.txt *.gcda
 
 testrun:
        @$(PGOBENCH)
@@ -449,7 +471,7 @@ config-sanity:
        @test "$(prefetch)" = "yes" || test "$(prefetch)" = "no"
        @test "$(bsfq)" = "yes" || test "$(bsfq)" = "no"
        @test "$(popcnt)" = "yes" || test "$(popcnt)" = "no"
-       @test "$(comp)" = "gcc" || test "$(comp)" = "icc"
+       @test "$(comp)" = "gcc" || test "$(comp)" = "icc" || test "$(comp)" = "mingw"
 
 $(EXE): $(OBJS)
        $(CXX) -o $@ $(OBJS) $(LDFLAGS)
@@ -500,7 +522,7 @@ icc-profile-clean:
 
 hpux:
        $(MAKE) \
-       CXX='/opt/aCC/bin/aCC -AA +hpxstd98 -DBIGENDIAN -mt +O3 -DNDEBUG' \
+       CXX='/opt/aCC/bin/aCC -AA +hpxstd98 -DBIGENDIAN -mt +O3 -DNDEBUG -DNO_PREFETCH' \
        CXXFLAGS="" \
        LDFLAGS="" \
        all