Permalink
Switch branches/tags
hledger-web-1.11.1 hledger-web-1.11 hledger-web-1.10 hledger-web-1.9.2 hledger-web-1.9.1 hledger-web-1.9 hledger-web-1.5.1 hledger-web-1.5 hledger-web-1.4 hledger-web-1.3.2 hledger-web-1.3.1 hledger-web-1.3 hledger-web-1.2 hledger-web-1.1 hledger-web-1.0.1 hledger-web-1.0 hledger-web-0.27 hledger-web-0.26 hledger-web-0.25.1 hledger-web-0.25 hledger-web-0.24.1 hledger-web-0.24 hledger-web-0.23.3 hledger-web-0.23.2 hledger-web-0.23.1 hledger-web-0.23 hledger-web-0.21.3 hledger-web-0_19 hledger-web-0_17_1 hledger-web-0_16_5 hledger-web-0_16_4 hledger-web-0_16_3 hledger-web-0_16_2 hledger-web-0_15_3 hledger-web-0_15_1 hledger{,-vty,-chart}-0_15_1,_hledger-web-0_15_2 hledger-ui-1.11.1 hledger-ui-1.11 hledger-ui-1.10.1 hledger-ui-1.10 hledger-ui-1.9.1 hledger-ui-1.9 hledger-ui-1.5 hledger-ui-1.4 hledger-ui-1.3.1 hledger-ui-1.3 hledger-ui-1.2 hledger-ui-1.1.2 hledger-ui-1.1.1 hledger-ui-1.1 hledger-ui-1.0.5 hledger-ui-1.0.4 hledger-ui-1.0.3 hledger-ui-1.0.2 hledger-ui-1.0.1 hledger-ui-1.0 hledger-ui-0.27.5 hledger-ui-0.27.4 hledger-ui-0.27.3 hledger-ui-0.27.2 hledger-ui-0.27.1 hledger-ui-0.27 hledger-lib-1.11.1 hledger-lib-1.11 hledger-lib-1.10 hledger-lib-1.9.1 hledger-lib-1.9 hledger-lib-1.5.1 hledger-lib-1.5 hledger-lib-1.4 hledger-lib-1.3.2 hledger-lib-1.3.1 hledger-lib-1.3 hledger-lib-1.2 hledger-lib-1.1 hledger-lib-1.0.1 hledger-lib-1.0 hledger-lib-0.27.1 hledger-lib-0.27 hledger-lib-0.26 hledger-lib-0.25.1 hledger-lib-0.25 hledger-lib-0.24.1 hledger-lib-0.24 hledger-lib-0.23.3 hledger-lib-0.23.2 hledger-lib-0.23.1 hledger-lib-0.23 hledger-irr-0.1.1.4 hledger-irr-0.1.1.3 hledger-irr-0.1.1.2 hledger-irr-0.1.1.1 hledger-irr-0.1.1 hledger-api-1.11.1 hledger-api-1.11 hledger-api-1.10 hledger-api-1.9.1 hledger-api-1.9 hledger-api-1.5 hledger-api-1.4
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (64 sloc) 1.95 KB
# Helpers for self-documenting makefiles.
# Based on http://www.cmcrossroads.com/print/article/self-documenting-makefiles
#
# Standard usage:
#
# TARGET: PREREQUISITES $(call def-help,TARGET,HELP)
# ACTIONS
#
# or on multiple lines:
#
# TARGET: PREREQUISITES \
# $(call def-help,TARGET,\
# HELP\
# )
# ACTIONS
#
# Also:
#
# $(call def-help-heading,TITLE,HELP) -- show a section heading
#
# $(call def-help-subheading,TITLE,HELP) -- show a subsection heading
#
# $(call def-help-hide,TARGET,HELP) -- temporarily suppress the help)
# $(call def-help-heading-hide,TITLE,HELP)
# $(call def-help-subheading-hide,TITLE,HELP)
#
# HELP is one or more lines, or can be blank.
# Certain characters are not allowed, comma in particular.
# You may want to avoid ' also as it breaks emacs font-lock.
# if the make targets include "help" or there are no targets, show help
need-help := $(if $(MAKECMDGOALS),$(filter help,$(MAKECMDGOALS)),true)
help:
@echo $(if $(need-help),,Type \'make$(dash-f) help\' to get help)
# show a make target's help when help has been requested
define def-help
$(if $(need-help), $(warning make $1 --$2))
endef
# show a section heading when help has been requested
define def-help-heading
$(if $(need-help),$(warning $1))
endef
# show a subsection heading when help has been requested
define def-help-subheading
$(if $(need-help),$(warning );$(warning $1))
endef
# no-ops, for hiding help without removing it entirely
define def-help-hide
endef
define def-help-heading-hide
endef
define def-help-subheading-hide
endef
# utilities
# define print-lines
# @echo $1
# endef
# $(if $(true),$(printf $1),$(printf '\n'$1))
define last-element
$(word $(words $1),$1)
endef
this-makefile := $(call last-element,$(MAKEFILE_LIST))
other-makefiles := $(filter-out $(this-makefile),$(MAKEFILE_LIST))
parent-makefile := $(call last-element,$(other-makefiles))
dash-f := $(if $(filter-out Makefile makefile GNUmakefile, $(parent-makefile)), -f $(parent-makefile))