author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Thu, 04 Aug 2016 15:31:15 +0300 | |
changeset 2001 | 4bebef342260 |
parent 2000 | 7bfe538a4cfe |
child 2003 | aa322acc9627 |
permissions | -rw-r--r-- |
1438
a53df7bd6722
Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1367
diff
changeset
|
1 |
|
a53df7bd6722
Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1367
diff
changeset
|
2 |
################################################################ |
a53df7bd6722
Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1367
diff
changeset
|
3 |
# Standard GNU Makefile settings. |
a53df7bd6722
Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1367
diff
changeset
|
4 |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
5 |
SHELL = /bin/sh |
923
f3b193a0e566
Add work-around for PATH. Under Windows find.exe going in collision with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
905
diff
changeset
|
6 |
export PATH := /bin:/usr/bin:${PATH} |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
7 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
8 |
# Disable built in pattern rules. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
9 |
MAKEFLAGS += -r |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
10 |
# Disable built in variables. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
11 |
MAKEFLAGS += -R |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
12 |
# Disable built in suffix rules. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
13 |
.SUFFIXES: |
1438
a53df7bd6722
Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1367
diff
changeset
|
14 |
# Delete target file if command fails. |
a53df7bd6722
Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1367
diff
changeset
|
15 |
.DELETE_ON_ERROR: |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
16 |
# Default target. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
17 |
.DEFAULT_GOAL = all |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
18 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
19 |
################################################################ |
1030 | 20 |
# Platform definition. |
21 |
||
22 |
host_os := linux |
|
23 |
ifneq '' '$(WINDIR)' |
|
24 |
host_os := cygwin |
|
25 |
endif |
|
26 |
target_os := $(host_os) |
|
27 |
||
28 |
################################################################ |
|
29 |
# Build tool definition/switches. |
|
30 |
||
1110 | 31 |
RST2HTML := rst2html |
1030 | 32 |
ifeq '$(host_os)' 'cygwin' |
1110 | 33 |
RST2HTML := rst2html.py |
1030 | 34 |
endif |
35 |
||
1109
9885f6be80f0
Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1103
diff
changeset
|
36 |
RST_WARNING_FLAGS := --halt warning |
1917
d5967d76dae5
Set initial header level to <h2> explicitly because after removing
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1913
diff
changeset
|
37 |
RST_RENDER_FLAGS := --strip-comments --embed-stylesheet --no-xml-declaration --math-output=MathJax --initial-header-level=2 |
1901
12a7d89c74a9
Add template to generate HTML 5 compliant code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1898
diff
changeset
|
38 |
RST_FLAGS := $(RST_WARNING_FLAGS) $(RST_RENDER_FLAGS) |
1109
9885f6be80f0
Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1103
diff
changeset
|
39 |
|
1030 | 40 |
################################################################ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
41 |
# Proj dirs/files. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
42 |
|
1912
8b81a8f0f692
Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1909
diff
changeset
|
43 |
RST_FILES := $(wildcard *.rst) |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
44 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
45 |
HTML_DIR := tips-html |
1077 | 46 |
RST_HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES)) |
1103
53b2adcc631e
Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1079
diff
changeset
|
47 |
HTML_FILES := $(RST_HTML_FILES) \ |
1893
da0024f4f068
Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1891
diff
changeset
|
48 |
$(HTML_DIR)/index.html $(HTML_DIR)/iframe.html |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
49 |
|
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
50 |
CHM_FILES := $(addprefix $(HTML_DIR)/,chm.hhp chm.hhc chm.stp) |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
51 |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
52 |
DIRS := $(HTML_DIR) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
53 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
54 |
################################################################ |
1296
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
55 |
# Deploy targets. |
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
56 |
|
2000 | 57 |
WWW_SRV_NAME := tips.defun.work |
1883
2e2b67e76e55
Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1843
diff
changeset
|
58 |
WWW_SRV_USER := user |
2e2b67e76e55
Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1843
diff
changeset
|
59 |
HG_SRV_NAME := hg.defun.work |
2e2b67e76e55
Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1843
diff
changeset
|
60 |
HG_SRV_USER := user |
1902
1dd434abf745
Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1901
diff
changeset
|
61 |
LOCAL_DIR := /srv/www/tips |
1883
2e2b67e76e55
Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1843
diff
changeset
|
62 |
|
1343
98bd3c148847
Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1341
diff
changeset
|
63 |
ifneq '' '$(filter deploy%,$(MAKECMDGOALS))' |
1912
8b81a8f0f692
Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1909
diff
changeset
|
64 |
$(shell rm -f $(HTML_DIR)/rst.tmpl) |
1343
98bd3c148847
Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1341
diff
changeset
|
65 |
endif |
98bd3c148847
Update build info for deploy targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1341
diff
changeset
|
66 |
|
1296
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
67 |
.PHONY: deploy |
1843
8ad4fe7443f2
Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1839
diff
changeset
|
68 |
deploy: deploy2defun-web deploy2defun-hg deploy2sf-web deploy2sf-hg |
1786 | 69 |
|
1893
da0024f4f068
Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1891
diff
changeset
|
70 |
# Will be accessible via: http://tips.defun.work/ |
1786 | 71 |
.PHONY: deploy2defun-web |
2000 | 72 |
deploy2defun-web: www |
1925
f753d84e666e
Use HTML_DIR variable instead of exact value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1917
diff
changeset
|
73 |
rsync --delete -avP -e ssh $(HTML_DIR)/ $(WWW_SRV_USER)@$(WWW_SRV_NAME):/srv/www/tips/ |
1296
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
74 |
|
1843
8ad4fe7443f2
Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1839
diff
changeset
|
75 |
.PHONY: deploy2defun-hg |
8ad4fe7443f2
Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1839
diff
changeset
|
76 |
deploy2defun-hg: |
1883
2e2b67e76e55
Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1843
diff
changeset
|
77 |
hg push ssh://$(HG_SRV_USER)@$(HG_SRV_NAME)//srv/hg/tips || [ $$? = 1 ] |
1843
8ad4fe7443f2
Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1839
diff
changeset
|
78 |
|
1893
da0024f4f068
Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1891
diff
changeset
|
79 |
# Will be accessible via: http://gavenkoa.users.sourceforge.net/tips-html/ |
1349
b4e60ae7e4bf
Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1345
diff
changeset
|
80 |
.PHONY: deploy2sf-web |
2000 | 81 |
deploy2sf-web: www |
1925
f753d84e666e
Use HTML_DIR variable instead of exact value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1917
diff
changeset
|
82 |
rsync --delete -avP -e ssh $(HTML_DIR)/ gavenkoa@frs.sourceforge.net:/home/user-web/g/ga/gavenkoa/htdocs/tips-html/ |
1296
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
83 |
|
1349
b4e60ae7e4bf
Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1345
diff
changeset
|
84 |
.PHONY: deploy2sf-hg |
b4e60ae7e4bf
Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1345
diff
changeset
|
85 |
deploy2sf-hg: |
1366
c57cd27e840e
If 'hg' found no changes it report error code 1. Ignore them as it is valid.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1349
diff
changeset
|
86 |
hg push ssh://gavenkoa@hg.code.sf.net/u/gavenkoa/tips || [ $$? = 1 ] |
1349
b4e60ae7e4bf
Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1345
diff
changeset
|
87 |
|
1902
1dd434abf745
Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1901
diff
changeset
|
88 |
.PHONY: deploy2local |
1dd434abf745
Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1901
diff
changeset
|
89 |
deploy2local: html |
1925
f753d84e666e
Use HTML_DIR variable instead of exact value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1917
diff
changeset
|
90 |
rsync --delete -avP $(HTML_DIR)/ $(LOCAL_DIR) |
1902
1dd434abf745
Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1901
diff
changeset
|
91 |
|
1296
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
92 |
################################################################ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
93 |
# Build targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
94 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
95 |
.PHONY: all |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
96 |
all: |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
97 |
|
2000 | 98 |
.PHONY: www |
99 |
www: html $(HTML_DIR)/sitemap.xml |
|
100 |
||
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
101 |
.PHONY: html |
1907
f4b078cbff20
TXT files no longer used.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1902
diff
changeset
|
102 |
html: $(HTML_FILES) |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
103 |
|
2001
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
104 |
$(HTML_DIR)/%.html: %.rst www/rst.css www/rst-multi.css $(HTML_DIR)/rst.tmpl $(MAKEFILE_LIST) | $(HTML_DIR) |
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
105 |
$(RST2HTML) $(RST_FLAGS) --stylesheet=www/rst.css,www/rst-multi.css --template=$(HTML_DIR)/rst.tmpl $*.rst $@ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
106 |
|
1889
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
107 |
$(HTML_DIR)/iframe.html: $(RST_FILES) $(MAKEFILE_LIST) | $(HTML_DIR) |
1334
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
108 |
{ \ |
1898
2a18c31747dc
set encoding for iframe navigation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1897
diff
changeset
|
109 |
echo '<html><head>'; \ |
2a18c31747dc
set encoding for iframe navigation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1897
diff
changeset
|
110 |
echo '<meta charset="utf-8">'; \ |
2a18c31747dc
set encoding for iframe navigation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1897
diff
changeset
|
111 |
echo '<style>'; \ |
1891
471406f3c69c
Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1890
diff
changeset
|
112 |
echo 'a { text-decoration: none; color: hsl(240, 100%, 50%); }'; \ |
1897
200fac373cf9
Highlight links on hover.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1893
diff
changeset
|
113 |
echo 'a:hover { opacity: .5; }'; \ |
1891
471406f3c69c
Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1890
diff
changeset
|
114 |
echo '</style></head><body>'; \ |
1889
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
115 |
echo '<ul style="padding-left: 1em;">'; \ |
1891
471406f3c69c
Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1890
diff
changeset
|
116 |
for f in $(sort $(RST_FILES)); do \ |
1889
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
117 |
n=$${f%.rst}; \ |
1893
da0024f4f068
Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1891
diff
changeset
|
118 |
printf '<li><a target="_parent" href="%s.html">%s</a></li>\n' $$n $$n; \ |
1889
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
119 |
done; \ |
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
120 |
echo '</ul>'; \ |
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
121 |
echo '</body></html>'; \ |
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
122 |
} >$@ |
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
123 |
|
2001
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
124 |
$(HTML_DIR)/rst.tmpl: www/rst.tmpl $(MAKEFILE_LIST) |
1912
8b81a8f0f692
Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1909
diff
changeset
|
125 |
sed -e "s|{date}|$$(date +%F)|" -e "s|{rev}|$$(hg id -i)|" <$< >$@ |
1334
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
126 |
|
1889
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
127 |
$(HTML_DIR)/index.html: $(HTML_DIR)/README.html $(MAKEFILE_LIST) | $(HTML_DIR) |
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
128 |
cp $< $@ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
129 |
|
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
130 |
.PHONY: chm |
1893
da0024f4f068
Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1891
diff
changeset
|
131 |
chm: html $(CHM_FILES) $(HTML_DIR)/iframe.html |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
132 |
cd $(HTML_DIR); for file in *.html; do sed -i '/<\?xml.*\?>/d' $$file; done |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
133 |
|
2001
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
134 |
$(HTML_DIR)/%.stp: misc/%.stp $(MAKEFILE_LIST) | $(HTML_DIR) |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
135 |
cp $< $@ |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
136 |
|
2001
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
137 |
$(HTML_DIR)/chm.hhp: misc/chm-hhp.sh $(MAKEFILE_LIST) | $(HTML_DIR) |
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
138 |
./$< >$@ |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
139 |
|
2001
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
140 |
$(HTML_DIR)/chm.hhc: misc/chm-hhc.sh $(MAKEFILE_LIST) | $(HTML_DIR) |
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
141 |
./$< >$@ |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
142 |
|
1908
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
143 |
.PHONY: single-html |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
144 |
single-html: $(HTML_DIR)/single.html |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
145 |
|
2001
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
146 |
$(HTML_DIR)/single.html: $(HTML_DIR)/single.rest www/rst.css www/rst-single.css $(RST_FILES) |
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
147 |
$(RST2HTML) $(RST_FLAGS) --stylesheet=www/rst.css,www/rst-single.css $(HTML_DIR)/single.rest $@ |
1908
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
148 |
|
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
149 |
$(HTML_DIR)/single.rest: $(RST_FILES) $(MAKEFILE_LIST) |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
150 |
{ \ |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
151 |
echo ".. contents::"; \ |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
152 |
echo " :local:"; \ |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
153 |
echo; \ |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
154 |
for f in *.rst; do echo ".. include:: ../$$f"; done; \ |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
155 |
} >$@ |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
156 |
|
2000 | 157 |
$(HTML_DIR)/sitemap.xml: $(RST_FILES) $(MAKEFILE_LIST) |
158 |
{ \ |
|
159 |
echo '<?xml version="1.0" encoding="UTF-8"?>'; \ |
|
160 |
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; \ |
|
161 |
for f in *.rst iframe; do \ |
|
162 |
echo '<url>'; \ |
|
163 |
echo " <loc>http://$(WWW_SRV_NAME)/$${f%.rst}.html</loc>"; \ |
|
164 |
echo ' <changefreq>weekly</changefreq>'; \ |
|
165 |
echo '</url>'; \ |
|
166 |
done; \ |
|
167 |
echo '</urlset>'; \ |
|
168 |
} >$@ |
|
169 |
||
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
170 |
################################################################ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
171 |
# Init targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
172 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
173 |
$(DIRS): |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
174 |
mkdir -p $@ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
175 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
176 |
################################################################ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
177 |
# Clean targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
178 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
179 |
.PHONY: distclean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
180 |
distclean: clean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
181 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
182 |
.PHONY: clean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
183 |
clean: |
1912
8b81a8f0f692
Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1909
diff
changeset
|
184 |
rm -r -f $(DIRS) |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
185 |
|
928 | 186 |
################################################################ |
187 |
# Helper target. |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
188 |
|
1345
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
189 |
.PHONY: help |
928 | 190 |
help: |
191 |
@echo Supported targets: |
|
192 |
@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*= \1=;p;}' $(MAKEFILE_LIST) |
|
193 |
||
1345
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
194 |
.PHONY: check-format-policy |
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
195 |
check-format-policy: |
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
196 |
\ |
1909
6b76120bd2d3
Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1908
diff
changeset
|
197 |
for f in $(RST_FILES); do \ |
6b76120bd2d3
Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1908
diff
changeset
|
198 |
if grep '^.. -\*- coding: utf-8; -\*-' $$f >/dev/null; then :; else \ |
1345
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
199 |
echo $$f:1:" Has no 'coding: utf-8' directive."; \ |
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
200 |
fi; \ |
1909
6b76120bd2d3
Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1908
diff
changeset
|
201 |
if grep '^.. contents::' $$f >/dev/null; then :; else \ |
1345
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
202 |
echo $$f:7:" Has no 'contents::' directive."; \ |
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
203 |
fi; \ |
1909
6b76120bd2d3
Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1908
diff
changeset
|
204 |
if grep '^ :local:' $$f >/dev/null; then :; else \ |
6b76120bd2d3
Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1908
diff
changeset
|
205 |
echo $$f:7:" Has no ':local:' directive."; \ |
6b76120bd2d3
Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1908
diff
changeset
|
206 |
fi; \ |
1345
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
207 |
done |
928 | 208 |