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
|
2025-02-10 05:51:18 +00:00
|
|
|
export QEMU?=qemu-riscv32
|
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-11 12:08:32 +00:00
|
|
|
calc.elf: mem.o hex.o debug.o math.o calc.o
|
2025-02-10 02:03:11 +00:00
|
|
|
$(LD) -m elf32lriscv -T link.ld $^ -o $@
|
|
|
|
|
2025-02-11 12:08:32 +00:00
|
|
|
tests: tests/btohex.elf tests/tohex.elf tests/math_add64.elf
|
|
|
|
|
|
|
|
tests/math_add64.elf: hex.o math.o tests/math_add64.o
|
|
|
|
$(LD) -m elf32lriscv -T link.ld $^ -o $@
|
2025-02-10 02:03:11 +00:00
|
|
|
|
2025-02-10 05:51:18 +00:00
|
|
|
tests/btohex.elf: mem.o hex.o debug.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
|