css
javascript
html
python
makefile

Makefile.example 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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] start/restart develop_server.sh '
  35. @echo ' make stopserver stop local server '
  36. @echo ' make ssh_upload upload the web site via SSH '
  37. @echo ' make rsync_upload upload the web site via rsync+ssh '
  38. @echo ' make ftp_upload upload the web site via FTP '
  39. @echo ' make validate validate the web site via html5validator'
  40. @echo ' '
  41. @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html '
  42. @echo 'Set the RELATIVE variable to 1 to enable relative urls '
  43. @echo ' '
  44. generate:
  45. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  46. html: generate vendor
  47. clean:
  48. [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
  49. regenerate:
  50. $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  51. serve:
  52. ifdef PORT
  53. cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)
  54. else
  55. cd $(OUTPUTDIR) && $(PY) -m pelican.server
  56. endif
  57. serve-global:
  58. ifdef SERVER
  59. cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 $(SERVER)
  60. else
  61. cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 0.0.0.0
  62. endif
  63. devserver:
  64. ifdef PORT
  65. $(BASEDIR)/develop_server.sh restart $(PORT)
  66. else
  67. $(BASEDIR)/develop_server.sh restart
  68. endif
  69. vendor:
  70. @bash $(BASEDIR)/scripts/vendor.sh
  71. stopserver:
  72. $(BASEDIR)/develop_server.sh stop
  73. @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
  74. publishconf:
  75. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
  76. publish: publishconf vendor
  77. ssh_upload: publish
  78. scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
  79. rsync_upload: publish
  80. rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude
  81. ftp_upload: publish
  82. lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit"
  83. validate: publish
  84. html5validator --root $(OUTPUTDIR) || html5validator -l --root $(OUTPUTDIR)
  85. .PHONY: html help clean regenerate serve serve-global devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github