Skip to content

Commit aa08fd3

Browse files
authored
Update Makefile
1 parent 49cf63a commit aa08fd3

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

Makefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ CXXFLAGS ?= -std=c++17 -Wall -Wextra
66
OPTFLAGS ?= -O3
77
ifeq ($(LTO), yes)
88
OPTFLAGS += -flto
9+
ifeq ($(findstring clang++,$(CXX)),clang++)
10+
LDFLAGS += -fuse-ld=lld
11+
endif
912
endif
1013
ifeq ($(debug),no)
1114
CXXFLAGS += -DNDEBUG
@@ -31,9 +34,23 @@ deps:
3134
test -d deps/chesslib || git clone https://github.com/winapiadmin/chesslib deps/chesslib
3235
test -d deps/tbprobe || git clone https://github.com/winapiadmin/tb_probing_tool deps/tbprobe
3336
# Tuning is not required on Makefile, use CMake.
34-
SRCS = $(filter-out tune_cmd.cpp, $(wildcard *.cpp)) $(wildcard deps/chesslib/*.cpp) $(wildcard deps/tbprobe/*.cpp)
37+
CHESSLIB_SRCS := $(filter-out %tests.cpp,$(wildcard deps/chesslib/*.cpp))
38+
SRCS := \
39+
$(filter-out tune_cmd.cpp,$(wildcard *.cpp)) \
40+
$(CHESSLIB_SRCS) \
41+
deps/tbprobe/syzygy/tbprobe.cpp
3542
OBJS = $(SRCS:.cpp=.o)
43+
SHA := $(shell git rev-parse --short HEAD 2>/dev/null)
44+
TAG := $(shell git describe --tags --exact-match 2>/dev/null)
45+
ifeq ($(debug),yes)
46+
BUILD_VERSION := debug-$(SHA)
47+
else ifneq ($(TAG),)
48+
BUILD_VERSION := $(TAG)
49+
else
50+
BUILD_VERSION := release-$(SHA)
51+
endif
3652

53+
CXXFLAGS += -DBUILD_VERSION=\"$(BUILD_VERSION)\"
3754
.PHONY: all clean deps
3855
all: deps $(TARGET)
3956

0 commit comments

Comments
 (0)