endif
BINDIR = $(PREFIX)/bin
-### Built-in benchmark for pgo-builds
+### Built-in benchmark for pgo-builds and signature
PGOBENCH = ./$(EXE) bench 32 1 10 default depth
+SIGNBENCH = ./$(EXE) bench
### Object files
OBJS = benchmark.o bitbase.o bitboard.o book.o endgame.o evaluate.o main.o \
endif
### 3.2 General compiler settings
-CXXFLAGS = -g -Wall -Wcast-qual -fno-exceptions -fno-rtti $(EXTRACXXFLAGS)
+CXXFLAGS = -Wall -Wcast-qual -fno-exceptions -fno-rtti $(EXTRACXXFLAGS)
ifeq ($(comp),gcc)
CXXFLAGS += -ansi -pedantic -Wno-long-long -Wextra -Wshadow
### 3.3 General linker settings
LDFLAGS = $(EXTRALDFLAGS)
+ifeq ($(comp),mingw)
+ LDFLAGS += -static-libstdc++ -static-libgcc
+endif
+
### On mingw use Windows threads, otherwise POSIX
ifneq ($(comp),mingw)
# Haiku has pthreads in its libroot, so only link it in on other platforms
### 3.4 Debugging
ifeq ($(debug),no)
CXXFLAGS += -DNDEBUG
+else
+ CXXFLAGS += -g
endif
### 3.5 Optimization
### needs access to the optimization flags.
ifeq ($(comp),gcc)
ifeq ($(optimize),yes)
+ ifeq ($(debug),no)
GCC_MAJOR := `$(CXX) -dumpversion | cut -f1 -d.`
GCC_MINOR := `$(CXX) -dumpversion | cut -f2 -d.`
ifeq (1,$(shell expr \( $(GCC_MAJOR) \> 4 \) \| \( $(GCC_MAJOR) \= 4 \& $(GCC_MINOR) \>= 5 \)))
LDFLAGS += $(CXXFLAGS)
endif
endif
+ endif
endif
### ==========================================================================
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) config-sanity
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) all
+signature-build:
+ $(MAKE) ARCH=$(ARCH) COMP=$(COMP) config-sanity
+ $(MAKE) ARCH=$(ARCH) COMP=$(COMP) all
+ @echo "Running benchmark for getting the signature ..."
+ @$(SIGNBENCH) 2>&1 | grep 'Nodes searched' | grep -o ": .*" | tr -d ': ' > sign.txt
+ @sed -i -e 's,^,/static const string Tag/s/"\\(.*\\)"/",1' -e 's,$$,"/1,1' sign.txt
+ @sed -i -f sign.txt misc.cpp
+ @rm sign.txt
+ $(MAKE) ARCH=$(ARCH) COMP=$(COMP) all
+
profile-build:
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) config-sanity
@echo ""