Skip to content

Instantly share code, notes, and snippets.

@zonca
Created January 7, 2022 16:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save zonca/fd1980c1aeac394bfc854fce24b9b0df to your computer and use it in GitHub Desktop.
Make list target and pass argument
.PHONY: list
list:
@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 '^$@$$'
echo_arg: # call with i=aaaa
echo $(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment