3 ms·
The `sed` and `grep` syntax isn't always portable to non-Gnu versions of the tools. The following version doesn't use gnu-isms for `grep` and `awk` for and wor
by zdw 6y ago
The `sed` and `grep` syntax isn't always portable to non-Gnu versions of the tools. The following version doesn't use gnu-isms for `grep` and `awk` for and works on both BSD's and MacOS, sorting and printing comments printed after the ##. Does require on Gnu make for $(MAKEFILE_LIST), but the filename of the Makefile can be used instead:
help: ## Print help for each target
@grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
| sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'