github.com/codeready-toolchain/api@v0.0.0-20240507023248-73662d6db2c5/make/help.mk (about)

     1  .PHONY: help
     2  # Based on https://gist.github.com/rcmachado/af3db315e31383502660
     3  ## Display this help text
     4  help:/
     5  	$(info Available targets)
     6  	$(info -----------------)
     7  	@awk '/^[a-zA-Z\-%\_0-9]+:/ { \
     8  		helpMessage = match(lastLine, /^## (.*)/); \
     9  		helpCommand = substr($$1, 0, index($$1, ":")-1); \
    10  		if (helpMessage) { \
    11  			helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
    12  			gsub(/##/, "\n                                     ", helpMessage); \
    13  			printf "%-35s - %s\n", helpCommand, helpMessage; \
    14  			lastLine = "" \
    15  		} \
    16  	} \
    17  	{ hasComment = match(lastLine, /^## (.*)/); \
    18            if(hasComment) { \
    19              lastLine=lastLine$$0; \
    20  	  } \
    21            else { \
    22  	    lastLine = $$0 \
    23            } \
    24          }' $(MAKEFILE_LIST)