nuovo sito fatto con pelican
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 3.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. PY?=python3
  2. PELICAN?=pelican
  3. PELICANOPTS=
  4. BASEDIR=$(CURDIR)
  5. INPUTDIR=$(BASEDIR)/content
  6. OUTPUTDIR=$(BASEDIR)/output
  7. CONFFILE=$(BASEDIR)/pelicanconf.py
  8. PUBLISHCONF=$(BASEDIR)/publishconf.py
  9. SSH_HOST=abbiamoundominio.org
  10. SSH_PORT=22
  11. SSH_USER=${USER}
  12. SSH_TARGET_DIR=/var/www/unit.abbiamoundominio.org/
  13. DEBUG ?= 0
  14. ifeq ($(DEBUG), 1)
  15. PELICANOPTS += -D
  16. endif
  17. RELATIVE ?= 0
  18. ifeq ($(RELATIVE), 1)
  19. PELICANOPTS += --relative-urls
  20. endif
  21. help:
  22. @echo 'Makefile for a pelican Web site '
  23. @echo ' '
  24. @echo 'Usage: '
  25. @echo ' make html (re)generate the web site '
  26. @echo ' make clean remove the generated files '
  27. @echo ' make regenerate regenerate files upon modification '
  28. @echo ' make publish generate using production settings '
  29. @echo ' make serve [PORT=8000] serve site at http://localhost:8000'
  30. @echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 '
  31. @echo ' make devserver [PORT=8000] serve and regenerate together '
  32. @echo ' make ssh_upload upload the web site via SSH '
  33. @echo ' make rsync_upload upload the web site via rsync+ssh '
  34. @echo ' make production copy the site locally '
  35. @echo ' '
  36. @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html '
  37. @echo 'Set the RELATIVE variable to 1 to enable relative urls '
  38. @echo ' '
  39. html:
  40. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  41. clean:
  42. [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
  43. regenerate:
  44. $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  45. serve:
  46. ifdef PORT
  47. $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT)
  48. else
  49. $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  50. endif
  51. serve-global:
  52. ifdef SERVER
  53. $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b $(SERVER)
  54. else
  55. $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b 0.0.0.0
  56. endif
  57. devserver:
  58. ifdef PORT
  59. $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT)
  60. else
  61. $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  62. endif
  63. publish:
  64. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
  65. ssh_upload: publish
  66. scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
  67. rsync_upload: publish
  68. rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --cvs-exclude --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
  69. HOST=$(shell hostname)
  70. production: publish
  71. ifeq ($(HOST),$(filter $(HOST),zaphoda zaphoda-dev))
  72. rsync --update --delete -avz $(OUTPUTDIR)/ $(SSH_TARGET_DIR)
  73. else
  74. @echo "devi essere su zaphoda per lanciare questo comando"
  75. endif
  76. .PHONY: html help clean regenerate serve serve-global devserver stopserver publish ssh_upload rsync_upload