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

44 lines
1.1 KiB

2 years ago
CC = $(TARGET)-gcc
LD = $(TARGET)-ld
AS = $(TARGET)-gcc
2 years ago
OBJCOPY = $(TARGET)-objcopy
2 years ago
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}
2 years ago
LDFLAGS = -m elf64lriscv --gc-sections -nostdlib -T rv64-sifive_u.ld
2 years ago
ASFLAGS = ${CFLAGS}
.SUFFIXES: .c .o .S
.c.o:
${CC} ${CFLAGS} -o $@ -c $<
.S.o:
${AS} ${ASFLAGS} -o $@ -c $<
2 years ago
.PHONY: all test clean
all: kernel.elf kernel.sym
2 years ago
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
2 years ago
kernel.sym: kernel.elf
${OBJCOPY} --only-keep-debug kernel.elf kernel.sym
2 years ago
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