makefile fix

This commit is contained in:
rektdie committed 2025-04-10 03:32:02 +02:00
1 parent 189f9d49c1
commit 74b6fa0b64
6 files changed
+33 -37

No files matched your search

+12 -16
View File
@@ -1,16 +1,11 @@
# Define the directories # Define directories
SRC_DIR := source SRC_DIR := source
OBJ_DIR := obj OBJ_DIR := obj
# Set default C++ compiler, but allow override from the command line
CXX ?= g++ CXX ?= g++
# Set default executable name, but allow override from the command line
EXE ?= Eleanor EXE ?= Eleanor
EVALFILE := ./nnue.bin
EVALFILE = ./nnue.bin
# Determine platform
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
EXE_EXT := .exe EXE_EXT := .exe
MKDIR := mkdir MKDIR := mkdir
@@ -25,29 +20,30 @@ endif
MAKEFLAGS += -j MAKEFLAGS += -j
# List of source files # Source and object files
SRCS := $(wildcard $(SRC_DIR)/*.cpp) SRCS := $(wildcard $(SRC_DIR)/*.cpp)
OBJS := $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(SRCS))
# Link the executable # Final binary
$(EXE)$(EXE_EXT): $(SRCS) $(EXE)$(EXE_EXT): $(OBJS)
$(CXX) $(CXXFLAGS) -DEVALFILE=\"$(EVALFILE)\" $(SRCS) ./external/fmt/format.cc -o $@ -O3 -lpthread -march=native -flto -ftree-vectorize $(CXX) $(CXXFLAGS) -DEVALFILE=\"$(EVALFILE)\" $^ ./external/fmt/format.cc -o $@ -O3 -lpthread -march=native -flto -ftree-vectorize
# Rule to compile source files to object files # Compile .cpp -> .o
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR) $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR)
$(CXX) -std=c++23 -c -o $@ $< -O3 -lpthread -march=native -flto -ftree-vectorize $(CXX) -std=c++23 -c -o $@ $< -O3 -lpthread -march=native -flto -ftree-vectorize
# Create the object directory if it doesn't exist # Create object directory
$(OBJ_DIR): $(OBJ_DIR):
$(MKDIR) $(OBJ_DIR) $(MKDIR) $(OBJ_DIR)
# Clean up build artifacts # Clean up and rebuild
.PHONY: clean .PHONY: clean
clean: clean:
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
@if exist $(OBJ_DIR) $(RM) $(OBJ_DIR) @if exist $(OBJ_DIR) $(RM) $(OBJ_DIR)
@if exist $(EXE)$(EXE_EXT) $(DEL) $(EXE)$(EXE_EXT) @if exist $(EXE)$(EXE_EXT) $(DEL) $(EXE)$(EXE_EXT)
else else
@rm -rf $(OBJ_DIR) @$(RM) $(OBJ_DIR)
@rm -f $(EXE)$(EXE_EXT) @$(DEL) $(EXE)$(EXE_EXT)
endif endif
$(MAKE) $(MAKE)
+2 -2
View File
@@ -10,8 +10,8 @@ constexpr int noEPTarget = -1;
constexpr int MAX_MOVES = 218; constexpr int MAX_MOVES = 218;
thread_local inline int positionIndex = 0; inline int positionIndex = 0;
thread_local inline U64 positionHistory[1000]; inline U64 positionHistory[1000];
class Board { class Board {
public: public:
+7 -7
View File
@@ -10,16 +10,16 @@
namespace SEARCH { namespace SEARCH {
thread_local U64 nodes = 0; U64 nodes = 0;
thread_local U64 nodesToGo = 0; U64 nodesToGo = 0;
thread_local bool benchStarted = false; bool benchStarted = false;
thread_local static inline int timeToSearch = 0; static inline int timeToSearch = 0;
thread_local static inline bool doingNullMove = false; static inline bool doingNullMove = false;
thread_local inline PVLine pvLine; inline PVLine pvLine;
thread_local Stopwatch sw; Stopwatch sw;
void InitLMRTable() { void InitLMRTable() {
for (int depth = 0; depth <= MAX_DEPTH; depth++) { for (int depth = 0; depth <= MAX_DEPTH; depth++) {
+5 -5
View File
@@ -19,15 +19,15 @@ constexpr int MAX_DEPTH = 64;
constexpr int MAX_PLY = 128; constexpr int MAX_PLY = 128;
constexpr int MAX_HISTORY = 16384; constexpr int MAX_HISTORY = 16384;
thread_local extern U64 nodes; extern U64 nodes;
thread_local extern bool benchStarted; extern bool benchStarted;
constexpr int inf = 100000; constexpr int inf = 100000;
thread_local inline bool searchStopped = false; inline bool searchStopped = false;
// [id][ply] // [id][ply]
thread_local inline int killerMoves[2][MAX_PLY]; inline int killerMoves[2][MAX_PLY];
inline int lmrTable[MAX_DEPTH+1][MAX_MOVES]; inline int lmrTable[MAX_DEPTH+1][MAX_MOVES];
@@ -75,7 +75,7 @@ public:
} }
}; };
thread_local inline History history; inline History history;
class PVLine { class PVLine {
private: private:
+5 -5
View File
@@ -3,20 +3,20 @@
class Stopwatch { class Stopwatch {
private: private:
std::chrono::high_resolution_clock::time_point start = std::chrono::steady_clock::time_point start =
std::chrono::high_resolution_clock::now(); std::chrono::steady_clock::now();
public: public:
void Restart() { void Restart() {
start = std::chrono::high_resolution_clock::now(); start = std::chrono::steady_clock::now();
} }
int GetElapsedMS() { int GetElapsedMS() {
auto current = std::chrono::high_resolution_clock::now(); auto current = std::chrono::steady_clock::now();
return std::chrono::duration_cast<std::chrono::milliseconds>(current - start).count(); return std::chrono::duration_cast<std::chrono::milliseconds>(current - start).count();
} }
double GetElapsedSec() { double GetElapsedSec() {
auto current = std::chrono::high_resolution_clock::now(); auto current = std::chrono::steady_clock::now();
return std::chrono::duration_cast< return std::chrono::duration_cast<
std::chrono::duration<double>>(current - start).count(); std::chrono::duration<double>>(current - start).count();
} }
+2 -2
View File
@@ -21,7 +21,7 @@ constexpr U64 maxHash = (64* 1000000) / sizeof(TTEntry);
// 5 MB // 5 MB
constexpr U64 defaultHash = (5 * 1000000) / sizeof(TTEntry); constexpr U64 defaultHash = (5 * 1000000) / sizeof(TTEntry);
thread_local inline U64 hashSize = defaultHash; inline U64 hashSize = defaultHash;
constexpr int invalidEntry = 111111; constexpr int invalidEntry = 111111;
@@ -61,4 +61,4 @@ public:
void WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move besteMove); void WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move besteMove);
}; };
thread_local inline TTable TT; inline TTable TT;