comparison Makefile @ 0:4cd9b65e10e4

initial import of the pelican based blog
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 28 Jun 2013 08:48:58 +0200
parents
children 48e0e2d8babd
comparison
equal deleted inserted replaced
-1:000000000000 0:4cd9b65e10e4
1 PY=python
2 PELICAN=pelican
3 PELICANOPTS=
4
5 BASEDIR=$(CURDIR)
6 INPUTDIR=$(BASEDIR)/content
7 OUTPUTDIR=$(BASEDIR)/output
8 CONFFILE=$(BASEDIR)/pelicanconf.py
9 PUBLISHCONF=$(BASEDIR)/publishconf.py
10
11 FTP_HOST=localhost
12 FTP_USER=anonymous
13 FTP_TARGET_DIR=/
14
15 SSH_HOST=localhost
16 SSH_PORT=22
17 SSH_USER=dirk
18 SSH_TARGET_DIR=/var/www/htdocs
19
20 S3_BUCKET=my_s3_bucket
21
22 DROPBOX_DIR=~/Dropbox/Public/
23
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 serve site at http://localhost:8000'
33 @echo ' make devserver start/restart develop_server.sh '
34 @echo ' make stopserver stop local server '
35 @echo ' ssh_upload upload the web site via SSH '
36 @echo ' rsync_upload upload the web site via rsync+ssh '
37 @echo ' dropbox_upload upload the web site via Dropbox '
38 @echo ' ftp_upload upload the web site via FTP '
39 @echo ' s3_upload upload the web site via S3 '
40 @echo ' github upload the web site via gh-pages '
41 @echo ' '
42
43
44 html: clean $(OUTPUTDIR)/index.html
45
46 $(OUTPUTDIR)/%.html:
47 $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
48
49 clean:
50 [ ! -d $(OUTPUTDIR) ] || find $(OUTPUTDIR) -mindepth 1 -delete
51
52 regenerate: clean
53 $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
54
55 serve:
56 cd $(OUTPUTDIR) && $(PY) -m pelican.server
57
58 devserver:
59 $(BASEDIR)/develop_server.sh restart
60
61 stopserver:
62 kill -9 `cat pelican.pid`
63 kill -9 `cat srv.pid`
64 @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
65
66 publish:
67 $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
68
69 ssh_upload: publish
70 scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
71
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
75 dropbox_upload: publish
76 cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR)
77
78 ftp_upload: publish
79 lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit"
80
81 s3_upload: publish
82 s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl-public --delete-removed
83
84 github: publish
85 ghp-import $(OUTPUTDIR)
86 git push origin gh-pages
87
88 .PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload github