Created
September 10, 2025 04:25
-
-
Save genevera/3714c20171452e63df7ff1385224cc94 to your computer and use it in GitHub Desktop.
Nice little alias to list out Makefile tasks
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
| #!/usr/bin/env zsh | |
| ################################################################################################## | |
| # I actually have this aliased but since I want anyone to be able to use this | |
| # with a minimum of confusion or abject fuckery this is expressed as a one size fits all function | |
| ################################################################################################## | |
| function makelist { | |
| # on MacOS with gnu make/sed/grep installed via Homebrew (brew install make sed grep) | |
| if [[ $(uname -s) -eq "Darwin" ]] && { command -v ggrep && command -v gmake && command -v gsed } > /dev/null; | |
| then | |
| /opt/homebrew/bin/gmake -rpn | /opt/homebrew/bin/gsed -n -e '/^$/ { n ; /^[^ .#][^ ]*:/p ; }' | egrep --color '^[^ ]*:' | |
| else | |
| # Using GNU make/sed/grep on Linux (or Mac with gmake/gsed/ggrep installed and in PATH): | |
| make -rpn | sed -n -e '/^$/{ n ; /^[^ .#][^ ]*:/p ; }' | grep -E --color '^[^ ]*:'; | |
| fi; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment