Skip to content

llm instructions: makefiles, reformat local makefile - #76

Merged
landsman merged 7 commits into
mainfrom
devops/makefile-help-groups
Aug 9, 2026
Merged

llm instructions: makefiles, reformat local makefile#76
landsman merged 7 commits into
mainfrom
devops/makefile-help-groups

Conversation

@landsman

@landsman landsman commented Aug 9, 2026

Copy link
Copy Markdown
Owner

worktree-makefile-help-convention rebased onto main. Both commits are real work
here — nothing to drop, unlike #75 — so both are in, one per step.

##@ Group headings in the help output. 30 targets printed as 30 flat lines
with no hint which are checks, which install things and which touch $HOME. awk
instead of grep+sed: same one-liner shape, plus section headings parsed out of
the banner comments that were already there. claude-settings-test moves up into
QA, where qa already called it from — under printed headings it was landing in
"Apps and packages". Verified make help: every target on main today lands under
the right heading, including the ones added since the branch was written.

The convention as a rule, not an AGENTS.md section. Same restructure as
#75: this is about the next Makefile in any project, not about working in this
repo, so it goes to shared/.claude/rules/makefiles.md with a row in the index.
This repo's Makefile stays the worked example rather than a second copy of the
prose.

Scoped with paths:, which makes it the second rule to earn that after GitHub
Actions — and by the criterion CLAUDE.md already states: the trigger is a file
path, and breaking it shows up in a diff. It inherits the gap that rule
documents, a Makefile written from scratch with nothing to read first, and the
index row is the pointer for it. Sentence naming Actions as the only scoped rule
updated to say two.

The help target grepped a flat list, so 30 targets printed as 30 lines with
no hint which of them are checks, which install things and which touch $HOME.
awk instead of grep+sed: same one-liner shape, plus '##@ Group' section
headings parsed out of the banner comments that were already there.

claude-settings-test moves up into QA, where it belongs and where qa already
called it from - under printed headings it was landing in 'Apps and packages'.
@landsman landsman changed the title devops: group the make help output, and write the convention down llm instructions: makefiles, reformat local makefile Aug 9, 2026
@landsman

landsman commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

Reviewed the branch against BSD awk + Make 3.81 on macOS and gawk / mawk /
original-awk + Make 4.3 on Ubuntu 24.04, plus /bin/sh=dash. Byte-identical
output everywhere; \033 renders in all four awks; colour gating verified both
ways (escapes under a pty, none when piped); alignment identical tty vs not,
because the escapes are zero-width and %-22s pads only $1. make qa green.
All 20 documented targets print, none twice, each under the right heading.
Nothing in .github/workflows/ or any *.test.sh parses help output.

Fixed in b31ce81, all three in the doc I wrote, none in the Makefile:

  • The example block put ##@ Quality assurance / lint: above help:,
    three lines under the rule saying help must be the first target. Copied
    literally it would have caused the exact failure the rule exists to prevent.
  • "Set .DEFAULT_GOAL := help instead when it cannot be first" was an
    either/or, but this Makefile does both — help first at line 32 and
    .DEFAULT_GOAL at 368. Now says as well, not instead, with the reason: it is
    what keeps bare make working the day a target lands above help.
  • "Three checks that each answer does it parse" named stow-test, which
    parses nothing, and omitted claude-settings-test, which does. Four checks
    wanting the name test is the actual reason for the prefixes.

Also reflowed two comment blocks that the ##@ hoist left ragged at lines 100
and 184 — the QA block got reflowed in the first commit and those two did not,
so the inconsistency was visible in the diff.

Left alone, four latent awk edge cases, none reachable from any line in the file
today: greedy FS = ":.*##" takes the last ## on a line with two; substr($0, 5) assumes the space in ##@ ; the target pattern would match VAR:=x ## y
(every variable here uses :=); %-22s shifts the column past 22 characters
(longest name is 20). The doc now states the parser is naive on purpose and says
to widen it when a real line breaks it, rather than guarding four cases that
have never occurred.

One thing not fixed: 2c00688's subject says makefile where the repo writes
Makefile. Correcting it means amending a pushed commit, which is not worth it —
the branch squash-merges anyway.

@landsman
landsman merged commit e9afaf0 into main Aug 9, 2026
3 checks passed
@landsman
landsman deleted the devops/makefile-help-groups branch August 9, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant