Skip to content

Makefile example. All Makefiles should have "help"

Notifications You must be signed in to change notification settings

hodorrodoh/Makefile

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Makefile

There is a legendary make help target that has been floating around my career.

The idea is that you can add a simple help target to your makefile. Then get make help for free just by adding comments to a target.

example: ## Any double commented target now becomes help!

Sebastian Gryczan

Contributed by @sgryczan.

help:
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
	

Kris Nóva

Contributed by @kris-nova.

.PHONY: help
help:  ## Show help messages for make targets
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'

About

Makefile example. All Makefiles should have "help"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Makefile 100.0%