This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is make-help, a lightweight utility for adding self-documenting help to Makefiles. It works with both GNU Make and BSD Make by detecting which Make variant is available and including the appropriate implementation.
The system has a clever cross-platform design in the mk/ directory:
- mk/help.mk - Entry point that auto-detects GNU Make vs BSD Make using shell test
- mk/help.gnu.mk - GNU Make implementation using
$(MAKEFILE_LIST) - mk/help.bsd.mk - BSD Make implementation using
$(.MAKE.MAKEFILES)
Both implementations:
- Extract
#_#comments from Makefiles usingsed -n 's/^#_#/ /p' - Filter out system files and implementation files (*.bsd.mk, .gnu.mk, /usr/share/mk/)
- Display Makefile names followed by extracted help text
Target documentation uses #_# prefix:
#_# target-name: Description
#_# Additional lines with preserved indentation
#_#
target-name:
commandsThe #_# prefix is replaced with a single space in output, and all formatting/indentation is preserved.
View all documented targets:
make help
# or just
makeRun test suite:
make testsThis runs tests/run (which executes make help) and diffs the output against tests/expected.
The help system intentionally excludes:
*.bsd.mkand*.gnu.mkfiles (implementation files)/usr/share/mk/*(BSD system Makefiles)- Files already processed (GNU Make tracks this separately)
This exclusion logic is tested via the mktest/ directory which contains dummy Makefiles that should not appear in help output.
The test harness is minimal:
tests/runexecutesmake help- Output is compared against
tests/expected - Any diff indicates a regression
When modifying help output format, update tests/expected accordingly.