-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (35 loc) · 900 Bytes
/
Makefile
File metadata and controls
46 lines (35 loc) · 900 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
# Cross-platform Makefile for Smart Memory Manager (Browser Tabs)
# Compiler
CC = gcc
# Flags
CFLAGS = -Wall -Iinclude
# Source files
SRC = src/main.c src/fifo.c src/lru.c src/optimal.c src/utils.c
OBJ = $(SRC:.c=.o)
# Executable name (different for Windows vs Linux)
ifeq ($(OS),Windows_NT)
TARGET = memory_manager.exe
RM = del /Q
FIXPATH = $(subst /,\,$1)
else
TARGET = memory_manager
RM = rm -f
FIXPATH = $1
endif
# Default build
all: $(TARGET)
$(TARGET): $(OBJ)
$(CC) $(CFLAGS) -o $(TARGET) $(OBJ)
# Run target
run: $(TARGET)
$(TARGET)
# Redirect outputs to results folder
fifo: $(TARGET)
$(TARGET) < data/ref_string1.txt > results/fifo_output.txt
lru: $(TARGET)
$(TARGET) < data/ref_string1.txt > results/lru_output.txt
optimal: $(TARGET)
$(TARGET) < data/ref_string1.txt > results/optimal_output.txt
# Clean build artifacts
clean:
$(RM) $(call FIXPATH,src/*.o) $(TARGET)