RISC-V operating system
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.
 
 
 
 
rovo/kernel/Makefile

43 lines
1.1 KiB

CC = $(TARGET)-gcc
LD = $(TARGET)-ld
AS = $(TARGET)-gcc
OBJCOPY = $(TARGET)-objcopy
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 -nostdlib -T rv64-sifive_u.ld
ASFLAGS = ${CFLAGS}
.SUFFIXES: .c .o .S
.c.o:
${CC} ${CFLAGS} -o $@ -c $<
.S.o:
${AS} ${ASFLAGS} -o $@ -c $<
.PHONY: all test clean
all: kernel.elf kernel.sym
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.sym: kernel.elf
${OBJCOPY} --only-keep-debug kernel.elf kernel.sym
kernel.o: kernel.c
platform/FU740/uart.o: platform/FU740/uart.c
platform/FU740/clock.o: platform/FU740/clock.c
crt0.o: crt0.S
test:
clean:
rm -f kernel.elf kernel.o crt0.o platform/FU740/uart.o platform/FU740/clock.o