Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. FTP_HOST=localhost
  10. FTP_USER=anonymous
  11. FTP_TARGET_DIR=/
  12. SSH_HOST=localhost
  13. SSH_PORT=22
  14. SSH_USER=guilmour
  15. SSH_TARGET_DIR=/var/www/
  16. S3_BUCKET=my_s3_bucket
  17. CLOUDFILES_USERNAME=my_rackspace_username
  18. CLOUDFILES_API_KEY=my_rackspace_api_key
  19. CLOUDFILES_CONTAINER=my_cloudfiles_container
  20. DROPBOX_DIR=~/Dropbox/Public/
  21. DEBUG ?= 0
  22. ifeq ($(DEBUG), 1)
  23. PELICANOPTS += -D
  24. endif
  25. help:
  26. @echo 'Makefile for a pelican Web site '
  27. @echo ' '
  28. @echo 'Usage: '
  29. @echo ' make html (re)generate the web site '
  30. @echo ' make clean remove the generated files '
  31. @echo ' make regenerate regenerate files upon modification '
  32. @echo ' make publish generate using production settings '
  33. @echo ' make serve [PORT=8000] serve site at http://localhost:8000'
  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 dropbox_upload upload the web site via Dropbox '
  39. @echo ' make ftp_upload upload the web site via FTP '
  40. @echo ' make s3_upload upload the web site via S3 '
  41. @echo ' make cf_upload upload the web site via Cloud Files'
  42. @echo ' make github upload the web site via gh-pages '
  43. @echo ' '
  44. @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
  45. @echo ' '
  46. html:
  47. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  48. clean:
  49. [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
  50. regenerate:
  51. $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  52. serve:
  53. ifdef PORT
  54. cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)
  55. else
  56. cd $(OUTPUTDIR) && $(PY) -m pelican.server
  57. endif
  58. devserver:
  59. ifdef PORT
  60. $(BASEDIR)/develop_server.sh restart $(PORT)
  61. else
  62. $(BASEDIR)/develop_server.sh restart
  63. endif
  64. stopserver:
  65. kill -9 `cat pelican.pid`
  66. kill -9 `cat srv.pid`
  67. @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
  68. publish:
  69. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
  70. ssh_upload: publish
  71. scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
  72. rsync_upload: publish
  73. rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude
  74. dropbox_upload: publish
  75. cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR)
  76. ftp_upload: publish
  77. lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit"
  78. s3_upload: publish
  79. s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl-public --delete-removed
  80. cf_upload: publish
  81. cd $(OUTPUTDIR) && swift -v -A https://auth.api.rackspacecloud.com/v1.0 -U $(CLOUDFILES_USERNAME) -K $(CLOUDFILES_API_KEY) upload -c $(CLOUDFILES_CONTAINER) .
  82. github: publish
  83. ghp-import $(OUTPUTDIR)
  84. git push origin gh-pages
  85. .PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github