author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Sat, 17 Feb 2024 19:24:27 +0200 | |
changeset 2586 | 2ba27fb751bd |
parent 2574 | ed399b8e9fca |
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' |
2188
e95731eef030
Fixed: NameError: name 'locale_encoding' is not defined
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2031
diff
changeset
|
33 |
RST2HTML := LC_ALL=en_US.utf8 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 |
|
2012
542525cfb513
For SEO reason I removed tips from SF.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2003
diff
changeset
|
67 |
# For SEO reason I removed tips from SF. |
1296
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
68 |
.PHONY: deploy |
2574
ed399b8e9fca
Added target deploy2defun.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2188
diff
changeset
|
69 |
deploy: deploy2defun |
ed399b8e9fca
Added target deploy2defun.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2188
diff
changeset
|
70 |
|
ed399b8e9fca
Added target deploy2defun.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2188
diff
changeset
|
71 |
.PHONY: deploy2defun |
ed399b8e9fca
Added target deploy2defun.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2188
diff
changeset
|
72 |
deploy2defun: deploy2defun-web deploy2defun-hg |
ed399b8e9fca
Added target deploy2defun.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2188
diff
changeset
|
73 |
|
ed399b8e9fca
Added target deploy2defun.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2188
diff
changeset
|
74 |
.PHONY: deploy2sf |
ed399b8e9fca
Added target deploy2defun.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2188
diff
changeset
|
75 |
deploy2sf: deploy2sf-web deploy2sf-hg |
1786 | 76 |
|
2031
6f913ce241e3
Preserve Google and Bind verification pages on deploy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2012
diff
changeset
|
77 |
RSYNC_FLAGS := --delete -avP -e ssh --exclude "google*.html" --exclude "BingSiteAuth.xml" |
6f913ce241e3
Preserve Google and Bind verification pages on deploy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2012
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://tips.defun.work/ |
1786 | 80 |
.PHONY: deploy2defun-web |
2000 | 81 |
deploy2defun-web: www |
2031
6f913ce241e3
Preserve Google and Bind verification pages on deploy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2012
diff
changeset
|
82 |
rsync $(RSYNC_FLAGS) $(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
|
83 |
|
1843
8ad4fe7443f2
Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1839
diff
changeset
|
84 |
.PHONY: deploy2defun-hg |
8ad4fe7443f2
Point to defun.work to grab sources.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1839
diff
changeset
|
85 |
deploy2defun-hg: |
1883
2e2b67e76e55
Allow customising connection settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1843
diff
changeset
|
86 |
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
|
87 |
|
1893
da0024f4f068
Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1891
diff
changeset
|
88 |
# 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
|
89 |
.PHONY: deploy2sf-web |
2000 | 90 |
deploy2sf-web: www |
2031
6f913ce241e3
Preserve Google and Bind verification pages on deploy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2012
diff
changeset
|
91 |
rsync $(RSYNC_FLAGS) $(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
|
92 |
|
1349
b4e60ae7e4bf
Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1345
diff
changeset
|
93 |
.PHONY: deploy2sf-hg |
b4e60ae7e4bf
Push sources on 'deploy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1345
diff
changeset
|
94 |
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
|
95 |
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
|
96 |
|
1902
1dd434abf745
Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1901
diff
changeset
|
97 |
.PHONY: deploy2local |
1dd434abf745
Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1901
diff
changeset
|
98 |
deploy2local: html |
1925
f753d84e666e
Use HTML_DIR variable instead of exact value.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1917
diff
changeset
|
99 |
rsync --delete -avP $(HTML_DIR)/ $(LOCAL_DIR) |
1902
1dd434abf745
Deploy to local WEB server.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1901
diff
changeset
|
100 |
|
1296
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
101 |
################################################################ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
102 |
# Build targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
103 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
104 |
.PHONY: all |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
105 |
all: |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
106 |
|
2000 | 107 |
.PHONY: www |
2003 | 108 |
www: html $(HTML_DIR)/sitemap.xml $(HTML_DIR)/robots.txt |
2000 | 109 |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
110 |
.PHONY: html |
1907
f4b078cbff20
TXT files no longer used.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1902
diff
changeset
|
111 |
html: $(HTML_FILES) |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
112 |
|
2001
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
113 |
$(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
|
114 |
$(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
|
115 |
|
1889
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
116 |
$(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
|
117 |
{ \ |
1898
2a18c31747dc
set encoding for iframe navigation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1897
diff
changeset
|
118 |
echo '<html><head>'; \ |
2a18c31747dc
set encoding for iframe navigation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1897
diff
changeset
|
119 |
echo '<meta charset="utf-8">'; \ |
2a18c31747dc
set encoding for iframe navigation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1897
diff
changeset
|
120 |
echo '<style>'; \ |
1891
471406f3c69c
Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1890
diff
changeset
|
121 |
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
|
122 |
echo 'a:hover { opacity: .5; }'; \ |
1891
471406f3c69c
Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1890
diff
changeset
|
123 |
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
|
124 |
echo '<ul style="padding-left: 1em;">'; \ |
1891
471406f3c69c
Apply consistent color schema. Remove duplicated links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1890
diff
changeset
|
125 |
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
|
126 |
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
|
127 |
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
|
128 |
done; \ |
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
129 |
echo '</ul>'; \ |
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
130 |
echo '</body></html>'; \ |
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
131 |
} >$@ |
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
132 |
|
2003 | 133 |
$(HTML_DIR)/rst.tmpl: www/rst.tmpl $(MAKEFILE_LIST) | $(HTML_DIR) |
1912
8b81a8f0f692
Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1909
diff
changeset
|
134 |
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
|
135 |
|
1889
265b8d0f6149
Generate UX friendly index.html with iframe to tips index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1883
diff
changeset
|
136 |
$(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
|
137 |
cp $< $@ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
138 |
|
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
139 |
.PHONY: chm |
1893
da0024f4f068
Remove frame based publishing, stick to iframe. Clean CHM code generation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1891
diff
changeset
|
140 |
chm: html $(CHM_FILES) $(HTML_DIR)/iframe.html |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
141 |
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
|
142 |
|
2001
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
143 |
$(HTML_DIR)/%.stp: misc/%.stp $(MAKEFILE_LIST) | $(HTML_DIR) |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
144 |
cp $< $@ |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
145 |
|
2001
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
146 |
$(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
|
147 |
./$< >$@ |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
148 |
|
2001
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
149 |
$(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
|
150 |
./$< >$@ |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
151 |
|
1908
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
152 |
.PHONY: single-html |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
153 |
single-html: $(HTML_DIR)/single.html |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
154 |
|
2001
4bebef342260
Move template files to separate directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2000
diff
changeset
|
155 |
$(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
|
156 |
$(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
|
157 |
|
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
158 |
$(HTML_DIR)/single.rest: $(RST_FILES) $(MAKEFILE_LIST) |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
159 |
{ \ |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
160 |
echo ".. contents::"; \ |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
161 |
echo " :local:"; \ |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
162 |
echo; \ |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
163 |
for f in *.rst; do echo ".. include:: ../$$f"; done; \ |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
164 |
} >$@ |
0260f8ffef35
Generate single HTML build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1907
diff
changeset
|
165 |
|
2003 | 166 |
$(HTML_DIR)/sitemap.xml: $(RST_FILES) $(MAKEFILE_LIST) | $(HTML_DIR) |
2000 | 167 |
{ \ |
168 |
echo '<?xml version="1.0" encoding="UTF-8"?>'; \ |
|
169 |
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; \ |
|
170 |
for f in *.rst iframe; do \ |
|
171 |
echo '<url>'; \ |
|
172 |
echo " <loc>http://$(WWW_SRV_NAME)/$${f%.rst}.html</loc>"; \ |
|
173 |
echo ' <changefreq>weekly</changefreq>'; \ |
|
174 |
echo '</url>'; \ |
|
175 |
done; \ |
|
176 |
echo '</urlset>'; \ |
|
177 |
} >$@ |
|
178 |
||
2003 | 179 |
$(HTML_DIR)/robots.txt: www/robots.txt $(MAKEFILE_LIST) | $(HTML_DIR) |
180 |
cp $< $@ |
|
181 |
||
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
182 |
################################################################ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
183 |
# Init targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
184 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
185 |
$(DIRS): |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
186 |
mkdir -p $@ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
187 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
188 |
################################################################ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
189 |
# Clean targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
190 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
191 |
.PHONY: distclean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
192 |
distclean: clean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
193 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
194 |
.PHONY: clean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
195 |
clean: |
1912
8b81a8f0f692
Remove HEADER.rst because that info now added to HTML template.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1909
diff
changeset
|
196 |
rm -r -f $(DIRS) |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
197 |
|
928 | 198 |
################################################################ |
199 |
# Helper target. |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
200 |
|
1345
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
201 |
.PHONY: help |
928 | 202 |
help: |
203 |
@echo Supported targets: |
|
204 |
@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*= \1=;p;}' $(MAKEFILE_LIST) |
|
205 |
||
1345
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
206 |
.PHONY: check-format-policy |
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
207 |
check-format-policy: |
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
208 |
\ |
1909
6b76120bd2d3
Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1908
diff
changeset
|
209 |
for f in $(RST_FILES); do \ |
6b76120bd2d3
Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1908
diff
changeset
|
210 |
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
|
211 |
echo $$f:1:" Has no 'coding: utf-8' directive."; \ |
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
212 |
fi; \ |
1909
6b76120bd2d3
Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1908
diff
changeset
|
213 |
if grep '^.. contents::' $$f >/dev/null; then :; else \ |
1345
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
214 |
echo $$f:7:" Has no 'contents::' directive."; \ |
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
215 |
fi; \ |
1909
6b76120bd2d3
Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1908
diff
changeset
|
216 |
if grep '^ :local:' $$f >/dev/null; then :; else \ |
6b76120bd2d3
Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1908
diff
changeset
|
217 |
echo $$f:7:" Has no ':local:' directive."; \ |
6b76120bd2d3
Check for presents of :local: keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1908
diff
changeset
|
218 |
fi; \ |
1345
a1dffeaaf6e4
Add 'check-format-policy' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1343
diff
changeset
|
219 |
done |
928 | 220 |