diff options
author | Neel Gala <neelgala@incoresemi.com> | 2022-02-25 11:42:33 +0530 |
---|---|---|
committer | Neel Gala <neelgala@incoresemi.com> | 2022-02-25 11:42:33 +0530 |
commit | e78559f521c1cae445e02ec5cd43db15bb32d51e (patch) | |
tree | 188af22797ce9d22065dfb3b0265fb6a7e2cdd61 /arch_test_target/spike/device/Makefile_common.inc | |
parent | 8ca012a6cc7e5b9edfaacca2d04b5a0f267377cf (diff) | |
download | spike-e78559f521c1cae445e02ec5cd43db15bb32d51e.zip spike-e78559f521c1cae445e02ec5cd43db15bb32d51e.tar.gz spike-e78559f521c1cae445e02ec5cd43db15bb32d51e.tar.bz2 |
clean up the the arch-test directory to avoid copypasta
- move all common stuff to a Makefile_common.inc
- include this file in all individual Makefile.includes
Diffstat (limited to 'arch_test_target/spike/device/Makefile_common.inc')
-rw-r--r-- | arch_test_target/spike/device/Makefile_common.inc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/arch_test_target/spike/device/Makefile_common.inc b/arch_test_target/spike/device/Makefile_common.inc new file mode 100644 index 0000000..c43222d --- /dev/null +++ b/arch_test_target/spike/device/Makefile_common.inc @@ -0,0 +1,34 @@ +TARGET_SIM ?= spike +TARGET_FLAGS ?= $(RISCV_TARGET_FLAGS) +ifeq ($(shell command -v $(TARGET_SIM) 2> /dev/null),) + $(error Target simulator executable '$(TARGET_SIM)` not found) +endif + +RISCV_PREFIX ?= riscv$(XLEN)-unknown-elf- +RISCV_GCC ?= $(RISCV_PREFIX)gcc +RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump +RISCV_GCC_OPTS ?= -g -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles $(RVTEST_DEFINES) + +COMPILE_CMD = $$(RISCV_GCC) $(1) $$(RISCV_GCC_OPTS) \ + -I$(ROOTDIR)/riscv-test-suite/env/ \ + -I$(TARGETDIR)/$(RISCV_TARGET)/ \ + -T$(TARGETDIR)/$(RISCV_TARGET)/link.ld \ + $$(<) -o $$@ +OBJ_CMD = $$(RISCV_OBJDUMP) $$@ -D > $$@.objdump; \ + $$(RISCV_OBJDUMP) $$@ --source > $$@.debug + + +COMPILE_TARGET=\ + $(COMPILE_CMD); \ + if [ $$$$? -ne 0 ] ; \ + then \ + echo "\e[31m$$(RISCV_GCC) failed for target $$(@) \e[39m" ; \ + exit 1 ; \ + fi ; \ + $(OBJ_CMD); \ + if [ $$$$? -ne 0 ] ; \ + then \ + echo "\e[31m $$(RISCV_OBJDUMP) failed for target $$(@) \e[39m" ; \ + exit 1 ; \ + fi ; + |