Sat, 24 Mar 2018 01:43:02 +0100
[hp8662a] new series on the HP 8662A generator
0 | 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=root | |
18 | SSH_TARGET_DIR=/var/www | |
19 | ||
20 | S3_BUCKET=my_s3_bucket | |
21 | ||
22 | CLOUDFILES_USERNAME=my_rackspace_username | |
23 | CLOUDFILES_API_KEY=my_rackspace_api_key | |
24 | CLOUDFILES_CONTAINER=my_cloudfiles_container | |
25 | ||
26 | DROPBOX_DIR=~/Dropbox/Public/ | |
27 | ||
28 | GITHUB_PAGES_BRANCH=gh-pages | |
29 | ||
30 | DEBUG ?= 0 | |
31 | ifeq ($(DEBUG), 1) | |
32 | PELICANOPTS += -D | |
33 | endif | |
34 | ||
35 | RELATIVE ?= 0 | |
36 | ifeq ($(RELATIVE), 1) | |
37 | PELICANOPTS += --relative-urls | |
38 | endif | |
39 | ||
40 | help: | |
41 | @echo 'Makefile for a pelican Web site ' | |
42 | @echo ' ' | |
43 | @echo 'Usage: ' | |
44 | @echo ' make html (re)generate the web site ' | |
45 | @echo ' make clean remove the generated files ' | |
46 | @echo ' make regenerate regenerate files upon modification ' | |
47 | @echo ' make publish generate using production settings ' | |
48 | @echo ' make serve [PORT=8000] serve site at http://localhost:8000' | |
49 | @echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 ' | |
50 | @echo ' make devserver [PORT=8000] start/restart develop_server.sh ' | |
51 | @echo ' make stopserver stop local server ' | |
52 | @echo ' make ssh_upload upload the web site via SSH ' | |
53 | @echo ' make rsync_upload upload the web site via rsync+ssh ' | |
54 | @echo ' make dropbox_upload upload the web site via Dropbox ' | |
55 | @echo ' make ftp_upload upload the web site via FTP ' | |
56 | @echo ' make s3_upload upload the web site via S3 ' | |
57 | @echo ' make cf_upload upload the web site via Cloud Files' | |
58 | @echo ' make github upload the web site via gh-pages ' | |
59 | @echo ' ' | |
60 | @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html ' | |
61 | @echo 'Set the RELATIVE variable to 1 to enable relative urls ' | |
62 | @echo ' ' | |
63 | ||
64 | html: | |
65 | $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) | |
66 | ||
67 | clean: | |
68 | [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR) | |
69 | ||
70 | regenerate: | |
71 | $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) | |
72 | ||
73 | serve: | |
74 | ifdef PORT | |
75 | cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT) | |
76 | else | |
77 | cd $(OUTPUTDIR) && $(PY) -m pelican.server | |
78 | endif | |
79 | ||
80 | serve-global: | |
81 | ifdef SERVER | |
82 | cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 $(SERVER) | |
83 | else | |
84 | cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 0.0.0.0 | |
85 | endif | |
86 | ||
87 | ||
88 | devserver: | |
89 | ifdef PORT | |
90 | $(BASEDIR)/develop_server.sh restart $(PORT) | |
91 | else | |
92 | $(BASEDIR)/develop_server.sh restart | |
93 | endif | |
94 | ||
95 | stopserver: | |
96 | $(BASEDIR)/develop_server.sh stop | |
97 | @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.' | |
98 | ||
99 | publish: | |
100 | $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS) | |
101 | ||
102 | ssh_upload: publish | |
103 | scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) | |
104 | ||
105 | rsync_upload: publish | |
106 | rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude | |
107 | ||
108 | dropbox_upload: publish | |
109 | cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR) | |
110 | ||
111 | ftp_upload: publish | |
112 | lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit" | |
113 | ||
114 | s3_upload: publish | |
115 | s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl-public --delete-removed --guess-mime-type | |
116 | ||
117 | cf_upload: publish | |
118 | cd $(OUTPUTDIR) && swift -v -A https://auth.api.rackspacecloud.com/v1.0 -U $(CLOUDFILES_USERNAME) -K $(CLOUDFILES_API_KEY) upload -c $(CLOUDFILES_CONTAINER) . | |
119 | ||
120 | github: publish | |
121 | ghp-import -m "Generate Pelican site" -b $(GITHUB_PAGES_BRANCH) $(OUTPUTDIR) | |
122 | git push origin $(GITHUB_PAGES_BRANCH) | |
123 | ||
124 | .PHONY: html help clean regenerate serve serve-global devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github |