Skip to content

standard.mk: help's fixed-width column runs long target names into their descriptions #16

Description

@hunterdsp

Found while auditing doppler's targets — routing local/CI/release through make (doppler-dsp/doppler#602), the same exercise that produced #15. This one is standard.mk's help formatter, not repo config.

The problem

make help collides the target name with its description whenever a name reaches the column width:

  test-examples-python Run the Python example gate (requires pyext)
  test-example-downstream Build the downstream jm example (C only)
  check-docstring-coverage Report docstring coverage across both Python faces
  test-example-downstream-python Build + test the downstream example (Python)

One space separates test-example-downstream (23 chars) from its description — it reads as a single run-on line.

Root cause

help pads to a fixed width:

printf '  %-20s %s\n' "$$t" "$$d"

Any target name ≥ 20 chars overflows the field, leaving only the single literal space between %-20s and %s. 20 is fine for the standard set, but a repo's LOCAL_TARGETS routinely exceed it (doppler has test-example-downstream-python, 30 chars).

Proposal

Auto-size the column to the longest target name, so it can never overflow regardless of a repo's local targets:

@w=0; for t in $(ALL_TARGETS); do [ $${#t} -gt $$w ] && w=$${#t}; done; \
 for t in $(ALL_TARGETS); do \
     $(_STD_DESC); \
     printf '  %-*s  %s\n' "$$w" "$$t" "$$d"; \
 done

%-*s takes the width from its argument; two-space gap after. POSIX sh ($${#t} is portable). No change for repos whose names already fit; long-named repos stop wrapping.

Note this is an org-wide bump: every repo re-vendors standard.mk (its standard-check diffs the vendored copy against the live URL) on next touch. Happy to open the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions