Skip to content

Instantly share code, notes, and snippets.

@dspinellis
Last active March 5, 2022 14:16
Show Gist options
  • Save dspinellis/dfaf99c73a3a2f7bed34b3c32cbb7118 to your computer and use it in GitHub Desktop.
Save dspinellis/dfaf99c73a3a2f7bed34b3c32cbb7118 to your computer and use it in GitHub Desktop.
Add a help target for any Makefile
URL=https://www.spinellis.gr/unix
love: # Help: Create a file name love
touch love
money: # Help: Hit the jackpot
yes $$ | fmt | head
me a wizard: MOOC # Help: Become a Unix command-line wizard
MOOC:
@echo "Visit $(URL); Other than that ..."
@(open $(URL) || cygstart $(URL) || kde-open $(URL) || gnome-open $(URL) || :) 2>/dev/null
help: # Help: Show this help message
@echo 'The following make targets are available.'
@sed -n 's/^\([^:]*:\).*# [H]elp: \(.*\)/"%-20s %s\\n" "\1" "\2"/p' Makefile | xargs -n 3 printf | sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment