1
0
mirror of https://github.com/olofk/serv.git synced 2026-01-11 23:42:50 +00:00

sw/Makefile: allow setting CC

Useful for CC="clang --target=..." so you don't need a full GCC
toolchain.

Signed-off-by: Alfred Persson Forsberg <cat@catcream.org>
This commit is contained in:
Alfred Persson Forsberg 2025-02-20 16:22:33 +01:00 committed by Olof Kindgren
parent f8ce26f3b0
commit 2311403691

View File

@ -1,9 +1,11 @@
TOOLCHAIN_PREFIX?=riscv64-unknown-elf- TOOLCHAIN_PREFIX?=riscv64-unknown-elf-
CC?=$(TOOLCHAIN_PREFIX)gcc
OBJCOPY=$(TOOLCHAIN_PREFIX)objcopy
%.elf: %.S link.ld %.elf: %.S link.ld
$(TOOLCHAIN_PREFIX)gcc -nostartfiles -nostdlib -march=rv32i_zicsr -mabi=ilp32 -Tlink.ld -o$@ $< $(CC) -nostartfiles -nostdlib -march=rv32i_zicsr -mabi=ilp32 -Tlink.ld -o$@ $<
%.bin: %.elf %.bin: %.elf
$(TOOLCHAIN_PREFIX)objcopy -O binary $< $@ $(OBJCOPY) -O binary $< $@
%.hex: %.bin %.hex: %.bin
python3 makehex.py $< > $@ python3 makehex.py $< > $@