aboutsummaryrefslogtreecommitdiff
path: root/Makefile.in
diff options
context:
space:
mode:
authorKito Cheng <kito.cheng@sifive.com>2020-06-23 14:45:00 +0800
committerKito Cheng <kito.cheng@sifive.com>2020-11-04 10:44:37 +0800
commit03d57716abd1fb9e403b488daed66477abc878a1 (patch)
tree9855d1d6b2f6673a255f68f5c9bc8e1bdd5365d6 /Makefile.in
parented53ae7a71dfc6df1940c2255aea5bf542a9c422 (diff)
downloadriscv-gnu-toolchain-03d57716abd1fb9e403b488daed66477abc878a1.zip
riscv-gnu-toolchain-03d57716abd1fb9e403b488daed66477abc878a1.tar.gz
riscv-gnu-toolchain-03d57716abd1fb9e403b488daed66477abc878a1.tar.bz2
Add makefile option to select which simulator to run test
Diffstat (limited to 'Makefile.in')
-rw-r--r--Makefile.in64
1 files changed, 40 insertions, 24 deletions
diff --git a/Makefile.in b/Makefile.in
index d3c4e92..fbddd26 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -10,6 +10,8 @@ MUSL_SRCDIR := @with_musl_src@
LINUX_HEADERS_SRCDIR := @with_linux_headers_src@
GDB_SRCDIR := @with_gdb_src@
+SIM:=qemu
+
ifeq ($(srcdir)/riscv-gcc,$(GCC_SRCDIR))
# We need a relative source dir for the gcc configure, to make msys2 mingw64
# builds work. Mayberelsrcdir is relative if a relative path was used to run
@@ -148,6 +150,20 @@ report-binutils: report-binutils-@default_target@
.PHONY: report-gdb
report-gdb: report-gdb-@default_target@
+.PHONY: build-sim
+build-sim:
+ifeq ($(SIM),qemu)
+SIM_PATH:=$(srcdir)/scripts/wrapper/qemu
+build-sim: stamps/build-qemu
+else
+ifeq ($(SIM),gdb)
+# Using gdb simulator.
+SIM_PATH:=$(INSTALL_DIR)/bin
+else
+$(error "Only support SIM=spike, SIM=gdb or SIM=qemu (default).")
+endif
+endif
+
stamps/check-write-permission:
mkdir -p $(INSTALL_DIR)/.test || \
(echo "Sorry, you don't have permission to write to" \
@@ -712,18 +728,18 @@ stamps/build-dejagnu: $(srcdir)/riscv-dejagnu
mkdir -p $(dir $@)
date > $@
-stamps/check-gcc-newlib: stamps/build-gcc-newlib-stage2 stamps/build-qemu stamps/build-dejagnu
- PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-gcc-newlib-stage2 check-gcc "RUNTESTFLAGS=--target_board='$(NEWLIB_TARGET_BOARDS)'"
+stamps/check-gcc-newlib: stamps/build-gcc-newlib-stage2 build-sim stamps/build-dejagnu
+ PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-gcc-newlib-stage2 check-gcc "RUNTESTFLAGS=--target_board='$(NEWLIB_TARGET_BOARDS)'"
mkdir -p $(dir $@)
date > $@
-stamps/check-gcc-newlib-nano: stamps/build-gcc-newlib-stage2 stamps/build-qemu stamps/build-dejagnu
- PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-gcc-newlib-stage2 check-gcc "RUNTESTFLAGS=--target_board='$(NEWLIB_NANO_TARGET_BOARDS)'"
+stamps/check-gcc-newlib-nano: stamps/build-gcc-newlib-stage2 build-sim stamps/build-dejagnu
+ PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-gcc-newlib-stage2 check-gcc "RUNTESTFLAGS=--target_board='$(NEWLIB_NANO_TARGET_BOARDS)'"
mkdir -p $(dir $@)
date > $@
-stamps/check-gcc-linux: stamps/build-gcc-linux-stage2 stamps/build-qemu stamps/build-dejagnu
- PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-gcc-linux-stage2 check-gcc "RUNTESTFLAGS=--target_board='$(GLIBC_TARGET_BOARDS)'"
+stamps/check-gcc-linux: stamps/build-gcc-linux-stage2 build-sim stamps/build-dejagnu
+ PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-gcc-linux-stage2 check-gcc "RUNTESTFLAGS=--target_board='$(GLIBC_TARGET_BOARDS)'"
mkdir -p $(dir $@)
date > $@
@@ -733,56 +749,56 @@ check-dhrystone-newlib-nano: $(patsubst %,stamps/check-dhrystone-newlib-nano-%,$
stamps/check-dhrystone-newlib-%: \
stamps/build-gcc-newlib-stage2 \
- stamps/build-qemu \
+ build-sim \
$(wildcard $(srcdir)/test/benchmarks/dhrystone/*)
$(eval $@_ARCH := $(word 4,$(subst -, ,$@)))
$(eval $@_ABI := $(word 5,$(subst -, ,$@)))
$(eval $@_XLEN := $(patsubst rv32%,32,$(patsubst rv64%,64,$($@_ARCH))))
- PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(srcdir)/test/benchmarks/dhrystone/check -march=$($@_ARCH) -mabi=$($@_ABI) -cc=riscv$(XLEN)-unknown-elf-gcc -objdump=riscv$(XLEN)-unknown-elf-objdump -sim=riscv$($@_XLEN)-unknown-elf-run -out=$@ $(filter %.c,$^) || true
+ PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(srcdir)/test/benchmarks/dhrystone/check -march=$($@_ARCH) -mabi=$($@_ABI) -cc=riscv$(XLEN)-unknown-elf-gcc -objdump=riscv$(XLEN)-unknown-elf-objdump -sim=riscv$($@_XLEN)-unknown-elf-run -out=$@ $(filter %.c,$^) || true
stamps/check-dhrystone-newlib-nano-%: \
stamps/build-gcc-newlib-stage2 \
- stamps/build-qemu \
+ build-sim \
$(wildcard $(srcdir)/test/benchmarks/dhrystone/*)
$(eval $@_ARCH := $(word 5,$(subst -, ,$@)))
$(eval $@_ABI := $(word 6,$(subst -, ,$@)))
$(eval $@_XLEN := $(patsubst rv32%,32,$(patsubst rv64%,64,$($@_ARCH))))
- PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(srcdir)/test/benchmarks/dhrystone/check -march=$($@_ARCH) -mabi=$($@_ABI) -specs=nano.specs -cc=riscv$(XLEN)-unknown-elf-gcc -objdump=riscv$(XLEN)-unknown-elf-objdump -sim=riscv$($@_XLEN)-unknown-elf-run -out=$@ $(filter %.c,$^) || true
+ PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(srcdir)/test/benchmarks/dhrystone/check -march=$($@_ARCH) -mabi=$($@_ABI) -specs=nano.specs -cc=riscv$(XLEN)-unknown-elf-gcc -objdump=riscv$(XLEN)-unknown-elf-objdump -sim=riscv$($@_XLEN)-unknown-elf-run -out=$@ $(filter %.c,$^) || true
.PHONY: check-dhrystone-linux
check-dhrystone-linux: $(patsubst %,stamps/check-dhrystone-linux-%,$(GLIBC_MULTILIB_NAMES))
stamps/check-dhrystone-linux-%: \
stamps/build-gcc-linux-stage2 \
- stamps/build-qemu \
+ build-sim \
$(wildcard $(srcdir)/test/benchmarks/dhrystone/*)
$(eval $@_ARCH := $(word 4,$(subst -, ,$@)))
$(eval $@_ABI := $(word 5,$(subst -, ,$@)))
$(eval $@_XLEN := $(patsubst rv32%,32,$(patsubst rv64%,64,$($@_ARCH))))
- PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(srcdir)/test/benchmarks/dhrystone/check -march=$($@_ARCH) -mabi=$($@_ABI) -cc=riscv$(XLEN)-unknown-elf-gcc -objdump=riscv$(XLEN)-unknown-elf-objdump -sim=riscv$($@_XLEN)-unknown-elf-run -out=$@ $(filter %.c,$^) || true
+ PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(srcdir)/test/benchmarks/dhrystone/check -march=$($@_ARCH) -mabi=$($@_ABI) -cc=riscv$(XLEN)-unknown-elf-gcc -objdump=riscv$(XLEN)-unknown-elf-objdump -sim=riscv$($@_XLEN)-unknown-elf-run -out=$@ $(filter %.c,$^) || true
-stamps/check-binutils-newlib: stamps/build-gcc-newlib-stage2 stamps/build-qemu stamps/build-dejagnu
- PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-binutils-newlib check-binutils check-gas check-ld -k "RUNTESTFLAGS=--target_board='$(NEWLIB_TARGET_BOARDS)'" || true
+stamps/check-binutils-newlib: stamps/build-gcc-newlib-stage2 build-sim stamps/build-dejagnu
+ PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-binutils-newlib check-binutils check-gas check-ld -k "RUNTESTFLAGS=--target_board='$(NEWLIB_TARGET_BOARDS)'" || true
date > $@
-stamps/check-binutils-newlib-nano: stamps/build-gcc-newlib-stage2 stamps/build-qemu stamps/build-dejagnu
- PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-binutils-newlib check-binutils check-gas check-ld -k "RUNTESTFLAGS=--target_board='$(NEWLIB_NANO_TARGET_BOARDS)'" || true
+stamps/check-binutils-newlib-nano: stamps/build-gcc-newlib-stage2 build-sim stamps/build-dejagnu
+ PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-binutils-newlib check-binutils check-gas check-ld -k "RUNTESTFLAGS=--target_board='$(NEWLIB_NANO_TARGET_BOARDS)'" || true
date > $@
-stamps/check-binutils-linux: stamps/build-gcc-linux-stage2 stamps/build-qemu stamps/build-dejagnu
- PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-binutils-linux check-binutils check-gas check-ld -k "RUNTESTFLAGS=--target_board='$(GLIBC_TARGET_BOARDS)'" || true
+stamps/check-binutils-linux: stamps/build-gcc-linux-stage2 build-sim stamps/build-dejagnu
+ PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-binutils-linux check-binutils check-gas check-ld -k "RUNTESTFLAGS=--target_board='$(GLIBC_TARGET_BOARDS)'" || true
date > $@
-stamps/check-gdb-newlib: stamps/build-gcc-newlib-stage2 stamps/build-gdb-newlib stamps/build-qemu stamps/build-dejagnu
- PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-gdb-newlib check-gdb -k "RUNTESTFLAGS=--target_board='$(NEWLIB_TARGET_BOARDS)'" || true
+stamps/check-gdb-newlib: stamps/build-gcc-newlib-stage2 stamps/build-gdb-newlib build-sim stamps/build-dejagnu
+ PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-gdb-newlib check-gdb -k "RUNTESTFLAGS=--target_board='$(NEWLIB_TARGET_BOARDS)'" || true
date > $@
-stamps/check-gdb-newlib-nano: stamps/build-gcc-newlib-stage2 stamps/build-gdb-newlib stamps/build-qemu stamps/build-dejagnu
- PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-gdb-newlib check-gdb -k "RUNTESTFLAGS=--target_board='$(NEWLIB_NANO_TARGET_BOARDS)'" || true
+stamps/check-gdb-newlib-nano: stamps/build-gcc-newlib-stage2 stamps/build-gdb-newlib build-sim stamps/build-dejagnu
+ PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-gdb-newlib check-gdb -k "RUNTESTFLAGS=--target_board='$(NEWLIB_NANO_TARGET_BOARDS)'" || true
date > $@
-stamps/check-gdb-linux: stamps/build-gcc-linux-stage2 stamps/build-gdb-linux stamps/build-qemu stamps/build-dejagnu
- PATH="$(srcdir)/scripts/wrapper/qemu:$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-gdb-linux check-gdb -k "RUNTESTFLAGS=--target_board='$(GLIBC_TARGET_BOARDS)'" || true
+stamps/check-gdb-linux: stamps/build-gcc-linux-stage2 stamps/build-gdb-linux build-sim stamps/build-dejagnu
+ PATH="$(SIM_PATH):$(INSTALL_DIR)/bin:$(PATH)" RISC_V_SYSROOT="$(SYSROOT)" $(MAKE) -C build-gdb-linux check-gdb -k "RUNTESTFLAGS=--target_board='$(GLIBC_TARGET_BOARDS)'" || true
date > $@
.PHONY: report-gcc-newlib report-gcc-newlib-nano