Makefile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. DEBUG ?= 0
  10. ifeq ($(DEBUG), 1)
  11. PELICANOPTS += -D
  12. endif
  13. VERBOSE ?= 0
  14. ifeq ($(VERBOSE), 1)
  15. PELICANOPTS += -v
  16. endif
  17. all: publish
  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 devserver [PORT=8000] start/restart develop_server.sh '
  28. @echo ' make stopserver stop local server '
  29. @echo ' '
  30. @echo 'Set the VERBOSE variable to 1 for some more messages, e.g. make VERBOSE=1 html'
  31. @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
  32. @echo ' '
  33. html:
  34. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  35. clean:
  36. [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
  37. regenerate:
  38. $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  39. serve:
  40. ifdef PORT
  41. cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)
  42. else
  43. cd $(OUTPUTDIR) && $(PY) -m pelican.server
  44. endif
  45. devserver:
  46. ifdef PORT
  47. $(BASEDIR)/develop_server.sh restart $(PORT)
  48. else
  49. $(BASEDIR)/develop_server.sh restart
  50. endif
  51. stopserver:
  52. kill -9 `cat pelican.pid`
  53. kill -9 `cat srv.pid`
  54. @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
  55. publish:
  56. $(PELICAN) $(INPUTDIR) --ignore-cache -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
  57. autopublish:
  58. while true; do inotifywait -r content pelicanconf.py publishconf.py Makefile themes -e modify -e create -e delete; make clean publish; sleep 0.1; done
  59. .PHONY: html help clean regenerate serve devserver publish