makefile fix
This commit is contained in:
1 parent
189f9d49c1
commit
74b6fa0b64
6 files changed
+33
-37
No files matched your search
@@ -1,16 +1,11 @@
|
||||
# Define the directories
|
||||
# Define directories
|
||||
SRC_DIR := source
|
||||
OBJ_DIR := obj
|
||||
|
||||
# Set default C++ compiler, but allow override from the command line
|
||||
CXX ?= g++
|
||||
|
||||
# Set default executable name, but allow override from the command line
|
||||
EXE ?= Eleanor
|
||||
EVALFILE := ./nnue.bin
|
||||
|
||||
EVALFILE = ./nnue.bin
|
||||
|
||||
# Determine platform
|
||||
ifeq ($(OS),Windows_NT)
|
||||
EXE_EXT := .exe
|
||||
MKDIR := mkdir
|
||||
@@ -25,29 +20,30 @@ endif
|
||||
|
||||
MAKEFLAGS += -j
|
||||
|
||||
# List of source files
|
||||
# Source and object files
|
||||
SRCS := $(wildcard $(SRC_DIR)/*.cpp)
|
||||
OBJS := $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(SRCS))
|
||||
|
||||
# Link the executable
|
||||
$(EXE)$(EXE_EXT): $(SRCS)
|
||||
$(CXX) $(CXXFLAGS) -DEVALFILE=\"$(EVALFILE)\" $(SRCS) ./external/fmt/format.cc -o $@ -O3 -lpthread -march=native -flto -ftree-vectorize
|
||||
# Final binary
|
||||
$(EXE)$(EXE_EXT): $(OBJS)
|
||||
$(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)
|
||||
$(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):
|
||||
$(MKDIR) $(OBJ_DIR)
|
||||
|
||||
# Clean up build artifacts
|
||||
# Clean up and rebuild
|
||||
.PHONY: clean
|
||||
clean:
|
||||
ifeq ($(OS),Windows_NT)
|
||||
@if exist $(OBJ_DIR) $(RM) $(OBJ_DIR)
|
||||
@if exist $(EXE)$(EXE_EXT) $(DEL) $(EXE)$(EXE_EXT)
|
||||
else
|
||||
@rm -rf $(OBJ_DIR)
|
||||
@rm -f $(EXE)$(EXE_EXT)
|
||||
@$(RM) $(OBJ_DIR)
|
||||
@$(DEL) $(EXE)$(EXE_EXT)
|
||||
endif
|
||||
$(MAKE)
|
||||
Reference in new issue
Block a user