Skip to content

Instantly share code, notes, and snippets.

@stenehall
Last active November 4, 2020 15:13
Show Gist options
  • Save stenehall/7d343f548405cd4227b4adc69134b04c to your computer and use it in GitHub Desktop.
Save stenehall/7d343f548405cd4227b4adc69134b04c to your computer and use it in GitHub Desktop.
Makefile sheet cheat
#: This help command
help:
@grep -B1 -E "^[a-zA-Z0-9_-]+\:([^\=]|$$)" Makefile | grep -v -- -- | sed 'N;s/\n/###/' | sed -n 's/^#: \(.*\)###\(.*\):.*/\2###\1/p' | column -t -s '###'
basic:
echo "This is a basic command, it's also the default command"
basicWithoutCommand:
@echo "Now the command isn't echoed"
basicWithVariable:
echo "This is a ${VAR} inputed as VAR=foobar"
withDependency: aDependency
@echo "This is the command withDependency"
aDependency:
@echo "This is a dependency"
#: A command with some help text
aCommandWithHelpText:
@echo "This has a help text"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment