@@ -37,14 +37,27 @@ SCIMARK2_SHA1 := de278c5b8cef84ab6dda41855052c7bfef919e36
3737SHELL_HACK := $(shell mkdir -p $(BIN_DIR ) /linux-x86-softfp $(BIN_DIR ) /riscv32 $(BIN_DIR ) /linux-image)
3838
3939ifeq ($(call has, PREBUILT) , 1)
40- ifeq ($(call has, SYSTEM) , 1)
41- LATEST_RELEASE := $(shell wget -q https://api.github.com/repos/sysprog21/rv32emu-prebuilt/releases -O- | grep '"tag_name"' | grep "Linux-Image" | head -n 1 | sed -E 's/.* "tag_name": "([^"]+) ".*/\1/')
42- else ifeq ($(call has, ARCH_TEST), 1)
43- LATEST_RELEASE := $(shell wget -q https://api.github.com/repos/sysprog21/rv32emu-prebuilt/releases -O- | grep '"tag_name"' | grep "sail" | head -n 1 | sed -E 's/.* "tag_name": "([^"]+) ".*/\1/')
44- else
45- LATEST_RELEASE := $(shell wget -q https://api.github.com/repos/sysprog21/rv32emu-prebuilt/releases -O- | grep '"tag_name"' | grep "ELF" | head -n 1 | sed -E 's/.* "tag_name": "([^"]+) ".*/\1/')
46- endif
47- PREBUILT_BLOB_URL = https://github.com/sysprog21/rv32emu-prebuilt/releases/download/$(LATEST_RELEASE )
40+ ifeq ($(call has, SYSTEM), 1)
41+ ifeq ($(wildcard $(BIN_DIR)/rv32emu-linux-image-prebuilt.tar.gz),)
42+ LATEST_RELEASE := $(shell wget -q https://api.github.com/repos/sysprog21/rv32emu-prebuilt/releases -O- | grep '"tag_name"' | grep "Linux-Image" | head -n 1 | sed -E 's/.* "tag_name": "([^"]+) ".*/\1/')
43+ else
44+ $(info Linux Image is found. Skipping downloading.)
45+ endif
46+ else ifeq ($(call has, ARCH_TEST), 1)
47+ ifeq ($(wildcard $(BIN_DIR)/rv32emu-prebuilt-sail-$(HOST_PLATFORM)),)
48+ LATEST_RELEASE := $(shell wget -q https://api.github.com/repos/sysprog21/rv32emu-prebuilt/releases -O- | grep '"tag_name"' | grep "sail" | head -n 1 | sed -E 's/.* "tag_name": "([^"]+) ".*/\1/')
49+ else
50+ $(info Sail model is found. Skipping downloading.)
51+ endif
52+ else
53+ ifeq ($(wildcard $(BIN_DIR)/rv32emu-prebuilt.tar.gz),)
54+ LATEST_RELEASE := $(shell wget -q https://api.github.com/repos/sysprog21/rv32emu-prebuilt/releases -O- | grep '"tag_name"' | grep "ELF" | head -n 1 | sed -E 's/.* "tag_name": "([^"]+) ".*/\1/')
55+ else
56+ $(info Prebuilt benchmarks are found. Skipping downloading.)
57+ endif
58+ endif
59+
60+ PREBUILT_BLOB_URL = https://github.com/sysprog21/rv32emu-prebuilt/releases/download/$(LATEST_RELEASE )
4861else
4962 # Since rv32emu only supports the dynamic binary translation of integer instruction in tiered compilation currently,
5063 # we disable the hardware floating-point and the related SIMD operation of x86.
@@ -95,14 +108,15 @@ endif
95108ifeq ($(call has, ARCH_TEST) , 1)
96109 $(Q)if [ "$(RES)" = "1" ]; then \
97110 $(PRINTF) "\n$(YELLOW)SHA-1 verification failed! Re-fetching prebuilt binaries from \"rv32emu-prebuilt\" ...\n$(NO_COLOR)"; \
98- wget -q --show-progress $(PREBUILT_BLOB_URL)/$(RV32EMU_PREBUILT_TARBALL) -O build/$(RV32EMU_PREBUILT_TARBALL);\
111+ wget -q --show-progress $(PREBUILT_BLOB_URL)/$(RV32EMU_PREBUILT_TARBALL) -O build/$(RV32EMU_PREBUILT_TARBALL); \
99112 else \
100113 $(call notice, [OK]); \
101114 fi
102115else
103116 $(Q)if [ "$(RES)" = "1" ]; then \
104117 $(PRINTF) "\n$(YELLOW)SHA-1 verification failed! Re-fetching prebuilt binaries from \"rv32emu-prebuilt\" ...\n$(NO_COLOR)"; \
105- wget -q --show-progress $(PREBUILT_BLOB_URL)/$(RV32EMU_PREBUILT_TARBALL) -O- | tar -C build --strip-components=1 -xz; \
118+ wget -q --show-progress $(PREBUILT_BLOB_URL)/$(RV32EMU_PREBUILT_TARBALL) -O build/$(RV32EMU_PREBUILT_TARBALL); \
119+ tar --strip-components=1 -zxf build/$(RV32EMU_PREBUILT_TARBALL) -C build; \
106120 else \
107121 $(call notice, [OK]); \
108122 fi
@@ -149,14 +163,26 @@ fetch-checksum:
149163ifeq ($(call has, PREBUILT) , 1)
150164 $(Q)$(PRINTF) "Fetching SHA-1 of prebuilt binaries ...\n"
151165ifeq ($(call has, SYSTEM) , 1)
152- $(Q)wget -q -O $(BIN_DIR)/sha1sum-linux-image $(PREBUILT_BLOB_URL)/sha1sum-linux-image
153- $(Q)$(call notice, [OK])
166+ ifeq ($(wildcard $(BIN_DIR)/rv32emu-linux-image-prebuilt.tar.gz),)
167+ wget -q -O $(BIN_DIR)/sha1sum-linux-image $(PREBUILT_BLOB_URL)/sha1sum-linux-image
168+ $(Q)$(call notice, [OK])
169+ else
170+ $(info Downloading skipped.)
171+ endif
154172else ifeq ($(call has, ARCH_TEST), 1)
155- $(Q)wget -q -O $(BIN_DIR)/rv32emu-prebuilt-sail-$(HOST_PLATFORM).sha $(PREBUILT_BLOB_URL)/rv32emu-prebuilt-sail-$(HOST_PLATFORM).sha
173+ ifeq ($(wildcard $(BIN_DIR)/rv32emu-prebuilt-sail-$(HOST_PLATFORM)),)
174+ wget -q -O $(BIN_DIR)/rv32emu-prebuilt-sail-$(HOST_PLATFORM).sha $(PREBUILT_BLOB_URL)/rv32emu-prebuilt-sail-$(HOST_PLATFORM).sha
175+ else
176+ $(info Downloading skipped.)
177+ endif
156178else
157- $(Q)wget -q -O $(BIN_DIR)/sha1sum-linux-x86-softfp $(PREBUILT_BLOB_URL)/sha1sum-linux-x86-softfp
158- $(Q)wget -q -O $(BIN_DIR)/sha1sum-riscv32 $(PREBUILT_BLOB_URL)/sha1sum-riscv32
159- $(Q)$(call notice, [OK])
179+ ifeq ($(wildcard $(BIN_DIR)/rv32emu-prebuilt.tar.gz),)
180+ wget -q -O $(BIN_DIR)/sha1sum-linux-x86-softfp $(PREBUILT_BLOB_URL)/sha1sum-linux-x86-softfp
181+ wget -q -O $(BIN_DIR)/sha1sum-riscv32 $(PREBUILT_BLOB_URL)/sha1sum-riscv32
182+ $(Q)$(call notice, [OK])
183+ else
184+ $(info Downloading skipped.)
185+ endif
160186endif
161187endif
162188
0 commit comments