Makefile 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Gitoyen public web site
  2. # https://gitoyen.net/
  3. #
  4. BASEDIR=$(CURDIR)
  5. OUTPUTDIR=$(BASEDIR)/output
  6. PY=$(shell which python)
  7. GITOYEN_BIN="gitoyen"
  8. SSH_HOST=kilo.gitoyen.net
  9. SSH_TARGET_DIR=/var/www/www.gitoyen.net/
  10. help:
  11. @echo 'Makefile for Gitoyen public web site '
  12. @echo ' '
  13. @echo 'Usage: '
  14. @echo ' make clean remove the generated files '
  15. @echo ' make new create a new gitoyen blog post '
  16. @echo ' make build generate gitoyen static site in ./output dir '
  17. @echo ' make serve generate + serve site at http://localhost:8000'
  18. @echo ' make upload upload the web site via rsync+ssh '
  19. @echo ' '
  20. deps:
  21. @hash $(GITOYEN_BIN) > /dev/null 2>&1 || \
  22. (echo "Please install gitoyen package to continue (make install)"; exit 1)
  23. venv:
  24. @hash virtualenv> /dev/null 2>&1 || \
  25. (echo "Please install virtualenv to continue"; exit 1)
  26. virtualenv -p /usr/bin/python2.7 $(BASEDIR)/.venv
  27. sourcevenv:
  28. @test -f "$(BASEDIR)/.venv/bin/activate" || \
  29. (echo "Python virtualenv not found, please run 'make venv'"; exit 1)
  30. @if [ ${PY} != "$(BASEDIR)/.venv/bin/python" ]; then \
  31. echo "Virtualenv not activated, please run: source $(BASEDIR)/.venv/bin/activate"; \
  32. fi
  33. install: venv sourcevenv
  34. @pip install -e .
  35. build: sourcevenv deps
  36. gitoyen build
  37. clean: sourcevenv deps
  38. gitoyen clean
  39. new: sourcevenv deps
  40. gitoyen new_post
  41. serve: sourcevenv deps
  42. @sensible-browser http://localhost:8000/
  43. gitoyen serve
  44. upload: build
  45. rsync -e ssh -P -rvz --delete $(OUTPUTDIR)/ $(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude
  46. .PHONY: help clean new serve upload install build