-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
48 lines (34 loc) · 841 Bytes
/
Copy pathmakefile
File metadata and controls
48 lines (34 loc) · 841 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
39
40
41
42
43
44
45
46
47
48
# Compiler
CXX = clang++
# Compiler flags
CXXFLAGS = -std=c++19 -Wall -Wextra
# Executable name
TARGET = main
# Source files
SRCS = \
main.cpp \
# Object files (replace .cpp by .o)
OBJS = $(SRCS:.cpp=.o)
# --------------------------------------------
# Default target
# --------------------------------------------
all: $(TARGET)
# Link object files into the executable
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) -o $(TARGET)
# Compile source files into object files
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
# --------------------------------------------
# Utility targets
# --------------------------------------------
# Remove compiled files
clean:
rm -f $(OBJS) $(TARGET)
# Rebuild from scratch
rebuild: clean all
# Run the program
run: $(TARGET)
./$(TARGET)
test: tests.cpp
echo "==========[TEST MODE]=========="