-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
37 lines (26 loc) · 1.2 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
# Cross toolchain variables
# If these are not in your path, you can make them absolute.
XT_PRG_PREFIX = riscv32-unknown-linux-gnu-
CC = $(XT_PRG_PREFIX)gcc
LD = $(XT_PRG_PREFIX)ld
URISCV_DIR_PREFIX = /usr/local
URISCV_DATA_DIR = $(URISCV_DIR_PREFIX)/share/uriscv
URISCV_INCLUDE_DIR = $(URISCV_DIR_PREFIX)/include
# Compiler options
CFLAGS_LANG = -ffreestanding -static -nostartfiles -nostdlib -Werror -ansi
CFLAGS = $(CFLAGS_LANG) -I$(URISCV_INCLUDE_DIR) -ggdb -Wall -O0 -std=gnu99 -march=rv32imfd -mabi=ilp32d
# Linker options
LDFLAGS = -G 0 -nostdlib -T $(URISCV_DATA_DIR)/uriscvcore.ldscript
# Add the location of crt*.S to the search path
VPATH = $(URISCV_DATA_DIR)
.PHONY : all clean
all : kernel.core.uriscv
kernel.core.uriscv : kernel
uriscv-elf2uriscv -k $<
kernel : ./phase1/msg.o ./phase1/pcb.o ./phase2/initial.o ./phase2/ssi.o ./phase2/exceptions.o ./phase2/scheduler.o ./phase2/interrupts.o ./phase2/utils.o ./phase3/initProc.o ./phase3/vmSupport.o ./phase3/sysSupport.o ./phase3/sst.o crtso.o liburiscv.o
$(LD) -o $@ $^ $(LDFLAGS)
clean :
-rm -f *.o ./phase1/*.o ./phase2/*.o ./phase3/*.o kernel kernel.*.uriscv ./*uriscv
# Pattern rule for assembly modules
%.o : %.S
$(CC) $(CFLAGS) -c -o $@ $<