Skip to content

Instantly share code, notes, and snippets.

@bbl
Created October 17, 2019 09:03
Show Gist options
  • Save bbl/d453831ff9e19f0fed268a1b2b7ce20b to your computer and use it in GitHub Desktop.
Save bbl/d453831ff9e19f0fed268a1b2b7ce20b to your computer and use it in GitHub Desktop.
Makefile list targets by default
.DEFAULT_GOAL := list
PHONY: list
list:
@$(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