Heuzef - Les notes excentriques d'un bidouilleur.
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

89 lines
3.1 KiB

  1. PY?=
  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=localhost
  10. SSH_PORT=22
  11. SSH_USER=heuzef
  12. SSH_TARGET_DIR=/var/www/html
  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. SERVER ?= "0.0.0.0"
  22. PORT ?= 0
  23. ifneq ($(PORT), 0)
  24. PELICANOPTS += -p $(PORT)
  25. endif
  26. help:
  27. @echo 'Makefile for a pelican Web site '
  28. @echo ' '
  29. @echo 'Usage: '
  30. @echo ' make html (re)generate the web site '
  31. @echo ' make clean remove the generated files '
  32. @echo ' make regenerate regenerate files upon modification '
  33. @echo ' make publish generate using production settings '
  34. @echo ' make serve [PORT=8000] serve site at http://localhost:8000'
  35. @echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 '
  36. @echo ' make devserver [PORT=8000] serve and regenerate together '
  37. @echo ' make devserver-global regenerate and serve on 0.0.0.0 '
  38. @echo ' make ssh_upload upload the web site via SSH '
  39. @echo ' make sftp_upload upload the web site via SFTP '
  40. @echo ' make rsync_upload upload the web site via rsync+ssh '
  41. @echo ' '
  42. @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html '
  43. @echo 'Set the RELATIVE variable to 1 to enable relative urls '
  44. @echo ' '
  45. html:
  46. "$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)
  47. clean:
  48. [ ! -d "$(OUTPUTDIR)" ] || rm -rf "$(OUTPUTDIR)"
  49. regenerate:
  50. "$(PELICAN)" -r "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)
  51. serve:
  52. "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)
  53. serve-global:
  54. "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -b $(SERVER)
  55. devserver:
  56. "$(PELICAN)" -lr "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)
  57. devserver-global:
  58. $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -b 0.0.0.0
  59. publish:
  60. "$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(PUBLISHCONF)" $(PELICANOPTS)
  61. ssh_upload: publish
  62. scp -P $(SSH_PORT) -r "$(OUTPUTDIR)"/* "$(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)"
  63. sftp_upload: publish
  64. printf 'put -r $(OUTPUTDIR)/*' | sftp $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
  65. rsync_upload: publish
  66. rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --include tags --cvs-exclude --delete "$(OUTPUTDIR)"/ "$(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)"
  67. .PHONY: html help clean regenerate serve serve-global devserver publish ssh_upload rsync_upload