PREFIX := riscv64-unknown-elf-
CC := $(PREFIX)gcc
OBJCOPY := $(PREFIX)objcopy

ARGS := -mabi=ilp32 -march=rv32im -ffreestanding -nostdlib -Wl,-Bstatic,-T,memory.ld -g

SOURCES := main.c
INCLUDES := uart.h

hello_world.bin: hello_world.elf
	$(OBJCOPY) -S -O binary hello_world.elf hello_world.bin

hello_world.elf: $(SOURCES) $(INCLUDES)
	$(CC) $(ARGS) $(SOURCES) -o hello_world.elf

clean:
	rm -f hello_world.elf hello_world.bin
