Makefile 919 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. .PHONY: all fill unload withdraw save
  2. check_defined = \
  3. $(foreach 1,$1,$(__check_defined))
  4. __check_defined = \
  5. $(if $(value $1),, \
  6. $(error Expected $1$(if $(value 2), ($(strip $2)))))
  7. all: silos
  8. @git status
  9. silos:
  10. @mkdir silos
  11. @touch silos/.silos
  12. @git init .
  13. @git add silos/.silos
  14. @git commit silos -m "Initial commit"
  15. fill: silos
  16. $(call check_defined, what)
  17. $(call check_defined, into)
  18. @echo "Filling silo $(into) with $(what)..."
  19. @mkdir -p silos/$(into)
  20. mv -vi $(what) silos/$(into)
  21. unload: silos
  22. @echo "Unloading $(silo)..."
  23. $(call check_defined, silo)
  24. @cd silos && stow -S -v $(silo) -t $(HOME) && cd -
  25. withdraw: silos
  26. $(call check_defined, silo)
  27. @echo "Withdrawing $(silo)..."
  28. @cd silos && stow -D -v $(silo) -t $(HOME) && cd -
  29. save: silos/$(silo)
  30. $(call check_defined, silo)
  31. @echo "Saving $(silo)..."
  32. git add silos/$(silo) && git commit silos/$(silo) -m "Update $(silo)"