-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (39 loc) · 1 KB
/
Makefile
File metadata and controls
49 lines (39 loc) · 1 KB
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
48
49
# Define compiler and flags
CXX = g++
CXXFLAGS = -std=c++17 -Wall -Icore/include
LDFLAGS =
# Directory variables
SRC_DIR = core/src
OBJ_DIR = obj
BIN_DIR = bin
# List of source files
SRC = $(wildcard $(SRC_DIR)/*.cxx)
# Corresponding object files
OBJ = $(patsubst $(SRC_DIR)/%.cxx,$(OBJ_DIR)/%.o,$(SRC))
# Target executable
TARGET = $(BIN_DIR)/virtual_assistant
# Default target
all: $(TARGET) print
# Link the object files to create the main executable
$(TARGET): $(OBJ)
@mkdir -p $(BIN_DIR)
$(CXX) $(LDFLAGS) -o $@ $^
# Compile the source files into object files
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cxx
@mkdir -p $(OBJ_DIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean up build artifacts
clean:
rm -rf $(OBJ_DIR) $(BIN_DIR)
# auto run after build
auto:
make clean all
./$(TARGET)
# Reset the log files
reset:
@echo "Resetting log files..."
@rm -f log/engine_log.txt log/default_log.txt
@touch log/engine_log.txt log/default_log.txt
@echo "Log files have been reset."
# Phony targets
.PHONY: all clean print auto reset