css
html
javascript
python
makefile

Makefile.example 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. FTP_HOST=********
  10. FTP_USER=********
  11. FTP_TARGET_DIR=********
  12. SSH_HOST=localhost
  13. SSH_PORT=22
  14. SSH_USER=root
  15. SSH_TARGET_DIR=/var/www
  16. DEBUG ?= 0
  17. ifeq ($(DEBUG), 1)
  18. PELICANOPTS += -D
  19. endif
  20. RELATIVE ?= 0
  21. ifeq ($(RELATIVE), 1)
  22. PELICANOPTS += --relative-urls
  23. endif
  24. help:
  25. @echo 'Makefile for a pelican Web site '
  26. @echo ' '
  27. @echo 'Usage: '
  28. @echo ' make html (re)generate the web site '
  29. @echo ' make clean remove the generated files '
  30. @echo ' make regenerate regenerate files upon modification '
  31. @echo ' make publish generate using production settings '
  32. @echo ' make serve [PORT=8000] serve site at http://localhost:8000 '
  33. @echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 '
  34. @echo ' make devserver [PORT=8000] serve and regenerate together '
  35. @echo ' make ssh_upload upload the web site via SSH '
  36. @echo ' make rsync_upload upload the web site via rsync+ssh '
  37. @echo ' make ftp_upload upload the web site via FTP '
  38. @echo ' make validate validate the web site via html5validator'
  39. @echo ' '
  40. @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html '
  41. @echo 'Set the RELATIVE variable to 1 to enable relative urls '
  42. @echo ' '
  43. generate:
  44. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  45. html: generate vendor
  46. clean:
  47. [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
  48. regenerate:
  49. $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  50. serve:
  51. ifdef PORT
  52. $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT)
  53. else
  54. $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  55. endif
  56. serve-global:
  57. ifdef SERVER
  58. $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b $(SERVER)
  59. else
  60. $(PELICAN) -l $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b 0.0.0.0
  61. endif
  62. devserver:
  63. ifdef PORT
  64. $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT)
  65. else
  66. $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  67. endif
  68. vendor:
  69. @bash $(BASEDIR)/scripts/vendor.sh
  70. stopserver:
  71. $(BASEDIR)/develop_server.sh stop
  72. @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
  73. publishconf:
  74. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
  75. publish: publishconf vendor
  76. ssh_upload: publish
  77. scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
  78. rsync_upload: publish
  79. rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude
  80. ftp_upload: publish
  81. lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit"
  82. validate: publish
  83. html5validator --root $(OUTPUTDIR) || html5validator -l --root $(OUTPUTDIR)
  84. .PHONY: html help clean regenerate serve serve-global devserver publish ssh_upload rsync_upload ftp_upload