author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Fri, 13 Jul 2012 23:29:25 +0300 | |
changeset 1337 | 2bd47e0a87fa |
parent 1334 | 9bf0d5a1f0cf |
child 1338 | 4e268948ba99 |
permissions | -rw-r--r-- |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
1 |
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
|
2 |
export PATH := /bin:/usr/bin:${PATH} |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
3 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
4 |
# Disable built in pattern rules. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
5 |
MAKEFLAGS += -r |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
6 |
# Disable built in variables. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
7 |
MAKEFLAGS += -R |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
8 |
# Disable built in suffix rules. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
9 |
.SUFFIXES: |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
10 |
# Default target. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
11 |
.DEFAULT_GOAL = all |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
12 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
13 |
################################################################ |
1030 | 14 |
# Platform definition. |
15 |
||
16 |
host_os := linux |
|
17 |
ifneq '' '$(WINDIR)' |
|
18 |
host_os := cygwin |
|
19 |
endif |
|
20 |
target_os := $(host_os) |
|
21 |
||
22 |
################################################################ |
|
23 |
# Build tool definition/switches. |
|
24 |
||
1110 | 25 |
RST2HTML := rst2html |
1030 | 26 |
ifeq '$(host_os)' 'cygwin' |
1110 | 27 |
RST2HTML := rst2html.py |
1030 | 28 |
endif |
29 |
||
1109
9885f6be80f0
Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1103
diff
changeset
|
30 |
RST_WARNING_FLAGS := --halt warning |
9885f6be80f0
Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1103
diff
changeset
|
31 |
RST_FLAGS := --strip-comments |
9885f6be80f0
Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1103
diff
changeset
|
32 |
RST_FLAGS += $(RST_WARNING_FLAGS) |
9885f6be80f0
Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1103
diff
changeset
|
33 |
|
1030 | 34 |
################################################################ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
35 |
# Proj dirs/files. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
36 |
|
1334
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
37 |
RST_FILES := $(filter-out HEADER.rst,$(wildcard *.rst)) |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
38 |
TXT_FILES := $(wildcard *.txt) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
39 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
40 |
HTML_DIR := tips-html |
1077 | 41 |
RST_HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES)) |
1103
53b2adcc631e
Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1079
diff
changeset
|
42 |
HTML_FILES := $(RST_HTML_FILES) \ |
1079
ef0805397b5b
Generate index.html without "target=article" so links open in current browser tab.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
43 |
$(HTML_DIR)/index.html $(HTML_DIR)/frame.html $(HTML_DIR)/frame-index.html |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
44 |
TXT__FILES := $(addprefix $(HTML_DIR)/,$(TXT_FILES)) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
45 |
|
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
46 |
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
|
47 |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
48 |
DIRS := $(HTML_DIR) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
49 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
50 |
################################################################ |
1296
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
51 |
# Deploy targets. |
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
52 |
|
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
53 |
.PHONY: deploy |
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
54 |
deploy: deploy2sourceforge |
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
55 |
|
1332
50bb16a68693
Will be accessible via.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1296
diff
changeset
|
56 |
# Will be accessible via: http://gavenkoa.users.sourceforge.net/tips-html/frame.html |
1296
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
57 |
.PHONY: deploy2sourceforge |
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
58 |
deploy2sourceforge: html |
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
59 |
rsync --delete -avP -e ssh tips-html/ gavenkoa@frs.sourceforge.net:/home/user-web/g/ga/gavenkoa/htdocs/tips-html/ |
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
60 |
|
6b365616ac9e
Add 'deploy2sourceforge' target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1111
diff
changeset
|
61 |
################################################################ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
62 |
# Build targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
63 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
64 |
.PHONY: all |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
65 |
all: |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
66 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
67 |
.PHONY: html |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
68 |
html: $(HTML_FILES) $(TXT__FILES) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
69 |
|
1334
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
70 |
$(HTML_DIR)/%.html: %.rst HEADER.rst rst.css $(MAKEFILE_LIST) | $(HTML_DIR) |
1109
9885f6be80f0
Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1103
diff
changeset
|
71 |
$(RST2HTML) $(RST_FLAGS) --stylesheet=rst.css $*.rst $@ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
72 |
|
1334
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
73 |
HEADER.rst: Makefile |
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
74 |
{ \ |
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
75 |
echo '.. _Home: frame.html'; \ |
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
76 |
echo '.. _`Home (no frame)`: index.html'; \ |
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
77 |
echo '.. _About: http://gavenkoa.users.sourceforge.net/'; \ |
1337
2bd47e0a87fa
Add About and Licence statements.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1334
diff
changeset
|
78 |
echo '.. _Licence: README.html#tips-licence'; \ |
2bd47e0a87fa
Add About and Licence statements.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1334
diff
changeset
|
79 |
echo '.. _`Contact`: gavenkoa@gmail.com'; \ |
1334
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
80 |
echo; \ |
1337
2bd47e0a87fa
Add About and Licence statements.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1334
diff
changeset
|
81 |
echo '[ Home_ | `Home (no frame)`_ | About_ | Licence_ | `Contact`_ ]'; \ |
1334
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
82 |
} >$@ |
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
83 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
84 |
$(HTML_DIR)/frame-index.html: index.sh $(RST_HTML_FILES) $(MAKEFILE_LIST) | $(HTML_DIR) |
1079
ef0805397b5b
Generate index.html without "target=article" so links open in current browser tab.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
85 |
./index.sh frame >$@ |
ef0805397b5b
Generate index.html without "target=article" so links open in current browser tab.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
86 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
87 |
$(HTML_DIR)/index.html: index.sh $(RST_HTML_FILES) $(MAKEFILE_LIST) | $(HTML_DIR) |
1079
ef0805397b5b
Generate index.html without "target=article" so links open in current browser tab.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
88 |
./index.sh html >$@ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
89 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
90 |
$(HTML_DIR)/%.html: %.html $(MAKEFILE_LIST) | $(HTML_DIR) |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
91 |
cp $< $@ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
92 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
93 |
$(HTML_DIR)/%.txt: %.txt $(MAKEFILE_LIST) | $(HTML_DIR) |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
94 |
cp $< $@ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
95 |
|
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
96 |
.PHONY: chm |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
97 |
chm: html $(CHM_FILES) $(HTML_DIR)/index-chm.html |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
98 |
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
|
99 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
100 |
$(HTML_DIR)/%.stp: %.stp $(MAKEFILE_LIST) | $(HTML_DIR) |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
101 |
cp $< $@ |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
102 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
103 |
$(HTML_DIR)/chm.hhp: chm-hhp.sh $(MAKEFILE_LIST) | $(HTML_DIR) |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
104 |
./chm-hhp.sh >$@ |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
105 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
106 |
$(HTML_DIR)/chm.hhc: chm-hhc.sh $(MAKEFILE_LIST) | $(HTML_DIR) |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
107 |
./chm-hhc.sh >$@ |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
108 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
109 |
$(HTML_DIR)/index-chm.html: index.sh $(MAKEFILE_LIST) | $(HTML_DIR) |
1079
ef0805397b5b
Generate index.html without "target=article" so links open in current browser tab.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1077
diff
changeset
|
110 |
./index.sh html >$@ |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
111 |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
112 |
################################################################ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
113 |
# Init targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
114 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
115 |
$(DIRS): |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
116 |
mkdir -p $@ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
117 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
118 |
################################################################ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
119 |
# Clean targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
120 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
121 |
.PHONY: distclean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
122 |
distclean: clean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
123 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
124 |
.PHONY: clean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
125 |
clean: |
1334
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1333
diff
changeset
|
126 |
rm -r -f $(DIRS) HEADER.rst |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
127 |
|
928 | 128 |
################################################################ |
129 |
# Helper target. |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
130 |
|
928 | 131 |
help: |
132 |
@echo Supported targets: |
|
133 |
@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*= \1=;p;}' $(MAKEFILE_LIST) |
|
134 |
||
135 |