Useful Git pre-commit hooks when using Makefiles such as generating documentation in README.md.
It uses Yelp's pre-commit framework for adding git hooks locally.
brew install pre-commit
For operating systems, other than macOS, check the official documentation
cat <<EOF > .pre-commit-config.yaml
- repo: git://github.com/smian/pre-commit-makefile
sha: master
hooks:
- id: makefile-doc
EOF
pre-commit install
If you want to run the checks on-demand (outside of git hooks), run after you when through the setup below:
pre-commit run --all-files --verbose
Define make help
target that outputs a list of targets with documentation. You can follow the self-documenting
Makefile format or take the starter
Makefile undertest/Makefile
.
Add the following markers to the README.md files that are in the same directory as the Makefile:
<!-- START makefile-doc -->
<!-- END makefile-doc -->
makefile-doc
will add or update documentation generated by make help
between the markers in the README.md
files that are located in the same folder as the Makefile.
It will only scan for files named strictly Makefile
in the all directories and insert the documentation into
README.md
files in the same directories.
The code in this repo is licensed under the MIT License.