Consejos y trucos de GNU Make

Tengo 2 peque帽os trucos 煤nicos que utilizo para crear archivos y me gustar铆a compartirlos, aqu铆 est谩n …

Pregunte “s铆” antes de continuar

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 $(subst -ask,,[email protected])? (yes/NO) ") == "yes")'

Espere unos segundos antes de reiniciar, permite que el operador cancele mediante 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=$(subst -rwait,,[email protected]);filter(lambda i: (sys.stdout.write("will restart system in %sn" % (n-i)) or time.sleep(1)), range(n)) or sys.stdout.write("restarting ...n")'