build: make ARCH=<arch> clean qemu boots the kernel from the top level

Top-level 'qemu' fell through to v3/Makefile, which has no such rule.
qemu, qemu-esp and qemu-gdb now go to kernel/Makefile; with ARCH given on
the command line and no TARGET, 'clean' is the kernel's for that ISA.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-20 15:20:16 -04:00
co-authored by Claude Opus 5.5
parent 59bff9a0c7
commit d577a1db48
+16 -2
View File
@@ -29,6 +29,9 @@
#
# make sbom SPDX SBOM of the source tree (sbom.spdx, sbom.spdx.json)
# make kernel ARCH=<arch> [GOAL=g] kernel/Makefile goal (default: all)
# make ARCH=<arch> clean qemu the kernel for <arch> (amd64 aarch64 riscv64),
# cleaned, built and booted in QEMU: the
# acceptance boot (.claude/CLAUDE.md)
# make boards list boards and whether they can be built
# make <other goal> goes to v3/Makefile (make help-hosted)
# ==============================================================================
@@ -56,7 +59,12 @@ BOARD_DIR := $(if $(TARGET),$(BOARD_DIR_$(TARGET)))
SUBMAKE := $(MAKE) --no-print-directory
.DEFAULT_GOAL := all
.PHONY: all boot_image boot_images docs clean clean-docs kernel boards help help-hosted sbom sbom-board
.PHONY: all boot_image boot_images docs clean clean-docs kernel boards help help-hosted sbom sbom-board \
qemu qemu-esp qemu-gdb
# ARCH given on the command line and no TARGET: `clean` is the kernel's for that
# ISA, as `qemu` always is (make ARCH=<arch> clean qemu).
KERNEL_CLEAN := $(if $(TARGET),,$(filter command line,$(origin ARCH)))
# ------------------------------------------------------------------------------
# all
@@ -182,7 +190,10 @@ clean-docs:
# ------------------------------------------------------------------------------
# clean
# ------------------------------------------------------------------------------
ifeq ($(TARGET),)
ifneq ($(KERNEL_CLEAN),)
clean:
@$(SUBMAKE) -f kernel/Makefile ARCH=$(ARCH) clean
else ifeq ($(TARGET),)
clean:
@if [ -d build ]; then find build -mindepth 1 -maxdepth 1 ! -name cache -exec rm -rf {} +; fi
rm -f v3/include/version.h
@@ -204,6 +215,9 @@ GOAL ?= all
kernel:
@$(SUBMAKE) -f kernel/Makefile TARGET=kernel $(GOAL)
qemu qemu-esp qemu-gdb:
@$(SUBMAKE) -f kernel/Makefile $(if $(ARCH),ARCH=$(ARCH)) $@
boards:
@$(foreach b,$(BOARDS),printf ' %-9s %-8s %s\n' "$(b)" \
"$(if $(call board_ready,$(b)),ready,no port)" "$(call board_field,$(b),BOARD_DESC)";)