-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (37 loc) · 1.05 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
INC = -Iinclude
LIB = -lpthread
SRC = src
OBJ = obj
INCLUDE = include
CC = gcc
DEBUG = -g
CFLAGS = -Wall -c $(DEBUG)
LFLAGS = -Wall $(DEBUG)
vpath %.c $(SRC)
vpath %.h $(INCLUDE)
MAKE = $(CC) $(INC)
# Object files needed by modules
MEM_OBJ = $(addprefix $(OBJ)/, paging.o mem.o cpu.o loader.o)
TLB_OBJ = $(addprefix $(OBJ)/, cpu-tlb.o cpu-tlbcache.o)
OS_OBJ = $(addprefix $(OBJ)/, cpu.o cpu-tlb.o cpu-tlbcache.o mem.o loader.o queue.o os.o sched.o timer.o mm-vm.o mm.o mm-memphy.o)
SCHED_OBJ = $(addprefix $(OBJ)/, cpu.o loader.o)
HEADER = $(wildcard $(INCLUDE)/*.h)
all: os
#mem sched os
# Just compile memory management modules
mem: $(MEM_OBJ) $(TLB_OBJ)
$(MAKE) $(LFLAGS) $(MEM_OBJ) $(TLB_OBJ) -o mem $(LIB)
# Just compile scheduler
sched: $(SCHED_OBJ)
$(MAKE) $(LFLAGS) $(MEM_OBJ) -o sched $(LIB)
# Compile the whole OS simulation
os: $(OS_OBJ)
$(MAKE) $(LFLAGS) $(OS_OBJ) -o os $(LIB)
$(OBJ)/%.o: %.c ${HEADER} $(OBJ)
$(MAKE) $(CFLAGS) $< -o $@
# Prepare objectives container
$(OBJ):
mkdir -p $(OBJ)
clean:
rm -f $(OBJ)/*.o os sched mem
rm -r $(OBJ)