author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 28 Nov 2011 01:11:03 +0200 | |
changeset 1111 | e1a7f1896571 |
parent 1110 | 6e71ffc71972 |
child 1296 | 6b365616ac9e |
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 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
37 |
RST_FILES := $(wildcard *.rst) |
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 |
################################################################ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
51 |
# Build targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
52 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
53 |
.PHONY: all |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
54 |
all: |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
55 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
56 |
.PHONY: html |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
57 |
html: $(HTML_FILES) $(TXT__FILES) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
58 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
59 |
$(HTML_DIR)/%.html: %.rst rst.css $(MAKEFILE_LIST) | $(HTML_DIR) |
1109
9885f6be80f0
Add warning flag for RST utils.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1103
diff
changeset
|
60 |
$(RST2HTML) $(RST_FLAGS) --stylesheet=rst.css $*.rst $@ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
61 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
62 |
$(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
|
63 |
./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
|
64 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
65 |
$(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
|
66 |
./index.sh html >$@ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
67 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
68 |
$(HTML_DIR)/%.html: %.html $(MAKEFILE_LIST) | $(HTML_DIR) |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
69 |
cp $< $@ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
70 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
71 |
$(HTML_DIR)/%.txt: %.txt $(MAKEFILE_LIST) | $(HTML_DIR) |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
72 |
cp $< $@ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
73 |
|
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
74 |
.PHONY: chm |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
75 |
chm: html $(CHM_FILES) $(HTML_DIR)/index-chm.html |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
76 |
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
|
77 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
78 |
$(HTML_DIR)/%.stp: %.stp $(MAKEFILE_LIST) | $(HTML_DIR) |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
79 |
cp $< $@ |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
80 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
81 |
$(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
|
82 |
./chm-hhp.sh >$@ |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
83 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
84 |
$(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
|
85 |
./chm-hhc.sh >$@ |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
86 |
|
1111
e1a7f1896571
Add dependency on build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1110
diff
changeset
|
87 |
$(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
|
88 |
./index.sh html >$@ |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
89 |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
90 |
################################################################ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
91 |
# Init targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
92 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
93 |
$(DIRS): |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
94 |
mkdir -p $@ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
95 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
96 |
################################################################ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
97 |
# Clean targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
98 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
99 |
.PHONY: distclean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
100 |
distclean: clean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
101 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
102 |
.PHONY: clean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
103 |
clean: |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
104 |
rm -r -f $(DIRS) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
105 |
|
928 | 106 |
################################################################ |
107 |
# Helper target. |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
108 |
|
928 | 109 |
help: |
110 |
@echo Supported targets: |
|
111 |
@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*= \1=;p;}' $(MAKEFILE_LIST) |
|
112 |
||
113 |