Skip to content

Instantly share code, notes, and snippets.

@developer-guy
Created July 28, 2021 11:15
Show Gist options
  • Save developer-guy/2734d66bdec7a66f13bd57150780fcbb to your computer and use it in GitHub Desktop.
Save developer-guy/2734d66bdec7a66f13bd57150780fcbb to your computer and use it in GitHub Desktop.
A Makefile target that allows us to display all the targets within the Makefile
.DEFAULT_GOAL := help
.PHONY: help
help:
@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment