1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2024-10-30 11:54:01 -04:00
libkernaux/examples/arch-riscv64-min/Makefile

37 lines
602 B
Makefile

all: run
CCPREFIX = ../../vendor/cross/bin/riscv64-elf-
AS = $(CCPREFIX)as
CC = $(CCPREFIX)gcc
QEMU = qemu-system-riscv64
KERNEL = kernel.elf
LINKERSCR = linker.ld
CFLAGS = \
-std=c99 \
-pedantic \
-Wall \
-Wextra \
-Werror \
-ffreestanding \
-mcmodel=medany
OBJS = main.c.o start.S.o
run: $(KERNEL)
$(QEMU) -machine virt -bios $< -serial stdio -display none
clean:
rm -f $(KERNEL) $(OBJS)
$(KERNEL): $(LINKERSCR) $(OBJS)
$(CC) -T $(LINKERSCR) -o $@ $(OBJS) -nostdlib -lgcc
%.c.o: %.c
$(CC) -c $< -o $@ $(CFLAGS)
%.S.o: %.S
$(AS) $< -o $@