Makefile: context-aware make help (root + per-package)#7250
Merged
Conversation
make help (+ help-<topic>)make help (root + per-package)
th0ma7
marked this pull request as ready for review
July 1, 2026 23:43
Contributor
Author
|
@hgy59 and @mreid-tt if you have a few cycles to spare and tryout using Yet to validate are all the spksrc's root directory recipe that I almost never use... but otherwise running Feedback welcomed |
th0ma7
force-pushed
the
mk-make-help
branch
2 times, most recently
from
July 2, 2026 10:48
5c90921 to
fce7101
Compare
Running `make` at the spksrc root, or tab-completing, only lists bare target names with no explanation. Add a `help` target that prints the documented targets grouped by section, plus `make help-<topic>` to filter by section or name (e.g. `make help-clean`, `make help-toolchain`). The listing is generated from `##@ Section` headers and trailing `## description` comments on the targets themselves, so it never drifts out of sync — and only documented targets appear, which naturally hides internal hook targets (pre_*, post_*, *_msg). A "Per-package (pattern) targets" note explains the `<spk>` / `spk-<spk>-<arch>` / `native-<name>` / `toolchain-<arch>` forms that can't be listed literally. `make` with no target still builds `all` as before; no target behaviour changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extend the help feature to package directories: `make help` run from a cross/, spk/, native/, toolchain/ or kernel/ package now prints the targets relevant to that context, via a new spksrc.common/help.mk included by spksrc.common.mk. - cross/ and spk/: build lifecycle (download -> ... -> install [-> plist]), the multi-arch targets (arch-<arch>, all-supported, all-latest, supported, latest) with a reminder that they need `make setup` at the root first, and maintenance (clean, smart-clean, digests). - native/: same lifecycle minus plist, no arch matrix (single host build). - toolchain/ and kernel/: minimal all + maintenance (their pipeline differs). The target is only defined when the parent directory is one of those trees, so it never collides with the orchestration help in the root Makefile (which pulls in spksrc.common.mk transitively via tests.mk). An include guard avoids "overriding recipe" warnings when common.mk is included more than once. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a "Discovering targets (make help)" subsection to the build-workflow guide explaining the context-aware root vs per-package help and `make help-<topic>`, and list the new spksrc.common/help.mk in the makefile-system reference. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Root Makefile now includes spksrc.common.mk explicitly instead of relying on tests.mk to pull it in transitively (tests.mk is still evolving). - Package help: correct the multi-arch target to arch-<arch>-<tcvers> (e.g. arch-x64-7.1); add an Inspect section with dependency-tree (all contexts) and a Python wheels section (spk only: wheel, download-wheels, crossenv, crossenv-install-<w>). Widen the columns to fit the longer names. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
help.mk was included before 'default: all' in common.mk, so the help target became the first target and thus the default goal - running 'make', 'make all' without a goal, or a recursive arch build printed the help instead of building. Move the help.mk include after 'default: all' so the build stays the default. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Only list targets that actually exist: drop the bare `supported`/`latest` (only `all-supported`/`all-latest` exist); add `dependency-flat` and `dependency-list` next to `dependency-tree`. - Note that `all` and every `<step>` except download/digests need ARCH=<arch> TCVERSION=<tcvers> (and smart-clean too), for cross/spk/kernel/diyspk. - Cover the missing contexts: toolkit (was absent), diyspk (like spk), and python (built only as an spk dependency - no direct build); toolchain/toolkit show `download` + `tc_vars`/`tk_vars` instead of the full pipeline. - Root Makefile: widen columns so `setup-synocommunity` aligns, and fix the pattern target to `spk-<spk>-<arch>-<tcversion>`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…intenance - diyspk now shows the Multi-arch section (all-supported/all-latest) like spk; everything applicable to spk applies to diyspk. - Python wheels section only for spk/diyspk packages that set PYTHON_PACKAGE or are python3*, and lists the real targets: wheel-<arch>-<tcvers>, crossenv-<arch>-<tcvers>, download-wheels, wheelclean, crossenvclean, with a note about WHEELS="pkg==ver" on-demand (bare wheel/crossenv are not entry points). - Add `download` explicitly under Maintenance everywhere (moved out of the toolchain/toolkit Build block). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
HELP_PYTHON used := (immediate), so it was evaluated when help.mk was parsed via 'include spksrc.common.mk' - before packages that set PYTHON_PACKAGE *after* that include (e.g. spk/borgbackup). The wheels section was then gated out at parse time and never shown. Make HELP_PYTHON deferred (=) and move the gate into a recipe-time shell conditional so PYTHON_PACKAGE is seen regardless of include order. Also add the missing wheelcleancache and crossenvcleanall targets, and reword the WHEELS header to explain that WHEELS="pkg1==ver pkg2==ver ..." restricts the (re)build while leaving it unset rebuilds all wheels or the default crossenv. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move clean/smart-clean into their own Cleanup section; keep download and digests under Maintenance. Note that digests auto-runs download, and that refreshing digests needs 'make clean' plus deleting the distrib/ file to force a re-download. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The rustup passthrough (make rustup <args>, e.g. make rustup show) inspects and manages the shared rust toolchain and resolves in every buildable context (cross, spk, diyspk, native, toolchain, toolkit, kernel) via spksrc.rules.mk. Add it to the context-aware Build help (the python context has no direct build, so it is naturally excluded). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- build-rules.md: complete the cross/spk target tables to match the context-aware make help (arch-<arch>-<tcvers>, all-supported/all-latest, dependency-tree/flat/list, smart-clean, digests, rustup, and the Python wheel/crossenv targets); fix arch-<arch>-<version> -> arch-<arch>-<tcvers>. - build-rules.md: fix the mislabelled include - Python wheels use spksrc.python-wheel.mk (or -meson), not spksrc.python-module.mk (which builds a cross-compiled extension); drop the unresolvable 'publish' target. - build-workflow.md: broaden the make help note to all package types and fix arch-<arch> -> arch-<arch>-<tcvers>. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The publish-all-<supported|latest> targets (build + publish every supported or latest arch, from spksrc.spk/publish.mk) are available in spk and diyspk packages but were missing from make help; document them in the Multi-arch section and in build-rules.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
publish-all-<supported|latest> require 'make setup'/'make setup-synocommunity' at the spksrc root first (like the all-* targets), plus PUBLISH_API_KEY. Make that explicit in make help and build-rules.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Review pass over the make-help work:
- help.mk: fix the wheelcleancache description (it only removes the local
work-*/pip cache; it does not include wheelclean nor touch the shared
cache) and add the missing wheelcleanall target (wheelclean +
wheelcleancache + shared distrib/pip cache), matching spksrc.spk.mk.
- help.mk: never activate the package help at the repo root, even when the
checkout lives under a parent directory named like a package tree
(e.g. /home/user/spk/spksrc) which would override the root help.
- Makefile: fix the 'downloads' target iterating over dl but invoking
make -C $${tc} (empty variable) - broken loop now advertised by help.
- docs python.md: wheelcleancache is not a superset of wheelclean; drop the
'increasing scope' wording and describe each clean target accurately.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Make
make helpa first-class, context-aware entry point across spksrc.At the repository root
make helplists the orchestration targets grouped by section (General, Build, Clean, Prepare, Digests, Lint, Toolchain & kernel, Setup), plus the per-package pattern targets (<spk>,spk-<spk>-<arch>-<tcversion>,native-<name>,toolchain-<arch>,kernel-<arch>).make help-<topic>filters by section or name, e.g.make help-clean,make help-toolchain.Inside a package directory
make helpprints the targets relevant to that context, for every tree:cross/,spk/,diyspk/,native/,toolchain/,toolkit/,kernel/andpython/:all,arch-<arch>-<tcvers>(cross/spk/kernel/diyspk), the<step>lifecycle (download → checksum → extract → patch → configure → compile → install [→ plist]), a reminder thatalland every<step>exceptdownloadneedARCH+TCVERSION,tc_vars/tk_vars(toolchain/toolkit) and therustup <args>passthrough (e.g.make rustup show).all-supported,all-latest, pluspublish-all-supported/publish-all-latestfor spk/diyspk (aftermake setup-synocommunity+PUBLISH_API_KEY).PYTHON_PACKAGEor namedpython3*):wheel-<arch>-<tcvers>,crossenv-<arch>-<tcvers>,download-wheels, and the clean setwheelclean/wheelcleancache/wheelcleanall/crossenvclean/crossenvcleanall, with theWHEELS="pkg==ver ..."semantics in the header.dependency-tree/dependency-flat/dependency-list.clean,smart-clean,download,digests(with a note that digests auto-runs download and how to force a refresh).How
Makefile) is generated from##@ Sectionheaders and trailing## descriptioncomments — self-documenting, so it never drifts, and only documented targets appear (internalpre_*/post_*/*_msghooks carry no##and are hidden by construction).help-<topic>uses ahelp-%pattern rule so the topic is never mistaken for a build goal.mk/spksrc.common/help.mk, included byspksrc.common.mkafterdefault: allso the help target can never become the default goal. It only activates when the parent directory is one of the known trees andCURDIR != BASEDIR(so a checkout living under a parent named e.g.spk/cannot shadow the root help). An include guard prevents "overriding recipe" warnings whencommon.mkis included more than once.HELP_PYTHONis a deferred (=) variable checked at recipe time, so the wheels section shows even whenPYTHON_PACKAGEis set afterinclude spksrc.common.mk(e.g. spk/borgbackup).Fixes folded in
downloadstarget looped overdlbut invokedmake -C $${tc}(empty variable) — broken loop, now fixed since help advertises it.build-rules.md(complete cross/spk tables,arch-<arch>-<tcvers>naming, python-wheel vs python-module include fix),build-workflow.md(make help note covering all trees),python.md(accurate wheel-clean target descriptions).Notes
makewith no target still buildsall, at the root and in packages (verified: the help include is parsed afterdefault: all).Example (inside
spk/borgbackup)🤖 Generated with Claude Code