Skip to content

Instantly share code, notes, and snippets.

@tlrobinson
Created July 9, 2011 19:34
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save tlrobinson/1073865 to your computer and use it in GitHub Desktop.
Save tlrobinson/1073865 to your computer and use it in GitHub Desktop.
Autocomplete Makefile targets. Add this to your shell config file.
complete -W "\`grep -oE '^[a-zA-Z0-9_-]+:([^=]|$)' Makefile | sed 's/[^a-zA-Z0-9_-]*$//'\`" make
@hxgdzyuyi
Copy link

it's broken when Makefile include other makefile

@slava-konashkov
Copy link

slava-konashkov commented Nov 11, 2022

complete -W "`make -qp | sed -n -E 's/^([^.#\s][^:=])(:$|:\s+.$)/\1/p' | sort -u'`" make

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment