-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (37 loc) · 1.05 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
## Makefile
PROJECT_NAME = $(shell basename "$(realpath ./)")
## CXX = clang
CXX = gcc
CXXFLAGS = -std=c2x
CXXFLAGS += -Wall -g -O3 -ffast-math
CXXFLAGS += -mpopcnt -march=native -mtune=native
CXXFLAGS += -Wno-format
OS = $(shell uname -s)
ifeq ($(OS), Darwin)
LDFLAGS = -Xpreprocessor -fopenmp -lomp
else
LDFLAGS = -fopenmp
endif
SRCS = src/*.c
INCLUDES = -I./src/*.h
TARGET = bin/release/$(PROJECT_NAME)
LIBS = -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer -lm
NNUE_SRCS = src/nnue/*.c
NNUE_INCLUDES = -I./src/nnue/*.h
SRCS += $(NNUE_SRCS)
INCLUDES += $(NNUE_INCLUDES)
all:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SRCS) $(LDFLAGS) $(LIBS) -o $(TARGET)
cp $(TARGET) ./lichess-bot/engines
run: all
./$(TARGET)
sanitize:
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SRCS) $(LDFLAGS) $(LIBS) -fsanitize=address -o $(TARGET)
./$(TARGET)
profile:
## $(CXX) $(CXXFLAGS) $(INCLUDES) $(SRCS) $(LDFLAGS) $(LIBS) -pg -o $(TARGET)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SRCS) $(LDFLAGS) $(LIBS) -o $(TARGET)
sudo perf record ./$(TARGET)
sudo perf report
clean:
rm -f ./bin./release/*