The tools had riscv64-unknown-elf-gcc hard-coded all over the place.
This lets users override that if they have a 32-bit toolchain.
prefix := @prefix@
abs_top_src_dir := @abs_top_srcdir@
+XLEN := @XLEN@
instbasedir := $(DESTDIR)$(prefix)
bmarkdir := $(abs_top_src_dir)/benchmarks
isa_src_dir := $(abs_top_src_dir)/isa
benchmarks:
mkdir -p benchmarks
- $(MAKE) -C benchmarks -f $(bmarkdir)/Makefile src_dir=$(bmarkdir)
+ $(MAKE) -C benchmarks -f $(bmarkdir)/Makefile src_dir=$(bmarkdir) XLEN=$(XLEN)
isa:
mkdir -p isa
- $(MAKE) -C isa -f $(isa_src_dir)/Makefile src_dir=$(isa_src_dir)
+ $(MAKE) -C isa -f $(isa_src_dir)/Makefile src_dir=$(isa_src_dir) XLEN=$(XLEN)
clean:
$(MAKE) -C isa -f $(isa_src_dir)/Makefile src_dir=$(isa_src_dir) clean
HOST_OPTS = -std=gnu99 -DPREALLOCATE=0 -DHOST_DEBUG=1
HOST_COMP = gcc $(HOST_OPTS)
-RISCV_PREFIX ?= riscv64-unknown-elf-
+RISCV_PREFIX ?= riscv$(XLEN)-unknown-elf-
RISCV_GCC ?= $(RISCV_PREFIX)gcc
RISCV_GCC_OPTS ?= -mcmodel=medany -static -std=gnu99 -O2 -ffast-math -fno-common -fno-builtin-printf
RISCV_LINK ?= $(RISCV_GCC) -T $(src_dir)/common/test.ld $(incs)
ac_subst_vars='LTLIBOBJS
LIBOBJS
+XLEN
OBJEXT
EXEEXT
ac_ct_CC
ac_subst_files=''
ac_user_opts='
enable_option_checking
+with_xlen
'
ac_precious_vars='build_alias
host_alias
esac
cat <<\_ACEOF
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-xlen=XLEN Set XLEN, the X-register bit width (default is 64)
+
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+# Check whether --with-xlen was given.
+if test "${with_xlen+set}" = set; then :
+ withval=$with_xlen; XLEN=$withval
+
+else
+ XLEN=64
+
+
+fi
+
+
+
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
cross_compiling=yes
AC_PROG_CC
+AC_ARG_WITH(xlen,
+ [AS_HELP_STRING([--with-xlen=XLEN],
+ [Set XLEN, the X-register bit width (default is 64)])],
+ AC_SUBST(XLEN, $withval),
+ AC_SUBST(XLEN, 64)
+ )
+
+
AC_OUTPUT(
Makefile
)
# Build rules
#--------------------------------------------------------------------
-RISCV_PREFIX ?= riscv64-unknown-elf-
+RISCV_PREFIX ?= riscv$(XLEN)-unknown-elf-
RISCV_GCC ?= $(RISCV_PREFIX)gcc
ENTROPY ?= -DENTROPY=$(shell echo $$$$)
RISCV_GCC_OPTS ?= $(ENTROPY) -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles
RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.text.init --section=.data
RISCV_SIM ?= spike
-XLEN ?= 64
vpath %.S $(src_dir)
# Build rules
#--------------------------------------------------------------------
-RISCV_PREFIX=riscv64-unknown-elf-
+RISCV_PREFIX=riscv$(XLEN)-unknown-elf-
RISCV_GCC = $(RISCV_PREFIX)gcc
RISCV_GCC_OPTS = -std=gnu99 -O2 -ffast-math
RISCV_LINK = $(RISCV_GCC) -T $(common)/test.ld $(incs)