author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Tue, 25 Oct 2011 23:02:32 +0300 | |
changeset 1069 | 2a7388c5fef2 |
parent 1030 | 9162afed7eda |
child 1077 | 509886d148b2 |
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 |
||
25 |
RST2HTML = rst2html |
|
26 |
ifeq '$(host_os)' 'cygwin' |
|
27 |
RST2HTML = rst2html.py |
|
28 |
endif |
|
29 |
||
30 |
################################################################ |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
31 |
# Proj dirs/files. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
32 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
33 |
RST_FILES := $(wildcard *.rst) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
34 |
TXT_FILES := $(wildcard *.txt) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
35 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
36 |
HTML_DIR := tips-html |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
37 |
HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES)) $(HTML_DIR)/index.html $(HTML_DIR)/index-frame.html |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
38 |
TXT__FILES := $(addprefix $(HTML_DIR)/,$(TXT_FILES)) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
39 |
|
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
40 |
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
|
41 |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
42 |
DIRS := $(HTML_DIR) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
43 |
|
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 |
# Build targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
46 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
47 |
.PHONY: all |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
48 |
all: |
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 |
.PHONY: html |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
51 |
html: $(HTML_FILES) $(TXT__FILES) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
52 |
|
905 | 53 |
$(HTML_DIR)/%.html: %.rst rst.css | $(HTML_DIR) |
1030 | 54 |
$(RST2HTML) --stylesheet=rst.css $*.rst $@ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
55 |
|
927 | 56 |
$(HTML_DIR)/index.html: index.sh $(filter-out $(HTML_DIR)/index.html,$(HTML_FILES)) | $(HTML_DIR) |
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
57 |
./index.sh frame >$@ |
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
58 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
59 |
$(HTML_DIR)/%.html: %.html | $(HTML_DIR) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
60 |
cp $< $@ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
61 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
62 |
$(HTML_DIR)/%.txt: %.txt | $(HTML_DIR) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
63 |
cp $< $@ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
64 |
|
903
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
65 |
.PHONY: chm |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
66 |
chm: html $(CHM_FILES) $(HTML_DIR)/index-chm.html |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
67 |
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
|
68 |
|
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
69 |
$(HTML_DIR)/%.stp: %.stp | $(HTML_DIR) |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
70 |
cp $< $@ |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
71 |
|
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
72 |
$(HTML_DIR)/chm.hhp: chm-hhp.sh | $(HTML_DIR) |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
73 |
./chm-hhp.sh >$@ |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
74 |
|
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
75 |
$(HTML_DIR)/chm.hhc: chm-hhc.sh | $(HTML_DIR) |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
76 |
./chm-hhc.sh >$@ |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
77 |
|
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
78 |
$(HTML_DIR)/index-chm.html: index.sh | $(HTML_DIR) |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
79 |
./index.sh chm >$@ |
9ead7d97be34
Add chm output format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
902
diff
changeset
|
80 |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
81 |
################################################################ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
82 |
# Init targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
83 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
84 |
$(DIRS): |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
85 |
mkdir -p $@ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
86 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
87 |
################################################################ |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
88 |
# Clean targets. |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
89 |
|
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
90 |
.PHONY: distclean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
91 |
distclean: clean |
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 |
.PHONY: clean |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
94 |
clean: |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
95 |
rm -r -f $(DIRS) |
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
96 |
|
928 | 97 |
################################################################ |
98 |
# Helper target. |
|
902
034aeeb2a16d
Build html version of tips.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
99 |
|
928 | 100 |
help: |
101 |
@echo Supported targets: |
|
102 |
@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*= \1=;p;}' $(MAKEFILE_LIST) |
|
103 |
||
104 |