GNU Make Tips & Tricks

I have 2 little unique tricks that I use in make files and would like to share, here they are …

Ask for “yes” before proceeding

install: do-install production-deploy 

do-install: #... all deps
gcc ...

production-deploy: production-ask
rm -fr /

%-ask:
@python -c 'raise SystemExit(not raw_input("All Done! Are you sure you want to install to $*? (yes/NO) ") == "yes")'

Wait a few seconds before restarting, allows for operator cancel via Ctrl-C

install: do-install production-restart

do-install: #... all deps
gcc ...

production-restart: 5-rwait
sudo reboot

%-rwait:
@python -c 'import sys,time;n=$*;filter(lambda i: (sys.stdout.write("will restart system in %s\n" % (n-i)) or time.sleep(1)), range(n)) or sys.stdout.write("restarting ...\n")'

I have 2 little unique tricks that I use in make files and would like to share, here they are … Ask for “yes” before proceeding install: do-install production-deploy do-install: #… all deps gcc … production-deploy: production-ask rm -fr / %-ask: @python -c ‘raise SystemExit(not raw_input(“All Done! Are you sure you want to install to…