Skip to content

Commit 7af6beb

Browse files
committed
Fall back to RV64 compiler if no RV32 compiler and vice versa
1 parent 56fa784 commit 7af6beb

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

isa/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ default: all
4646
# Build rules
4747
#--------------------------------------------------------------------
4848

49+
RISCV_PREFIX ?= riscv$(XLEN)-unknown-elf-
50+
ifeq ($(shell which $(RISCV_PREFIX)gcc 2> /dev/null),)
51+
ALT_XLEN := $(if $(call eq,$(XLEN),64),32,64)
52+
RISCV_PREFIX := riscv$(ALT_XLEN)-unknown-elf-
53+
ifeq ($(shell which $(RISCV_PREFIX)gcc 2> /dev/null),)
54+
$(error couldn't find gcc)
55+
endif
56+
endif
57+
4958
RISCV_PREFIX ?= riscv$(XLEN)-unknown-elf-
5059
RISCV_GCC ?= $(RISCV_PREFIX)gcc
5160
RISCV_GCC_OPTS ?= -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles

0 commit comments

Comments
 (0)