-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
50 lines (37 loc) · 1.11 KB
/
Makefile
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
#
# Copyright (c) 2019, Aditya Rohan
# Copyright (c) 2019, Aniket Pandey
#
CC = g++
CSRC = $(wildcard *.c)
CPPSRC = $(wildcard *.cpp)
SRC-CA = $(wildcard cache/*.cpp)
# Relevant (self-explanatory) directories
CACHE = ./cache
INCLUDE = ./include
TRACES = ./traces
PART2 = ./part2
CFLAGS = -I$(INCLUDE)
_DEPS = cache.h cache-min.h
DEPS = $(patsubst %, $(INCLUDE)/%, $(_DEPS))
CXXFLAGS = -lstdc++fs -std=c++11 -Wall -Wextra
all: clean part1 part2
part1: process simulate
process: $(CSRC) $(TRACES) $(DEPS)
$(CC) -o $@ $<; ./$@
simulate: $(CPPSRC) $(SRC-CA) $(DEPS)
$(CC) -o $@ $^ $(CXXFLAGS) $(CFLAGS); ./$@
part2: check fa-lru fa-min
fa-lru: $(PART2)/fa-lru.cpp $(SRC-CA) $(DEPS)
$(CC) -o $@ $^ $(CXXFLAGS) $(CFLAGS); ./$@
fa-min: $(PART2)/fa-min.cpp $(SRC-CA) $(DEPS)
$(CC) -o $@ $^ $(CXXFLAGS) $(CFLAGS); ./$@
.PHONY: clean check
check: SHELL:=/bin/bash
check:
@echo Warning: Part-2 would take more than 8 hours on a normal \
machine. Continue? [Y/n]
@read line; if [ $$line == "n" ]; then echo TIP: Better to run \
build instructions individually; echo; exit 1 ; fi
clean:
rm -rf output simulate process fa-lru fa-min