Re: [PATCH] Makefile: implement help target
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 28, 2010, 15:33 UTC
- Message-ID
- <7vpqvxubl5.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <c16e8df7c8e9b562ce0e6cd6e543a83779cd2b25.1285684868.git.git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
> How's this for a version without maintenance issues?
Something along these lines would be closer to what I had in mind, actually.
Traditionally a multi-line sed command embed in Makefile has been portability nightmare, which is a bit worrysome.
Isn't there a "makedoc" ala "perldoc" or "javadoc", by the way?
Show 11 quoted lines
> ...
> +#H# Show help for main make targets
> +help:
> + @sed -n -e '/^#H#/ {N'\
> + -e 's/^#H# \(.*\)\n\([a-z0-9_-]*\):.*/\2 \1/p'\
> + -e '}' <Makefile | sort --key=2 | while read target txt;\
> + do \
> + printf "%-20s: %s\n" "$$target" "$$txt"; \
> + done
> --
> 1.7.3.98.g5ad7d