This repository has been archived by the owner on Dec 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
46 lines (34 loc) · 1.43 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
# Cross toolchain variables
# If these are not in your path, you can make them absolute.
XT_PRG_PREFIX = mipsel-linux-gnu-
CC = $(XT_PRG_PREFIX)gcc
LD = $(XT_PRG_PREFIX)ld
# uMPS3-related paths
# Simplistic search for the umps3 installation prefix.
# If you have umps3 installed on some weird location, set UMPS3_DIR_PREFIX by hand.
ifneq ($(wildcard /usr/bin/umps3),)
UMPS3_DIR_PREFIX = /usr
else
UMPS3_DIR_PREFIX = /usr/local
endif
UMPS3_DATA_DIR = $(UMPS3_DIR_PREFIX)/share/umps3
UMPS3_INCLUDE_DIR = $(UMPS3_DIR_PREFIX)/include/umps3
# Compiler options
CFLAGS_LANG = -ffreestanding -ansi
CFLAGS_MIPS = -mips1 -mabi=32 -mno-gpopt -EL -G 0 -mno-abicalls -fno-pic -mfp32
CFLAGS = $(CFLAGS_LANG) $(CFLAGS_MIPS) -I$(UMPS3_INCLUDE_DIR) -std=gnu99 -Wall -O0
# Linker options
LDFLAGS = -G 0 -nostdlib -T $(UMPS3_DATA_DIR)/umpscore.ldscript -m elf32ltsmip
# Add the location of crt*.S to the search path
VPATH = $(UMPS3_DATA_DIR)
.PHONY : all clean
all : kernel.core.umps
kernel.core.umps : kernel
umps3-elf2umps -k $<
kernel : phase1/asl.o phase1/pcb.o phase2/exceptionHandler.o phase2/handlerFunction.o phase2/syscall.o phase2/scheduler.o phase2/klog.o phase3/p3test.o phase3/supSyscall.o phase3/supVM.o phase3/TLBhandler.o crtso.o libumps.o phase2/initial.o
$(LD) -o $@ $^ $(LDFLAGS)
clean :
-rm -f *.o ./phase1/*.o ./phase2/*.o ./phase3/*.o kernel kernel.*.umps *.umps
# Pattern rule for assembly modules
%.o : %.S
$(CC) $(CFLAGS) -c -o $@ $<