-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (29 loc) · 746 Bytes
/
Makefile
File metadata and controls
42 lines (29 loc) · 746 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
# Makefile for cache simulator
CXX := g++
CXXFLAGS := -std=c++20 -Wall -Wextra -I./h -I. -MMD -MP
LDFLAGS :=
TARGET := cacheSimulator.exe
SRCDIR := src
OBJDIR := obj
TESTDIR := tests
SOURCES := $(SRCDIR)/main.cpp \
$(SRCDIR)/Cache.cpp \
$(SRCDIR)/MainMemory.cpp \
$(SRCDIR)/Processor.cpp \
$(SRCDIR)/ReplacementAlgorithms.cpp
OBJECTS := $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SOURCES))
DEPS := $(OBJECTS:.o=.d)
all: $(TARGET)
$(OBJDIR):
mkdir -p $(OBJDIR)
$(TARGET): $(OBJDIR) $(OBJECTS)
$(CXX) $(OBJECTS) -o $(TARGET) $(LDFLAGS)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
clean:
rm -rf $(OBJDIR) $(TARGET)
run: $(TARGET)
./$(TARGET)
rr: clean run
-include $(DEPS)
.PHONY: all clean run rr