I\'ve used rake a bit (a Ruby make program), and it has an option to get a list of all the available targets, eg
> rake --tasks
rake db:charset # ret
My favorite answer to this was posted by Chris Down at Unix & Linux Stack Exchange. I'll quote.
This is how the bash completion module for
makegets its list:make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}'It prints out a newline-delimited list of targets, without paging.
User Brainstone suggests piping to sort -u to remove duplicate entries:
make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}' | sort -u
Source: How to list all targets in make? (Unix&Linux SE)