| # Copyright 2022 Google LLC |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # 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 |
| |
| |
| 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:: qemu qemu_clean |