Last active
December 25, 2022 14:26
-
-
Save divan/b7487ac30dcb566bc0a12b9b22ff3dc3 to your computer and use it in GitHub Desktop.
Make help
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
.PHONY: help | |
# This is a code for automatic help generator. | |
# It supports ANSI colors and categories. | |
# To add new item into help output, simply add comments | |
# starting with '##'. To add category, use @category. | |
GREEN := $(shell tput -Txterm setaf 2) | |
WHITE := $(shell tput -Txterm setaf 7) | |
YELLOW := $(shell tput -Txterm setaf 3) | |
RESET := $(shell tput -Txterm sgr0) | |
HELP_FUN = \ | |
%help; \ | |
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \ | |
print "Usage: make [target]\n\n"; \ | |
for (sort keys %help) { \ | |
print "${WHITE}$$_:${RESET}\n"; \ | |
for (@{$$help{$$_}}) { \ | |
$$sep = " " x (32 - length $$_->[0]); \ | |
print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \ | |
}; \ | |
print "\n"; \ | |
} | |
help: ##@other Show this help | |
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST) | |
# Main targets | |
cmd: ##@build Build main command | |
true | |
lib: ##@build Build library | |
true | |
android: ##@cross-compile Build for Android | |
true | |
ios: ##@cross-compile Build for iOS | |
true | |
ios-sim: ##@cross-compile Build for iOS simulator | |
true | |
lint: ##@other Run meta linter on code | |
true | |
test: ##@other Run tests | |
true | |
generate: ##@other Regenerate assets | |
true | |
ensure: ##@other Ensure dependencies | |
true | |
docker: ##@deploy Build docker container | |
true | |
push: ##@deploy Push docker container | |
true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment