forked from bigya01/chess_rl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (28 loc) · 709 Bytes
/
Makefile
File metadata and controls
38 lines (28 loc) · 709 Bytes
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
# Compiler and flags
CXX = g++
CXXFLAGS = -std=c++20 -Wall -Wextra -Iinclude
# Directories
SRC_DIR = src
OBJ_DIR = obj
BIN_DIR = bin
# SFML
SFML_LIBS = -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio
# Files
SOURCES := $(shell find $(SRC_DIR) -name "*.cpp")
SOURCES += main.cpp
OBJECTS := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SOURCES))
EXECUTABLE = $(BIN_DIR)/chess
# Build rule
$(EXECUTABLE): $(OBJECTS)
$(CXX) $(CXXFLAGS) -o $@ $^ $(SFML_LIBS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Phony targets
.PHONY: all clean
all: $(EXECUTABLE)
clean:
rm -rf $(OBJ_DIR)/ $(BIN_DIR)/
run:
./$(EXECUTABLE)
$(shell mkdir -p $(OBJ_DIR) $(BIN_DIR))