]> git.sesse.net Git - stockfish/blobdiff - src/Makefile
Added gcc lto (Link Time Optimization) option
[stockfish] / src / Makefile
index f126afac5c90cb50d162d408140f34f418494f65..0a56e263ee800442434b6baf1ea4a5ad295d8c67 100644 (file)
@@ -31,10 +31,9 @@ BINDIR = $(PREFIX)/bin
 PGOBENCH = ./$(EXE) bench 32 1 10 default depth
 
 ### Object files
-OBJS = bitboard.o pawns.o material.o endgame.o evaluate.o main.o \
-       misc.o movegen.o history.o movepick.o search.o position.o \
-       tt.o uci.o ucioption.o book.o bitbase.o san.o benchmark.o timeman.o
-
+OBJS = benchmark.o bitbase.o bitboard.o book.o endgame.o evaluate.o main.o \
+       material.o misc.o move.o movegen.o movepick.o pawns.o position.o \
+       search.o thread.o timeman.o tt.o uci.o ucioption.o
 
 ### ==========================================================================
 ### Section 2. High-level Configuration
@@ -53,6 +52,7 @@ OBJS = bitboard.o pawns.o material.o endgame.o evaluate.o main.o \
 # bsfq = no/yes       --- -DUSE_BSFQ  --- Use bsfq x86_64 asm-instruction
 #                                     --- (Works only with GCC and ICC 64-bit)
 # popcnt = no/yes     --- -DUSE_POPCNT --- Use popcnt x86_64 asm-instruction
+# lto = no/yes        --- -flto       --- gcc Link Time Optimization
 #
 # Note that Makefile is space sensitive, so when adding new architectures
 # or modifying existing flags, you have to make sure there are no extra spaces
@@ -124,6 +124,7 @@ ifeq ($(ARCH),x86-64-modern)
        prefetch = yes
        bsfq = yes
        popcnt = yes
+       lto = yes
 endif
 
 ifeq ($(ARCH),x86-32)
@@ -228,11 +229,11 @@ endif
 CXXFLAGS = -g -Wall -Wcast-qual -fno-exceptions -fno-rtti $(EXTRACXXFLAGS)
 
 ifeq ($(comp),gcc)
-       CXXFLAGS += -ansi -pedantic -Wno-long-long -Wextra
+       CXXFLAGS += -ansi -pedantic -Wno-long-long -Wextra -Wshadow
 endif
 
 ifeq ($(comp),mingw)
-       CXXFLAGS += -Wno-long-long -Wextra
+       CXXFLAGS += -Wextra -Wshadow
 endif
 
 ifeq ($(comp),icc)
@@ -312,13 +313,18 @@ ifeq ($(popcnt),yes)
        CXXFLAGS += -DUSE_POPCNT
 endif
 
+### 3.11 lto.
+### Note that this is a mix of compile and link time options
+### because the lto link phase needs access to the optimization flags
+ifeq ($(lto),yes)
+       CXXFLAGS += -flto
+       LDFLAGS += $(CXXFLAGS) -static
+endif
+
 ### ==========================================================================
 ### Section 4. Public targets
 ### ==========================================================================
 
-default:
-       $(MAKE) ARCH=$(ARCH) COMP=$(COMP) build
-
 help:
        @echo ""
        @echo "To compile stockfish, type: "
@@ -432,6 +438,9 @@ clean:
 testrun:
        @$(PGOBENCH)
 
+default:
+       help
+
 ### ==========================================================================
 ### Section 5. Private targets
 ### ==========================================================================