3 ms·
I've got a similar setup but just .PHONY: help help: ## Display this help @grep -E '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BE
by donatj 5y ago
I've got a similar setup but just
.PHONY: help
help: ## Display this help
@grep -E '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-30s %s\n", $$1, $$2}'
This was from HN a couple years ago
- coreyp_1 5y agoI've been on HN for years, but missed this. Thank you!
- giantrobot 5y agoAh yes, summon Cthulhu to explain the makefile to you. Seems extreme to me but some people have SAN to spare.
- deleted 5y ago[deleted]
- nerdponx 5y agoI wouldn't exactly call replacing AWK with Sed a "simplification". And now you have a stew of escaped $s. Invoking `tput` is a good idea, though; maybe you can use the AWK `system()` function for that.
- andrewshadura 5y agoJust grep would be enough
- andrewshadura 5y agoWell, grep would look a bit uglier, sed would be better.
- urda 5y agoYeah I ended up with my own variant from here as well many moons ago: .PHONY: help help: # Show this help screen @ack '^[a-zA-Z_-]+:.*?# .*$$' $(MAKEFILE_LIST) |\ sort -k1,1 |\ awk 'BEGIN {FS = ":.*?# "}; {printf "\033[1m%-30s\033[0m %s\n", $$1, $$2}'
- technimad 5y agoI’ve been doing that as well. Here [1] a more elaborate example, might be the original article. [1] https://www.thapaliya.com/en/writings/well-documented-makefiles/ https://www.thapaliya.com/en/writings/well-documented-makefi...