Skip to content

Commit bbfe6dc

Browse files
committed
Check cross-compiler only with 'arch-test' target
1 parent f13c541 commit bbfe6dc

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ include mk/toolchain.mk
44
OUT ?= build
55
BIN := $(OUT)/rv32emu
66

7-
-include $(OUT)/.config
7+
CONFIG_FILE := $(OUT)/.config
8+
-include $(CONFIG_FILE)
89

910
CFLAGS = -std=gnu99 -O2 -Wall -Wextra
1011
CFLAGS += -Wno-unused-label
@@ -95,7 +96,7 @@ $(OUT)/emulate.o: CFLAGS += $(CFLAGS_NO_CET) -fomit-frame-pointer -fno-stack-che
9596
# to the first target after .DEFAULT_GOAL is not set.
9697
.DEFAULT_GOAL :=
9798

98-
all: $(BIN)
99+
all: config $(BIN)
99100

100101
OBJS := \
101102
map.o \
@@ -122,8 +123,9 @@ $(BIN): $(OBJS)
122123
$(VECHO) " LD\t$@\n"
123124
$(Q)$(CC) -o $@ $^ $(LDFLAGS)
124125

125-
config:
126-
$(Q)echo "$(CFLAGS)" | xargs -n1 | sort | sed -n 's/^RV32_FEATURE/ENABLE/p' > $(OUT)/.config
126+
config: $(CONFIG_FILE)
127+
$(CONFIG_FILE):
128+
$(Q)echo "$(CFLAGS)" | xargs -n1 | sort | sed -n 's/^RV32_FEATURE/ENABLE/p' > $@
127129
$(VECHO) "Check the file $(OUT)/.config for configured items.\n"
128130

129131
# Tools

mk/riscv-arch-test.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ export WORK := $(TARGETDIR)/build/arch-test
55
export RISCV_DEVICE ?= IMCZicsrZifencei
66

77
arch-test: $(BIN)
8+
ifeq ($(CROSS_COMPILE),)
9+
$(error GNU Toolchain for RISC-V is required to build architecture tests. Please check package installation)
10+
endif
811
git submodule update --init $(dir $(ARCH_TEST_DIR))
912
$(Q)python3 -B $(RISCV_TARGET)/setup.py --riscv_device=$(RISCV_DEVICE)
1013
$(Q)riscof run --work-dir=$(WORK) \

mk/toolchain.mk

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,5 @@ endef
4242
# TODO: support clang/llvm based cross compilers
4343
# TODO: support native RISC-V compilers
4444
CROSS_COMPILE ?= $(word 1,$(foreach prefix,$(TOOLCHAIN_LIST),$(call check-cross-tools, $(prefix))))
45-
ifeq ($(CROSS_COMPILE),)
46-
$(warning GNU Toolchain for RISC-V is required to build architecture tests. Please check package installation)
47-
endif
4845

4946
export CROSS_COMPILE

0 commit comments

Comments
 (0)