The source code for my blog at wxcafe.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

89 lines
3.0 KiB

  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=root
  15. SSH_TARGET_DIR=/var/www
  16. S3_BUCKET=my_s3_bucket
  17. DROPBOX_DIR=~/Dropbox/Public/
  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 serve site at http://localhost:8000'
  27. @echo ' make devserver start/restart develop_server.sh '
  28. @echo ' make stopserver stop local server '
  29. @echo ' ssh_upload upload the web site via SSH '
  30. @echo ' rsync_upload upload the web site via rsync+ssh '
  31. @echo ' dropbox_upload upload the web site via Dropbox '
  32. @echo ' ftp_upload upload the web site via FTP '
  33. @echo ' s3_upload upload the web site via S3 '
  34. @echo ' github upload the web site via gh-pages '
  35. @echo ' '
  36. html: clean $(OUTPUTDIR)/index.html
  37. $(OUTPUTDIR)/%.html:
  38. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  39. clean:
  40. [ ! -d $(OUTPUTDIR) ] || find $(OUTPUTDIR) -mindepth 1 -delete
  41. regenerate: clean
  42. $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
  43. serve:
  44. cd $(OUTPUTDIR) && $(PY) -m pelican.server
  45. devserver:
  46. $(BASEDIR)/develop_server.sh restart
  47. stopserver:
  48. kill -9 `cat pelican.pid`
  49. kill -9 `cat srv.pid`
  50. @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
  51. publish:
  52. $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
  53. ssh_upload: publish
  54. scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
  55. rsync_upload: publish
  56. rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude
  57. dropbox_upload: publish
  58. cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR)
  59. ftp_upload: publish
  60. lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit"
  61. s3_upload: publish
  62. s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl-public --delete-removed
  63. github: publish
  64. ghp-import $(OUTPUTDIR)
  65. git push origin gh-pages
  66. .PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload github