mirror of
https://github.com/tailix/libkernaux.git
synced 2024-11-13 11:04:27 -05:00
37 lines
602 B
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 $@
|