You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
967 B
40 lines
967 B
2 years ago
|
CC = $(TARGET)-gcc
|
||
|
LD = $(TARGET)-ld
|
||
|
AS = $(TARGET)-gcc
|
||
|
|
||
|
KERN_WARNINGS = -Wall -Wextra -Wpedantic -Wuninitialized -Wunused-result
|
||
|
KERN_FLAGS = -ffreestanding -nostartfiles -nostdlib -nodefaultlibs --std=gnu2x
|
||
|
MACHINE_FLAGS = -march=rv64gc -mabi=lp64 -mcmodel=medany
|
||
|
PATH_FLAGS = -I./
|
||
|
|
||
|
CFLAGS = ${MACHINE_FLAGS} -g -O0 ${KERN_WARNINGS} ${KERN_FLAGS} ${PATH_FLAGS}
|
||
|
LDFLAGS = -m elf64lriscv --gc-sections -T rv64-sifive_u.ld
|
||
|
ASFLAGS = ${CFLAGS}
|
||
|
|
||
|
.SUFFIXES: .c .o .S
|
||
|
|
||
|
.c.o:
|
||
|
${CC} ${CFLAGS} -o $@ -c $<
|
||
|
|
||
|
.S.o:
|
||
|
${AS} ${ASFLAGS} -o $@ -c $<
|
||
|
|
||
|
kernel.elf: kernel.o crt0.o platform/FU740/uart.o platform/FU740/clock.o
|
||
|
${LD} ${LDFLAGS} -o kernel.elf kernel.o crt0.o platform/FU740/uart.o platform/FU740/clock.o
|
||
|
|
||
|
kernel.o: kernel.c
|
||
|
|
||
|
platform/FU740/uart.o: platform/FU740/uart.c
|
||
|
|
||
|
platform/FU740/clock.o: platform/FU740/clock.c
|
||
|
|
||
|
crt0.o: crt0.S
|
||
|
|
||
|
.PHONY: all test clean
|
||
|
all: kernel.img
|
||
|
|
||
|
test:
|
||
|
|
||
|
clean:
|
||
|
rm -f kernel.elf kernel.o crt0.o platform/FU740/uart.o platform/FU740/clock.o
|