make ls
complex makefiles can be a pain. here’s a quick way to add an ls
target that shows all available targets and what they do.
what this does:
- sets up color codes for pretty output
- creates an
ls
target usingawk
to parse the makefile - prints target names in cyan, followed by descriptions if they exist
- sorts everything alphabetically
how to use it
add some targets to your makefile:
run make ls
and you’ll see:
note:
- targets with
##
comments get descriptions deploy
has no description, so it’s just listed- names are in cyan (you’d see this in your terminal)
- everything’s sorted a-z
this little trick makes it way easier to work with big makefiles. you get a quick view of all your make commands without digging through the file. pretty neat, huh?