4 ms·
A Makefile that's basically a tool with multiple entry points, like `git'? The one I've got for my current work project has 36 such targets. Some people might h
by tom_ 6y ago
A Makefile that's basically a tool with multiple entry points, like `git'? The one I've got for my current work project has 36 such targets. Some people might have an individual shell script for each one, but this is just what I prefer to do. Everything's conveniently in one file, and it's easy to share code between targets.
The convention I use is for all entry points to be phony targets. Non-entry point phony targets have name starting with _. The helper I can then use is:
@grep -E "^\.PHONY:" Makefile | grep -v ":default" | sed "s/.PHONY:/ /" | grep -v -E "^[[:space:]]*_" | sort
(The two spaces that replace ".PHONY" are just indentation, so the list stands out a bit more visually when scrolling back.)
The phony target named "default" is the default one, that runs the above command, so I don't need to see its name.