Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. PY?=python
  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. GITHUB_PAGES_BRANCH=master
  10. DEBUG ?= 0
  11. ifeq ($(DEBUG), 1)
  12. PELICANOPTS += -D
  13. endif
  14. RELATIVE ?= 0
  15. ifeq ($(RELATIVE), 1)
  16. PELICANOPTS += --relative-urls
  17. endif
  18. help:
  19. @echo 'Makefile for a pelican Web site '
  20. @echo ' '
  21. @echo 'Usage: '
  22. @echo ' make html (re)generate the web site '
  23. @echo ' make clean remove the generated files '
  24. @echo ' make regenerate regenerate files upon modification '
  25. @echo ' make publish generate using production settings '
  26. @echo ' make serve [PORT=8000] serve site at http://localhost:8000'
  27. @echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 '
  28. @echo ' make devserver [PORT=8000] start/restart develop_server.sh '
  29. @echo ' make stopserver stop local server '
  30. @echo ' make install upload the web site via gh-pages '
  31. @echo ' '
  32. @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html '
  33. @echo 'Set the RELATIVE variable to 1 to enable relative urls '
  34. @echo ' '
  35. html:
  36. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  37. clean:
  38. [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
  39. regenerate:
  40. $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  41. serve:
  42. ifdef PORT
  43. cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)
  44. else
  45. cd $(OUTPUTDIR) && $(PY) -m pelican.server
  46. endif
  47. serve-global:
  48. ifdef SERVER
  49. cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 $(SERVER)
  50. else
  51. cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 0.0.0.0
  52. endif
  53. devserver:
  54. ifdef PORT
  55. $(BASEDIR)/develop_server.sh restart $(PORT)
  56. else
  57. $(BASEDIR)/develop_server.sh restart
  58. endif
  59. stopserver:
  60. $(BASEDIR)/develop_server.sh stop
  61. @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
  62. publish:
  63. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
  64. install: publish
  65. git checkout $(GITHUB_PAGES_BRANCH)
  66. cp --force --recursive $(OUTPUTDIR)/* $(CURDIR)/
  67. git add .
  68. git commit -m "Generate Pelican site"
  69. git push origin $(GITHUB_PAGES_BRANCH)
  70. .PHONY: html help clean regenerate serve serve-global devserver stopserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github