2025-02-09 11:36:54 +00:00
|
|
|
CC=riscv64-unknown-elf-gcc
|
2025-02-09 01:09:13 +00:00
|
|
|
AS=riscv64-unknown-elf-as
|
2025-02-09 06:58:41 +00:00
|
|
|
ASFLAGS=-g -mabi=ilp32e -march=rv32ec
|
2025-02-09 11:36:54 +00:00
|
|
|
CFLAGS=$(ASFLAGS)
|
2025-02-09 01:09:13 +00:00
|
|
|
LD=riscv64-unknown-elf-ld
|
2025-02-10 02:03:11 +00:00
|
|
|
export JQ?=jaq
|
|
|
|
export RV32EMU?=$(HOME)/Source/github.com/sysprog21/rv32emu/build/rv32emu
|
2025-02-09 01:09:13 +00:00
|
|
|
|
2025-02-09 05:09:53 +00:00
|
|
|
all: calc.elf
|
2025-02-09 01:09:13 +00:00
|
|
|
|
2025-02-10 02:03:11 +00:00
|
|
|
check: tests
|
|
|
|
@tests/unittest
|
|
|
|
|
2025-02-09 01:09:13 +00:00
|
|
|
hello.elf: hello.o
|
|
|
|
$(LD) -m elf32lriscv $^ -o $@
|
|
|
|
|
2025-02-10 02:03:11 +00:00
|
|
|
calc.elf: hex.o calc.o
|
|
|
|
$(LD) -m elf32lriscv -T link.ld $^ -o $@
|
|
|
|
|
2025-02-10 02:55:08 +00:00
|
|
|
tests: tests/btohex.elf tests/tohex.elf
|
2025-02-10 02:03:11 +00:00
|
|
|
|
|
|
|
tests/btohex.elf: hex.o tests/btohex.o
|
2025-02-09 05:09:53 +00:00
|
|
|
$(LD) -m elf32lriscv -T link.ld $^ -o $@
|
2025-02-09 01:09:13 +00:00
|
|
|
|
2025-02-10 02:55:08 +00:00
|
|
|
tests/tohex.elf: hex.o tests/tohex.o
|
|
|
|
$(LD) -m elf32lriscv -T link.ld $^ -o $@
|
|
|
|
|
2025-02-09 01:09:13 +00:00
|
|
|
%.o : %.s
|
2025-02-09 06:58:41 +00:00
|
|
|
$(AS) $(ASFLAGS) $< -o $@
|
2025-02-10 02:03:11 +00:00
|
|
|
|
|
|
|
.PHONY: check tests
|