-
Notifications
You must be signed in to change notification settings - Fork 4
/
makefile
58 lines (42 loc) · 1.21 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# engine name
EXE = Altair
SOURCES := src/evaluation.cpp src/main.cpp src/move.cpp src/perft.cpp src/position.cpp src/search.cpp \
src/useful.cpp src/uci.cpp src/bench.cpp src/see.cpp src/bitboard.cpp src/move_ordering.cpp \
src/datagen.cpp src/nnue.cpp src/timeman.cpp
CXXFLAGS := -O3 -std=c++20 -march=native -Wall -Wextra -pedantic -DNDEBUG -flto
CXX := clang++
SUFFIX :=
PGO := true
LLVM_PROF_CMD = llvm-profdata
ifeq ($(native),1)
CXXFLAGS += -march=native
ifeq (,$(shell where llvm-profdata))
override PGO := off
endif
endif
# Detect Windows
ifeq ($(OS), Windows_NT)
SUFFIX := .exe
CXXFLAGS += -static
CXXFLAGS += -fuse-ld=lld
else
DETECTED_OS := $(shell uname -s)
ifneq (,$(findstring clang,$(shell $(CXX) --version)))
ifneq ($(DETECTED_OS), Darwin)
CXXFLAGS += -fuse-ld=lld
ifeq (,$(shell which llvm-profdata))
override PGO := false
endif
else
LLVM_PROF_CMD = xcrun llvm-profdata
endif
else
override PGO := false
endif
CXXFLAGS += -pthread
endif
OUT := $(EXE)$(SUFFIX)
make:
$(CXX) $(CXXFLAGS) -o $(OUT) $(SOURCES)
clean:
rm -rf *.o