File: makefile

package info (click to toggle)
libtorrent-rasterbar 2.0.11-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,304 kB
  • sloc: cpp: 190,670; python: 7,142; makefile: 1,374; ansic: 574; sh: 317; xml: 104
file content (231 lines) | stat: -rw-r--r-- 6,757 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# this makefile assumes that you have docutils and rst2pdf installed
# (python-docutils) as well as aafigure (python-aafigure)

ifndef WEB_PATH
WEB_PATH = ~/web/products/libtorrent
endif

ifndef RST2HTML
RST2HTML:=rst2html
endif

ifndef AAFIGURE
AAFIGURE=aafigure
endif

REFERENCE_TARGETS = \
	manual-ref \
	tutorial-ref \
	tuning-ref \
	features-ref \
	upgrade_to_1.2-ref \
	upgrade_to_2.0-ref \
	reference \
	reference-Core \
	reference-DHT \
	reference-Session \
	reference-Torrent_Handle \
	reference-Torrent_Info \
	reference-Trackers \
	reference-PeerClass \
	reference-Torrent_Status \
	reference-Stats \
	reference-Resume_Data \
	reference-Add_Torrent \
	reference-Plugins \
	reference-Create_Torrents \
	reference-Error_Codes \
	reference-Storage \
	reference-Custom_Storage \
	reference-Utility \
	reference-Bencoding \
	reference-Alerts \
	reference-Filter \
	reference-Settings \
	reference-Bdecoding \
	reference-ed25519

MANUAL_TARGETS = index \
	udp_tracker_protocol \
	dht_rss \
	dht_store \
	client_test \
	building \
	troubleshooting \
	contributing\
	examples \
	extension_protocol \
	dht_extensions \
	dht_sec \
	python_binding \
	projects \
	utp \
	hacking \
	streaming \
	fuzzing \
	security-audit

TARGETS = single-page-ref \
	$(MANUAL_TARGETS) \
	$(REFERENCE_TARGETS)

FIGURES = $(addprefix img/, \
	read_disk_buffers \
	write_disk_buffers \
	hacking \
	utp_stack \
	storage \
	troubleshooting \
	troubleshooting_thumb \
	screenshot_thumb \
	logo-color \
	logo-bw \
	our_delay_base_thumb \
	delays_thumb \
	cwnd_thumb \
)

STAGE_IMG = $(addprefix img/, \
	logo-color-text \
	logo-color \
	screenshot \
	bitcoin \
	ip_id_v4 \
	ip_id_v6 \
	hash_distribution \
	complete_bit_prefixes \
	our_delay_base \
	delays \
	cwnd \
)

ORIG_HEADERS = $(wildcard ../include/libtorrent/*.hpp)
HEADERS = $(ORIG_HEADERS:../%=%)

html: $(TARGETS:=.html) $(FIGURES:=.png) todo.html favicon.ico $(HEADERS)

stage: $(addprefix $(WEB_PATH)/, $(TARGETS:=.html) $(FIGURES:=.png) todo.html favicon.ico style.css $(HEADERS) $(STAGE_IMG:=.png))

rst: $(TARGETS:=.rst) todo.html

pdf: $(TARGETS:=.pdf) $(FIGURES:=.png)

epub: $(TARGETS:=.epub) $(FIGURES:=.png)

all: html pdf favicon.ico

img/logo-color-text.png: img/logo-color-text.svg
	convert -background transparent $< -resize 400 $@

img/%.png: img/%.svg
	convert -background transparent $< -resize 128x128 $@

favicon.ico: favicon-16.png favicon-32.png favicon-64.png
	icotool -o $@ -c $?

favicon-16.png: img/logo-color.svg
	convert -background transparent $< -resize 16x16 $@

favicon-32.png: img/logo-color.svg
	convert -background transparent $< -resize 32x32 $@

favicon-64.png: img/logo-color.svg
	convert -background transparent $< -resize 64x64 $@

single-page-ref.rst: gen_reference_doc.py ../include/libtorrent/*.hpp ../include/libtorrent/kademlia/*.hpp settings-ref.rst stats_counters.rst
	python3 gen_reference_doc.py --single-page

settings.rst hunspell/settings.dic: ../include/libtorrent/settings_pack.hpp hunspell/libtorrent.dic
	python3 gen_settings_doc.py || { rm $@; exit 1; }
	cat hunspell/libtorrent.dic >>hunspell/settings.dic

stats_counters.rst: ../src/session_stats.cpp ../include/libtorrent/performance_counters.hpp
	python3 gen_stats_doc.py || { rm $@; exit 1; }

manual.rst: stats_counters.rst
	touch manual.rst

%_thumb.png: %.png
	convert $< -resize 400 $@

img/troubleshooting_thumb.png: img/troubleshooting.png
	convert $< -resize 800x800 $@

todo.html:gen_todo.py ../src/*.cpp ../include/libtorrent/*.hpp
	python3 gen_todo.py

$(REFERENCE_TARGETS:=.rst) plain_text_out.txt settings-ref.rst:gen_reference_doc.py ../include/libtorrent/*.hpp ../include/libtorrent/kademlia/*.hpp manual.rst tuning.rst tutorial.rst features.rst settings.rst stats_counters.rst hunspell/settings.dic
	python3 gen_reference_doc.py --plain-output

spell-check:plain_text_out.txt $(MANUAL_TARGETS:=.html) manual.rst settings.rst tutorial.rst
	python3 filter-rst.py manual.rst >manual-plain.txt
	python3 filter-rst.py tutorial.rst >tutorial-plain.txt
	python3 filter-rst.py tuning.rst >tuning-plain.txt
	python3 filter-rst.py settings.rst >settings-plain.txt
	python3 filter-rst.py upgrade_to_1.2.rst >upgrade-1_2-plain.txt
	python3 filter-rst.py upgrade_to_2.0.rst >upgrade-2_0-plain.txt
	hunspell -i UTF-8 -d hunspell/en_US -p hunspell/libtorrent.dic -l plain_text_out.txt >hunspell-report.txt
	hunspell -i UTF-8 -d hunspell/en_US -p hunspell/libtorrent.dic -l manual-plain.txt >>hunspell-report.txt
	hunspell -i UTF-8 -d hunspell/en_US -p hunspell/libtorrent.dic -l tutorial-plain.txt >>hunspell-report.txt
	hunspell -i UTF-8 -d hunspell/en_US -p hunspell/libtorrent.dic -l tuning-plain.txt >>hunspell-report.txt
	hunspell -i UTF-8 -d hunspell/en_US -p hunspell/libtorrent.dic -l upgrade-1_2-plain.txt >>hunspell-report.txt
	hunspell -i UTF-8 -d hunspell/en_US -p hunspell/libtorrent.dic -l upgrade-2_0-plain.txt >>hunspell-report.txt
	hunspell -i UTF-8 -d hunspell/en_US -p hunspell/settings.dic -l settings-plain.txt >>hunspell-report.txt
	hunspell -i UTF-8 -d hunspell/en_US -p hunspell/libtorrent.dic -H -l $(MANUAL_TARGETS:=.html) >>hunspell-report.txt
	@if [ -s hunspell-report.txt ]; then echo 'spellcheck failed, fix words or add to dictionary:'; cat hunspell-report.txt; false; fi;

%.epub:%.rst
	rst2epub --exit-status=2 $< $@

%.pdf:%.rst
	rst2pdf $< -o $@ --stylesheets stylesheet

%.html:%.rst template.txt template2.txt
	$(RST2HTML) --title=libtorrent --exit-status=2 --template=template.txt --stylesheet-path=style.css --link-stylesheet --no-toc-backlinks $< > $@ || { rm $@; exit 1; }

%.png:%.dot
	dot -Tpng $< >$@ || { rm $@; exit 1; }

%.png:%.diagram
	$(AAFIGURE) --scale 0.6 -o $@ $< || { rm $@; exit 1; }

include/libtorrent/%.hpp: ../include/libtorrent/%.hpp
	mkdir -p include/libtorrent >/dev/null
	cp $< $@

# stage rules

$(WEB_PATH)/%.html:%.rst template.txt template2.txt
	mkdir -p $(WEB_PATH) >/dev/null
	$(RST2HTML) --title=libtorrent --exit-status=2 --template=template2.txt --stylesheet-path=style.css --link-stylesheet --no-toc-backlinks $< > $@ || { rm $@; exit 1; }

$(WEB_PATH)/img/%.png: img/%.png
	mkdir -p $(WEB_PATH)/img >/dev/null
	cp $< $@

$(WEB_PATH)/%.png: %.png
	cp $< $@

$(WEB_PATH)/%.css: %.css
	cp $< $@

$(WEB_PATH)/%.svg: %.svg
	cp $< $@

$(WEB_PATH)/%.html: %.html
	cp $< $@

$(WEB_PATH)/%.ico: %.ico
	cp $< $@

$(WEB_PATH)/include/libtorrent/%.hpp: ../include/libtorrent/%.hpp
	mkdir -p $(WEB_PATH)/include/libtorrent
	cp $< $@

$(WEB_PATH)/img/%.png: img/%.png
	mkdir -p $(WEB_PATH)/img >/dev/null
	cp $< $@

clean:
	rm -f $(TARGETS:=.html) $(TARGETS:=.pdf) $(FIGURES:=.png) $(REFERENCE_TARGETS:=.rst) settings.rst todo.html reference*.html stats_counters.rst hunspell/settings.dic favicon-16.png favicon-32.png favicon-64.png favicon.ico