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

38 lines
602 B
Makefile
Raw Normal View History

2022-01-13 01:38:45 -05:00
all: run
CCPREFIX = ../../vendor/cross/bin/riscv64-elf-
AS = $(CCPREFIX)as
CC = $(CCPREFIX)gcc
QEMU = qemu-system-riscv64
2022-01-13 02:11:20 -05:00
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 $@