Repository navigation
build(build): simplify Makefile and kernel.mk test and host rules - #275
Merged
marcobuschini merged 1 commit intoDec 4, 2026
Conversation
- Split kernel/kernel.mk into KERNEL_CORE_SRCS (host-testable), KERNEL_TARGET_SRCS (bare-metal only), and auto-discovered KERNEL_SHELL_TEST_SRCS - Auto-discover tests/host/*.cpp and tests/host/mocks/*.cpp in Makefile (HOST_TEST_CASE_SRCS / HOST_ONLY_TEST_SRCS) and derive TEST_FORMAT_SRCS and HOST_KERNEL_SRCS from single sources of truth - Factor shared host flags (HOST_COMMON_CXXFLAGS, HOST_COMMON_LDFLAGS) and deduplicate ASan/UBSan and gcov host build rules via define_host_variant - Include test directories in compile_commands.json prerequisites so newly added tests refresh the compilation database automatically - Update build instructions in docs/07-contributing-and-debugging.md and docs/08-testing-and-ci.md Closes #266
5 tasks
marcobuschini
deleted the
266-issue-simplify-makefile-also-for-tests-and-host-based-tests
branch
December 4, 2026 14:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commitizen Summary
buildbuildWhat Changed
kernel/kernel.mkinto three clear groups:KERNEL_CORE_SRCS(portable subsystems shared with host tests),KERNEL_TARGET_SRCS(bare-metal / target-only sources), and auto-discoveredKERNEL_SHELL_TEST_SRCS := $(sort $(wildcard kernel/shell/tests/*.cpp)).MakefileviaHOST_TEST_CASE_SRCS := $(sort $(wildcard tests/host/*.cpp) $(wildcard tests/host/mocks/*.cpp))and derivedHOST_ONLY_TEST_SRCS,TEST_FORMAT_SRCS, andcompile_commands.json--host-srcsfrom that single source of truth.HOST_KERNEL_SRCS := $(KERNEL_CORE_SRCS)directly fromkernel/kernel.mk, eliminating the 41-entry duplicated list inMakefile.HOST_COMMON_CXXFLAGSandHOST_COMMON_LDFLAGS, and deduplicated the ASan/UBSan and gcov host compile/link rules viadefine_host_variant.tests/host,tests/host/mocks, andkernel/shell/teststocompile_commands.jsonprerequisites so newly added auto-discovered tests refresh the compilation database automatically.docs/07-contributing-and-debugging.mdanddocs/08-testing-and-ci.mdto reflect auto-discovery andKERNEL_CORE_SRCS.Breaking Changes
None
Verification & Quality Gates
make clean && make -j"$(nproc)" allbuilds cleanly underaarch64-linux-gnu-g++(-std=c++20 -Werror)make clean-tests && make -j"$(nproc)" qualitypassesformat-check,license-check,lint-report(clang-tidyacross 140 TUs, 0 issues), andtest-hostcompile_commands.jsonentriesChecklist