-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (29 loc) · 772 Bytes
/
Makefile
File metadata and controls
38 lines (29 loc) · 772 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++17 -Wall -w -O3 -Wsign-compare
# Directories
SRC_DIR = src/cpp
BIN_DIR = src/yacht
# Source files
SRC_FILES = $(SRC_DIR)/main.cpp
# Object files
OBJ_FILES = $(SRC_FILES:.cpp=.o)
# Target executable
TARGET = $(BIN_DIR)/run_yacht_train_core
# Default target
all: $(TARGET)
# Create the bin directory if it doesn't exist
$(BIN_DIR):
echo "Creating directory: $(BIN_DIR)"
mkdir -p $(BIN_DIR)
# build the object files
$(OBJ_FILES): %.o: %.cpp
echo "Compiling: $<"
$(CXX) $(CXXFLAGS) -c $< -o $@
# build the target executable
$(TARGET): $(OBJ_FILES) | $(BIN_DIR)
echo "Linking to create executable: $(TARGET)"
$(CXX) $(CXXFLAGS) $(OBJ_FILES) -o $(TARGET) -lpthread
# clean up
clean:
rm -f $(OBJ_FILES) $(TARGET)