-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (26 loc) · 810 Bytes
/
Makefile
File metadata and controls
34 lines (26 loc) · 810 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
# Directory definitions
BUILD_DIR = bin/
VPATH = $(shell find src -type d)
# File definitions
SRC_FILES = $(shell find src -name *.cc -printf "%f ")
OBJ_FILES = $(addprefix $(BUILD_DIR), $(SRC_FILES:.cc=.o))
BIN_FILE = simulate_cache
CONFIGS_FILE = configs.txt
RESULTS_FILE = results.csv
# Compiler flag definition
override CPPFLAGS += -Wall -std=c++20 -g $(addprefix -I, $(VPATH))
# Incremental build
all: $(BIN_FILE)
$(BIN_FILE): $(OBJ_FILES)
$(CXX) -o $(BIN_FILE) $(OBJ_FILES) -lm
$(BUILD_DIR)%.o: %.cc
@mkdir -p $(BUILD_DIR)
$(CXX) -c $(CPPFLAGS) -o $@ $<
# Build from scratch
rebuild: clean all
# Incremental build & process trace file
%.bin: $(BIN_FILE)
./$(BIN_FILE) $(CONFIGS_FILE) $@ > $(RESULTS_FILE)
# Remove build and run results
clean:
rm -fr $(BUILD_DIR) $(BIN_FILE) $(RESULTS_FILE)