Cleanup `tools` target Remove `qemu` from the target and consolidate `qemu` and `spike` into the platform specific sim_tools.mk file. Change-Id: I9bdcc8fc669cb2d305077e4bdb7a4f718db2cc68
diff --git a/Makefile b/Makefile index f5457bc..5f00742 100644 --- a/Makefile +++ b/Makefile
@@ -31,7 +31,6 @@ include $(ROOTDIR)/build/cantrip_tests.mk include $(ROOTDIR)/build/minisel.mk include $(ROOTDIR)/build/flatbuffers.mk -include $(ROOTDIR)/build/spike.mk include $(ROOTDIR)/build/verilator.mk include $(ROOTDIR)/build/platforms/$(PLATFORM)/platform.mk @@ -54,10 +53,10 @@ ## Installs the RISCV compiler and emulator tooling # -# This includes Rust, GCC, CLANG, verilator, qemu, and renode. +# This includes Rust, GCC, CLANG, verilator, and renode. # # Output is placed in cache/ and out/host. -tools:: install_rust install_gcc install_llvm install_kelvin renode qemu +tools:: install_rust install_gcc install_llvm install_kelvin renode ## Cleans the entire system #
diff --git a/platforms/shodan/platform.mk b/platforms/shodan/platform.mk index a6c80e9..864dbbe 100644 --- a/platforms/shodan/platform.mk +++ b/platforms/shodan/platform.mk
@@ -7,6 +7,7 @@ # Put host tool targets first. include $(ROOTDIR)/build/platforms/shodan/renode.mk include $(ROOTDIR)/build/platforms/shodan/riscv_toolchain.mk +include $(ROOTDIR)/build/platforms/shodan/sim_tools.mk include $(ROOTDIR)/build/platforms/shodan/verible.mk include $(ROOTDIR)/build/platforms/shodan/cantrip.mk
diff --git a/spike.mk b/platforms/shodan/sim_tools.mk similarity index 64% rename from spike.mk rename to platforms/shodan/sim_tools.mk index 0065d58..8bd847e 100644 --- a/spike.mk +++ b/platforms/shodan/sim_tools.mk
@@ -43,4 +43,31 @@ spike_clean: rm -r $(SPIKE_BUILD_DIR) $(SPIKE_INSTALL_DIR) +QEMU_SRC_DIR := $(ROOTDIR)/toolchain/riscv-qemu +QEMU_OUT_DIR := $(OUT)/host/qemu +QEMU_BINARY := $(QEMU_OUT_DIR)/riscv32-softmmu/qemu-system-riscv32 + + +QEMU_DEPS=$(wildcard $(QEMU_SRC_DIR)/**/*.[ch]) + +$(QEMU_OUT_DIR): | $(QEMU_SRC_DIR) + mkdir -p $(QEMU_OUT_DIR); + +# Disable configure check to be compatible with lib6 2.36. +$(QEMU_BINARY): $(QEMU_DEPS) | $(QEMU_OUT_DIR) + cd $(QEMU_OUT_DIR) && $(QEMU_SRC_DIR)/configure \ + --target-list=riscv32-softmmu,riscv32-linux-user --disable-werror + $(MAKE) -C $(QEMU_OUT_DIR) + +## Builds and installs the QEMU RISCV32 simulator. +# +# Sources are in toolchain/riscv-qemu, while outputs are stored in +# out/host/qemu. +qemu: $(QEMU_BINARY) + +## Removes only the QEMU build artifacts from out/ +qemu_clean: + rm -rf $(QEMU_OUT_DIR) + .PHONY:: spike spike_clean +.PHONY:: qemu qemu_clean
diff --git a/toolchain.mk b/toolchain.mk index 5b97f3d..0e46452 100644 --- a/toolchain.mk +++ b/toolchain.mk
@@ -12,10 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -QEMU_SRC_DIR := $(ROOTDIR)/toolchain/riscv-qemu -QEMU_OUT_DIR := $(OUT)/host/qemu -QEMU_BINARY := $(QEMU_OUT_DIR)/riscv32-softmmu/qemu-system-riscv32 - ## Installs the rust toolchains for cantrip and matcha_tock. # # This fetches the tarball from google cloud storage, verifies the checksums and @@ -70,23 +66,6 @@ $(ROOTDIR)/scripts/install-rust-toolchain.sh -p $(MATCHA_PLATFORM_SRC_DIR)/rust-toolchain riscv32imc-unknown-none-elf $(ROOTDIR)/scripts/install-rust-toolchain.sh -p $(MATCHA_APP_SRC_DIR)/rust-toolchain riscv32imc-unknown-none-elf -QEMU_DEPS=$(wildcard $(QEMU_SRC_DIR)/**/*.[ch]) - -$(QEMU_OUT_DIR): | $(QEMU_SRC_DIR) - mkdir -p $(QEMU_OUT_DIR); - -# Disable configure check to be compatible with lib6 2.36. -$(QEMU_BINARY): $(QEMU_DEPS) | $(QEMU_OUT_DIR) - cd $(QEMU_OUT_DIR) && $(QEMU_SRC_DIR)/configure \ - --target-list=riscv32-softmmu,riscv32-linux-user --disable-werror - $(MAKE) -C $(QEMU_OUT_DIR) - -## Builds and installs the QEMU RISCV32 simulator. -# -# Sources are in toolchain/riscv-qemu, while outputs are stored in -# out/host/qemu. -qemu: $(QEMU_BINARY) - $(OUT)/tmp: | $(OUT) mkdir -p $(OUT)/tmp @@ -122,9 +101,5 @@ # extracts it locally to the cache/. install_kelvin: $(CACHE)/toolchain_kelvin/bin/riscv32-unknown-elf-gcc -## Removes only the QEMU build artifacts from out/ -qemu_clean: - rm -rf $(QEMU_OUT_DIR) - -.PHONY:: qemu toolchain_clean qemu_clean install_llvm install_gcc install_rust rust_presence_check +.PHONY:: toolchain_clean install_llvm install_gcc install_rust rust_presence_check .PHONY:: collate_rust_toolchains collate_cantrip_rust_toolchain collate_matcha_rust_toolchain