Skip to content

Instantly share code, notes, and snippets.

@no1xsyzy
Created December 6, 2017 23:59
Show Gist options
  • Save no1xsyzy/59ee6404c1b5d81311dad90b20fe1c83 to your computer and use it in GitHub Desktop.
Save no1xsyzy/59ee6404c1b5d81311dad90b20fe1c83 to your computer and use it in GitHub Desktop.
make list

Usage:

  1. add to your Makefile
  2. make 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 '^$@$$' |\
xargs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment