Created
March 31, 2013 22:43
-
-
Save deryni/5282307 to your computer and use it in GitHub Desktop.
My version of the self-documenting makefile trick. Haven't used this too thoroughly yet so I'm not sure what I think of it but it seems ok so far. It was built for use in a project that doesn't have a meaningful 'all' target. It would probably want the filter changed back to something more like in the original for use in a more normal project.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Modified version of http://www.cmcrossroads.com/article/self-documenting-makefiles | |
all: | |
@printf -- "$(HELPTGT)\n$(ETCTGT)\n" | column -t -s : | |
HELPTGT := --- Primary Targets --- | |
helptgt = $1$(eval $(if $(filter-out $(.DEFAULT_GOAL),$(MAKECMDGOALS)),,HELPTGT+=\n$(subst %,<name>,$1): - $2)) | |
ETCTGT := --- Extra Targets --- | |
etctgt = $1$(eval $(if $(filter-out $(.DEFAULT_GOAL),$(MAKECMDGOALS)),,ETCTGT+=\n$1: - $2)) | |
# Usage: | |
# $(call etctgt,clean,Cleans all build products.): | |
# @rm -rf build/* | |
# | |
# $(call helptgt,build/%.tar.gz,Generate release tarball.): src/%.c src/%.h | |
# @tar -czf $@ $^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment