Skip to content

Instantly share code, notes, and snippets.

@ejmr
Created July 1, 2015 12:50
Show Gist options
  • Save ejmr/00baeff569624a23a676 to your computer and use it in GitHub Desktop.
Save ejmr/00baeff569624a23a676 to your computer and use it in GitHub Desktop.
List all targets of a Makefile from the terminal
#!/bin/sh
#
# Running this script in a directory with a Makefile will print the
# targets in that Makefile, e.g.
#
# $ list-makefile-targets
# all
# clean
# docs
# install
# install-docs
#
# The script uses Perl. Any remotely modern version should suffice.
make -pn | perl -F: -ane 'print "$F[0]\n" if /^\w+\s*:/' | sort | uniq
@artu-hnrq
Copy link

Here there's a good option

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