-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (39 loc) · 1.82 KB
/
Copy pathMakefile
File metadata and controls
55 lines (39 loc) · 1.82 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
50
51
52
53
54
55
CXX = g++
CXXFLAGS = -Wall -std=c++17
INCLUDES = -Isrc
# Directories
SRCDIR = src
OBJDIR = obj
BINDIR = bin
# Source files and object files explicitly listed
SRCS = $(SRCDIR)/main.cpp $(SRCDIR)/Tree.cpp $(SRCDIR)/ConcreteTrees.cpp $(SRCDIR)/TreeFactory.cpp $(SRCDIR)/ForestManager.cpp $(SRCDIR)/SimpleForest.cpp $(SRCDIR)/MemoryTracker.cpp
OBJS = $(OBJDIR)/main.o $(OBJDIR)/Tree.o $(OBJDIR)/ConcreteTrees.o $(OBJDIR)/TreeFactory.o $(OBJDIR)/ForestManager.o $(OBJDIR)/SimpleForest.o $(OBJDIR)/MemoryTracker.o
# Target executable
TARGET = $(BINDIR)/forest_sim
# Phony targets for all, clean, and directories
.PHONY: all clean directories
all: directories $(TARGET)
directories:
@mkdir -p $(OBJDIR)
@mkdir -p $(BINDIR)
# Linking the target executable
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) -o $(TARGET) $(OBJS)
# Compiling source files into object files
$(OBJDIR)/main.o: $(SRCDIR)/main.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $(SRCDIR)/main.cpp -o $(OBJDIR)/main.o
$(OBJDIR)/Tree.o: $(SRCDIR)/Tree.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $(SRCDIR)/Tree.cpp -o $(OBJDIR)/Tree.o
$(OBJDIR)/ConcreteTrees.o: $(SRCDIR)/ConcreteTrees.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $(SRCDIR)/ConcreteTrees.cpp -o $(OBJDIR)/ConcreteTrees.o
$(OBJDIR)/TreeFactory.o: $(SRCDIR)/TreeFactory.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $(SRCDIR)/TreeFactory.cpp -o $(OBJDIR)/TreeFactory.o
$(OBJDIR)/ForestManager.o: $(SRCDIR)/ForestManager.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $(SRCDIR)/ForestManager.cpp -o $(OBJDIR)/ForestManager.o
$(OBJDIR)/SimpleForest.o: $(SRCDIR)/SimpleForest.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $(SRCDIR)/SimpleForest.cpp -o $(OBJDIR)/SimpleForest.o
$(OBJDIR)/MemoryTracker.o: $(SRCDIR)/MemoryTracker.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $(SRCDIR)/MemoryTracker.cpp -o $(OBJDIR)/MemoryTracker.o
# Cleaning up
clean:
@rm -rf $(OBJDIR) $(BINDIR)