nixos-riscv/bootrom/Makefile

24 lines
441 B
Makefile

CC ?= riscv64-unknown-elf-gcc
OBJCOPY ?= riscv64-unknown-elf-objcopy
ROM_BASE ?= 0x00100
LDFLAGS=-Tlinker.ld -nostdlib -nostartfiles -nodefaultlibs -static -Wl,--no-gc-sections -Wl,--defsym=ROM_BASE=$(ROM_BASE)
b=rbootrom
all: $b.elf $b.bin
$b.o: $b.S
$(CC) $(CFLAGS) -c -o $@ $<
$b.elf: $b.o linker.ld
$(CC) $(LDFLAGS) -o $@ $<
$b.bin: $b.elf
$(OBJCOPY) -O binary $b.elf $b.bin
clean:
rm -f $b.elf $b.bin $b.o
.PHONY: clean all