Skip to content

Instantly share code, notes, and snippets.

@genevera
Created September 10, 2025 04:25
Show Gist options
  • Select an option

  • Save genevera/3714c20171452e63df7ff1385224cc94 to your computer and use it in GitHub Desktop.

Select an option

Save genevera/3714c20171452e63df7ff1385224cc94 to your computer and use it in GitHub Desktop.
Nice little alias to list out Makefile tasks
#!/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