Created
August 18, 2022 16:09
-
-
Save jpbochi/7e6fa7903791d94981d7e33cfdffa572 to your computer and use it in GitHub Desktop.
Makefile - list all available commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: default list | |
default: list | |
list: | |
@echo Available make targets: | |
@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \ | |
| sed -e '0,/^# Files/ d' -e '/^# Not a target:/,+1 d' \ | |
| grep '^[[:alnum:]]' \ | |
| sed 's/:.*//' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More readable version of https://stackoverflow.com/questions/4219255/how-do-you-get-the-list-of-targets-in-a-makefile/26339924#26339924