<-- back

Make list targets [memo]

Here is small note about the target I put in every Makefile I have.

The target is called list and looks like this:

.PHONY: list
list:
    @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'

It prints list of all targets defined in your Makefile.

Took it from this brilliant stackoverflow answer


Feel free to contact me for feedback or questions. Find my contacts on About page.