File: Makefile

package info (click to toggle)
game-data-packager 63
  • links: PTS, VCS
  • area: contrib
  • in suites: buster
  • size: 15,920 kB
  • sloc: python: 10,537; sh: 515; makefile: 497
file content (507 lines) | stat: -rw-r--r-- 22,933 bytes parent folder | download
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
-include configure.mk

pkgdatadir := ${gamedatadir}/game-data-packager
runtimedir := ${gamedatadir}/game-data-packager-runtime
PYFLAKES3 := $(shell if [ -x /usr/bin/pyflakes3 ] ;  then echo pyflakes3 ; \
                   elif [ -x /usr/bin/pyflakes3k ] ; then echo pyflakes3k ; \
                   elif [ -x /usr/bin/python3-pyflakes ] ; then echo python3-pyflakes ; \
                   else ls -1 /usr/bin/pyflakes-python3.* | tail -n 1 ; \
                    fi)

png_from_xpm := $(patsubst ./data/%.xpm,./out/%.png,$(wildcard ./data/*.xpm))
png_from_svg := $(patsubst ./data/%.svg,./out/%.png,$(filter-out ./data/quake1+2.svg,$(wildcard ./data/*.svg)))
png       := $(png_from_xpm) $(png_from_svg) out/memento-mori.png
simplified_svg := $(patsubst ./data/%.svg,./out/%.svg,$(filter-out ./data/quake1+2.svg,$(wildcard ./data/*.svg)))
# We deliberately don't compress and install memento-mori{,-2}.svg because
# they use features that aren't supported by librsvg, so they'd look wrong
# in all GTK-based environments.
svgz      := $(patsubst ./out/%.svg,./out/%.svgz,$(filter-out ./out/memento-mori-2.svg,$(simplified_svg)))
in_yaml   := $(wildcard ./data/*.yaml)
test_yaml   := $(wildcard ./tests/data/*.yaml)
json_from_data := $(patsubst ./data/%.yaml,./out/vfs/%.json,$(in_yaml))
json_from_tests := $(patsubst ./tests/data/%.yaml,./out/tests/vfs/%.json,$(test_yaml))
copyright := $(patsubst ./data/%,./out/%,$(wildcard ./data/*.copyright) ./data/copyright)
dot_in    := $(patsubst ./data/%,./out/%,$(wildcard ./data/*.in))
desktop   := $(patsubst ./runtime/%.in,./out/%,$(wildcard ./runtime/*.desktop.in))

launcher_json := $(patsubst ./runtime/launch-%.yaml.in,./out/launch-%.json,$(wildcard ./runtime/launch-*.yaml.in))
launcher_desktops := \
	out/unreal.desktop \
	out/unreal-gold.desktop \
	out/ut99.desktop \
	$(NULL)

quake_layer_sizes = 16 22 32 48 256

quake_icons = \
	out/24/quake.png \
	out/24/quake-armagon.png \
	out/24/quake-dissolution.png \
	out/24/quake2.png \
	out/24/quake2-reckoning.png \
	out/24/quake2-groundzero.png \
	out/24/quake4.png \
	out/quake.svg \
	out/quake-armagon.svg \
	out/quake-dissolution.svg \
	out/quake2.svg \
	out/quake2-reckoning.svg \
	out/quake2-groundzero.svg \
	out/256/quake3.png \
	out/256/quake3-team-arena.png \
	out/quake4.svg \
	out/48/quake3.png \
	out/48/quake3-team-arena.png \
	$(patsubst %,out/%/quake.png,$(quake_layer_sizes)) \
	$(patsubst %,out/%/quake-armagon.png,$(quake_layer_sizes)) \
	$(patsubst %,out/%/quake-dissolution.png,$(quake_layer_sizes)) \
	$(patsubst %,out/%/quake2.png,$(quake_layer_sizes)) \
	$(patsubst %,out/%/quake2-reckoning.png,$(quake_layer_sizes)) \
	$(patsubst %,out/%/quake2-groundzero.png,$(quake_layer_sizes)) \
	$(patsubst %,out/%/quake4.png,$(quake_layer_sizes)) \
	$(NULL)

all: $(png) $(svgz) $(json_from_data) $(launcher_json) \
      $(copyright) $(dot_in) $(desktop) $(quake_icons) \
      $(json_from_tests) \
      out/bash_completion out/changelog.gz \
      out/game-data-packager out/vfs.zip out/memento-mori-2.svg \
      out/tests/changelog.gz out/tests/vfs.zip out/tests/copyright

configure.mk: configure game_data_packager/version.py
	./config.status

out/CACHEDIR.TAG:
	@mkdir -p out
	( echo "Signature: 8a477f597d28d17""2789f06886806bc55"; \
	echo "# This file marks this directory to not be backed up."; \
	echo "# For information about cache directory tags, see:"; \
	echo "#	http://www.brynosaurus.com/cachedir/" ) > $@

$(copyright) $(dot_in): out/%: data/% out/CACHEDIR.TAG
	if [ -L $< ]; then cp -a $< $@ ; else install -m644 $< $@ ; fi

$(json_from_data): out/vfs/%.json: data/%.yaml tools/compile_yaml.py out/CACHEDIR.TAG
	@mkdir -p out/vfs
	PYTHONPATH=$(CURDIR) $(PYTHON) tools/compile_yaml.py $< $@

$(json_from_tests): out/tests/vfs/%.json: tests/data/%.yaml tools/compile_yaml.py out/CACHEDIR.TAG
	@mkdir -p out/tests/vfs
	PYTHONPATH=$(CURDIR) $(PYTHON) tools/compile_yaml.py $< $@

out/vfs.zip: $(json_from_data)
	rm -f $@
	chmod 0644 out/vfs/*
	if [ -n "$(SOURCE_DATE_EPOCH)" ]; then \
		touch --date='@$(SOURCE_DATE_EPOCH)' out/vfs/*; \
	fi
	cd out/vfs && ls -1 | LC_ALL=C sort | \
		env TZ=UTC zip ../vfs.zip -9 -X -q -@

out/tests/vfs.zip: $(json_from_tests)
	rm -f $@
	chmod 0644 out/tests/vfs/*
	if [ -n "$(SOURCE_DATE_EPOCH)" ]; then \
		touch --date='@$(SOURCE_DATE_EPOCH)' out/tests/vfs/*; \
	fi
	cd out/tests/vfs && ls -1 | LC_ALL=C sort | \
		env TZ=UTC zip ../vfs.zip -9 -X -q -@

out/bash_completion: $(in_yaml) out/CACHEDIR.TAG
	$(PYTHON) tools/bash_completion.py > ./out/bash_completion
	chmod 0644 ./out/bash_completion

out/changelog.gz: debian/changelog out/CACHEDIR.TAG
	gzip -nc9 debian/changelog > ./out/changelog.gz
	chmod 0644 ./out/changelog.gz

out/tests/changelog.gz out/tests/copyright: out/tests/%: out/%
	@mkdir -p out/tests
	cp -a $< $@

out/game-data-packager: run out/CACHEDIR.TAG
	install run out/game-data-packager

$(simplified_svg): out/%.svg: data/%.svg out/CACHEDIR.TAG
	inkscape --export-plain-svg=$@ $<

out/memento-mori.svg: data/memento-mori-2.svg out/CACHEDIR.TAG
	inkscape --export-plain-svg=$@ --export-id=layer1 --export-id-only $<

out/memento-mori.png: out/memento-mori.svg
	inkscape --export-png=$@ -w96 -h96 $<

$(png_from_xpm): out/%.png: data/%.xpm out/CACHEDIR.TAG
	convert $< $@

$(png_from_svg): out/%.png: data/%.svg out/CACHEDIR.TAG
	inkscape --export-png=$@ -w96 -h96 $<

$(svgz): out/%.svgz: out/%.svg
	gzip -nc $< > $@

out/quake.svg: data/quake1+2.svg out/CACHEDIR.TAG
	xmlstarlet ed -d "//*[local-name() = 'g' and @inkscape:groupmode = 'layer' and @id != 'layer-quake-256']" < $< > out/tmp/quake.svg
	inkscape \
		--export-area-page \
		--export-plain-svg=$@ \
		out/tmp/quake.svg
	rm -f out/tmp/quake.svg

out/quake-%.svg: out/tmp/recolour-%.svg out/CACHEDIR.TAG
	xmlstarlet ed -d "//*[local-name() = 'g' and @inkscape:groupmode = 'layer' and @id != 'layer-quake-256']" < $< > out/tmp/quake-$*.svg
	inkscape \
		--export-area-page \
		--export-plain-svg=$@ \
		out/tmp/quake-$*.svg
	rm -f out/tmp/quake-$*.svg

out/quake2.svg: data/quake1+2.svg out/CACHEDIR.TAG
	xmlstarlet ed -d "//*[local-name() = 'g' and @inkscape:groupmode = 'layer' and @id != 'layer-quake2-256']" < $< > out/tmp/quake2.svg
	inkscape \
		--export-area-page \
		--export-plain-svg=$@ \
		out/tmp/quake2.svg
	rm -f out/tmp/quake2.svg

out/quake4.svg: data/quake1+2.svg out/CACHEDIR.TAG
	xmlstarlet ed -d "//*[local-name() = 'g' and @inkscape:groupmode = 'layer' and @id != 'layer-quake4-256']" < $< > out/tmp/quake4.svg
	inkscape \
		--export-area-page \
		--export-plain-svg=$@ \
		out/tmp/quake4.svg
	rm -f out/tmp/quake4.svg

out/quake2-%.svg: out/tmp/recolour-%.svg out/CACHEDIR.TAG
	xmlstarlet ed -d "//*[local-name() = 'g' and @inkscape:groupmode = 'layer' and @id != 'layer-quake2-256']" < $< > out/tmp/quake2-$*.svg
	inkscape \
		--export-area-page \
		--export-plain-svg=$@ \
		out/tmp/quake2-$*.svg
	rm -f out/tmp/quake2-$*.svg

out/256/quake3.png: data/quake3-tango.xcf out/CACHEDIR.TAG
	install -d out/256
	# fallback, result is similar, yet different
	if command -v xcf2png > /dev/null ; then \
	  xcf2png -o $@ $< ;\
	else \
	  convert $< -background rgba\(0,0,0,0\) -layers merge $@ ;\
	fi

out/256/quake3-team-arena.png: data/quake3-teamarena-tango.xcf out/CACHEDIR.TAG
	install -d out/256
	if command -v xcf2png > /dev/null ; then \
          xcf2png -o $@ $< ;\
	else \
          convert $< -background rgba\(0,0,0,0\) -layers merge $@ ;\
	fi

out/48/quake3.png: out/256/quake3.png out/CACHEDIR.TAG
	install -d out/48
	convert -resize 48x48 $< $@

out/48/quake3-team-arena.png: out/256/quake3-team-arena.png out/CACHEDIR.TAG
	install -d out/48
	convert -resize 48x48 $< $@

out/tmp/recolour-dissolution.svg: data/quake1+2.svg Makefile out/CACHEDIR.TAG
	install -d out/tmp
	sed -e 's/#c17d11/#999984/' \
		-e 's/#d5b582/#dede95/' \
		-e 's/#5f3b01/#403f31/' \
		-e 's/#e9b96e/#dede95/' \
		< $< > $@

out/tmp/recolour-armagon.svg: data/quake1+2.svg Makefile out/CACHEDIR.TAG
	install -d out/tmp
	sed -e 's/#c17d11/#565248/' \
		-e 's/#d5b582/#aba390/' \
		-e 's/#5f3b01/#000000/' \
		-e 's/#e9b96e/#aba390/' \
		< $< > $@

out/tmp/recolour-reckoning.svg: data/quake1+2.svg Makefile out/CACHEDIR.TAG
	install -d out/tmp
	sed -e 's/#3a5a1e/#999984/' \
		-e 's/#73ae3a/#eeeeec/' \
		-e 's/#8ae234/#eeeeec/' \
		-e 's/#132601/#233436/' \
		< $< > $@

out/tmp/recolour-groundzero.svg: data/quake1+2.svg Makefile out/CACHEDIR.TAG
	install -d out/tmp
	sed -e 's/#3a5a1e/#ce5c00/' \
		-e 's/#73ae3a/#fce94f/' \
		-e 's/#8ae234/#fce94f/' \
		-e 's/#132601/#cc0000/' \
		< $< > $@

out/24/quake.png: out/22/quake.png out/CACHEDIR.TAG
	install -d out/24
	convert -bordercolor Transparent -border 1x1 $< $@

out/24/quake-%.png: out/22/quake-%.png out/CACHEDIR.TAG
	install -d out/24
	convert -bordercolor Transparent -border 1x1 $< $@

out/24/quake2.png: out/22/quake2.png out/CACHEDIR.TAG
	install -d out/24
	convert -bordercolor Transparent -border 1x1 $< $@

out/24/quake4.png: out/22/quake4.png out/CACHEDIR.TAG
	install -d out/24
	convert -bordercolor Transparent -border 1x1 $< $@

out/24/quake2-%.png: out/22/quake2-%.png out/CACHEDIR.TAG
	install -d out/24
	convert -bordercolor Transparent -border 1x1 $< $@

$(patsubst %,out/%/quake.png,$(quake_layer_sizes)): out/%/quake.png: data/quake1+2.svg out/CACHEDIR.TAG
	install -d out/$*
	inkscape \
		--export-area=0:0:$*:$* \
		--export-width=$* \
		--export-height=$* \
		--export-id=layer-quake-$* \
		--export-id-only \
		--export-png=$@ \
		$<

$(patsubst %,out/%/quake-armagon.png,$(quake_layer_sizes)): out/%/quake-armagon.png: out/tmp/recolour-armagon.svg out/CACHEDIR.TAG
	install -d out/$*
	inkscape \
		--export-area=0:0:$*:$* \
		--export-width=$* \
		--export-height=$* \
		--export-id=layer-quake-$* \
		--export-id-only \
		--export-png=$@ \
		$<

$(patsubst %,out/%/quake-dissolution.png,$(quake_layer_sizes)): out/%/quake-dissolution.png: out/tmp/recolour-dissolution.svg out/CACHEDIR.TAG
	install -d out/$*
	inkscape \
		--export-area=0:0:$*:$* \
		--export-width=$* \
		--export-height=$* \
		--export-id=layer-quake-$* \
		--export-id-only \
		--export-png=$@ \
		$<

$(patsubst %,out/%/quake2.png,$(quake_layer_sizes)): out/%/quake2.png: data/quake1+2.svg out/CACHEDIR.TAG
	install -d out/$*
	inkscape \
		--export-area=0:0:$*:$* \
		--export-width=$* \
		--export-height=$* \
		--export-id=layer-quake2-$* \
		--export-id-only \
		--export-png=$@ \
		$<

$(patsubst %,out/%/quake4.png,16 22 32): out/%/quake4.png: data/quake1+2.svg out/CACHEDIR.TAG
	install -d out/$*
	inkscape \
		--export-area=0:0:32:32 \
		--export-width=$* \
		--export-height=$* \
		--export-id=layer-quake4-32 \
		--export-id-only \
		--export-png=$@ \
		$<

$(patsubst %,out/%/quake4.png,48 256): out/%/quake4.png: data/quake1+2.svg out/CACHEDIR.TAG
	install -d out/$*
	inkscape \
		--export-area=0:0:$*:$* \
		--export-width=$* \
		--export-height=$* \
		--export-id=layer-quake4-$* \
		--export-id-only \
		--export-png=$@ \
		$<

$(patsubst %,out/%/quake2-reckoning.png,$(quake_layer_sizes)): out/%/quake2-reckoning.png: out/tmp/recolour-reckoning.svg out/CACHEDIR.TAG
	install -d out/$*
	inkscape \
		--export-area=0:0:$*:$* \
		--export-width=$* \
		--export-height=$* \
		--export-id=layer-quake2-$* \
		--export-id-only \
		--export-png=$@ \
		$<

$(patsubst %,out/%/quake2-groundzero.png,$(quake_layer_sizes)): out/%/quake2-groundzero.png: out/tmp/recolour-groundzero.svg out/CACHEDIR.TAG
	install -d out/$*
	inkscape \
		--export-area=0:0:$*:$* \
		--export-width=$* \
		--export-height=$* \
		--export-id=layer-quake2-$* \
		--export-id-only \
		--export-png=$@ \
		$<

$(launcher_json): out/launch-%.json: out/launch-%.yaml
	PYTHONPATH=$(CURDIR) $(PYTHON) tools/yaml2json.py $< $@

$(desktop) $(patsubst %.json,%.yaml,$(launcher_json)): out/%: runtime/%.in out/CACHEDIR.TAG
	PYTHONPATH=. $(PYTHON) tools/expand_vars.py $< $@

clean:
	rm -fr out
	rm -rf game_data_packager/__pycache__
	rm -rf game_data_packager/games/__pycache__
	rm -rf game_data_packager/packaging/__pycache__
	rm -rf game_data_packager/unpack/__pycache__
	rm -rf tools/__pycache__

distclean: clean
	rm -f configure.mk config.status

check-tests:
	set -e; \
	for x in tests/*.py tools/check_equivalence.py tools/check_syntax.py; do \
		case "$$x" in \
			(*/__init__.py) \
				continue;; \
		esac; \
		ln -sf ../../"$$x" debian/tests/"$$(basename "$${x%.py}" | tr _ -)"; \
	done
	LC_ALL=C.UTF-8 $(PYFLAKES3) game_data_packager/*.py game_data_packager/*/*.py runtime/*.py tests/*.py tools/*.py || :
	LC_ALL=C.UTF-8 GDP_UNINSTALLED=1 PYTHONPATH=. $(PYTHON) tests/deb.py
	LC_ALL=C.UTF-8 GDP_UNINSTALLED=1 PYTHONPATH=. $(PYTHON) tests/hashed_file.py
	LC_ALL=C.UTF-8 GDP_UNINSTALLED=1 PYTHONPATH=. $(PYTHON) tests/integration.py
	LC_ALL=C.UTF-8 GDP_UNINSTALLED=1 PYTHONPATH=. $(PYTHON) tests/rpm.py
	LC_ALL=C.UTF-8 GDP_UNINSTALLED=1 PYTHONPATH=. $(PYTHON) tests/umod.py
	LC_ALL=C.UTF-8 GDP_UNINSTALLED=1 PYTHONPATH=. $(PYTHON) tools/check_syntax.py
	LC_ALL=C.UTF-8 GDP_UNINSTALLED=1 PYTHONPATH=. $(PYTHON) tools/check_equivalence.py
	LC_ALL=C.UTF-8 GDP_UNINSTALLED=1 PYTHONPATH=. $(PYTHON) tests/download_shareware.py

check: check-tests
	# Re-test with Python 3.5 if installed, since that's what's in
	# Debian stable
	if command -v python3.5 >/dev/null; then \
		$(MAKE) check-tests PYTHON=python3.5; \
	fi

manual-check:
	LC_ALL=C.UTF-8 GDP_UNINSTALLED=1 PYTHONPATH=. $(PYTHON) tools/check_gog.py
	LC_ALL=C.UTF-8 GDP_UNINSTALLED=1 PYTHONPATH=. $(PYTHON) tools/check_steam.py

install:
	mkdir -p $(DESTDIR)$(bindir)
	install -m0755 out/game-data-packager                  $(DESTDIR)$(bindir)/${program_prefix}game-data-packager

	mkdir -p $(DESTDIR)$(pkgdatadir)
	cp -ar game_data_packager/                             $(DESTDIR)$(pkgdatadir)/
	install -m0644 out/version.py                          $(DESTDIR)$(pkgdatadir)/game_data_packager/
	install -m0644 out/*.copyright                         $(DESTDIR)$(pkgdatadir)/
	install -m0644 out/*.png                               $(DESTDIR)$(pkgdatadir)/
	install -m0644 data/*.png                              $(DESTDIR)$(pkgdatadir)/
	install -m0644 out/*.preinst.in                        $(DESTDIR)$(pkgdatadir)/
	install -m0644 out/*.svgz                              $(DESTDIR)$(pkgdatadir)/
	install -m0644 out/bash_completion                     $(DESTDIR)$(pkgdatadir)/
	install -m0644 out/changelog.gz                        $(DESTDIR)$(pkgdatadir)/
	install -m0644 out/copyright                           $(DESTDIR)$(pkgdatadir)/
	install -m0644 out/vfs.zip                             $(DESTDIR)$(pkgdatadir)/

	install -d                                             $(DESTDIR)$(runtimedir)/
	install runtime/gdp_launcher_base.py                   $(DESTDIR)$(runtimedir)/
	install -m0644 out/version.py                          $(DESTDIR)$(runtimedir)/gdp_launcher_version.py
	install runtime/gdp-launcher.py                        $(DESTDIR)$(runtimedir)/gdp-launcher
	install runtime/openurl.py                             $(DESTDIR)$(runtimedir)/gdp-openurl
	install -m0644 $(launcher_desktops)                    $(DESTDIR)$(runtimedir)/
	install -m0644 runtime/confirm-binary-only.txt         $(DESTDIR)$(runtimedir)/
	install -m0644 runtime/missing-data.txt                $(DESTDIR)$(runtimedir)/
	ln -snf missing-data.txt                               $(DESTDIR)$(runtimedir)/unreal.missing-engine.txt
	ln -snf missing-data.txt                               $(DESTDIR)$(runtimedir)/ut99.missing-engine.txt
	install -m0644 runtime/quakeX.missing-data.txt         $(DESTDIR)$(runtimedir)/
	ln -snf quakeX.missing-data.txt                        $(DESTDIR)$(runtimedir)/etqw.missing-data.txt
	ln -snf quakeX.missing-data.txt                        $(DESTDIR)$(runtimedir)/etqw.missing-engine.txt
	ln -snf quakeX.missing-data.txt                        $(DESTDIR)$(runtimedir)/quake.missing-data.txt
	ln -snf quakeX.missing-data.txt                        $(DESTDIR)$(runtimedir)/quake2.missing-data.txt
	ln -snf quakeX.missing-data.txt                        $(DESTDIR)$(runtimedir)/quake3.missing-data.txt
	ln -snf quakeX.missing-data.txt                        $(DESTDIR)$(runtimedir)/quake4.missing-data.txt
	ln -snf quakeX.missing-data.txt                        $(DESTDIR)$(runtimedir)/quake4.missing-engine.txt
	install -m0644 $(launcher_json)                        $(DESTDIR)$(runtimedir)/
	install -d                                             $(DESTDIR)${gamedatadir}/quake/
	install -m644 out/version.py                           $(DESTDIR)${gamedatadir}/quake/gdp_launcher_version.py
	install -m755 runtime/gdp_launcher_base.py             $(DESTDIR)${gamedatadir}/quake/quake-server
	install -d                                             $(DESTDIR)${gamedatadir}/quake2/
	install -m644 out/version.py                           $(DESTDIR)${gamedatadir}/quake2/gdp_launcher_version.py
	install -m755 runtime/gdp_launcher_base.py             $(DESTDIR)${gamedatadir}/quake2/quake2-server
	install -d                                             $(DESTDIR)${gamedatadir}/quake3/
	install -m644 out/version.py                           $(DESTDIR)${gamedatadir}/quake3/gdp_launcher_version.py
	install -m755 runtime/gdp_launcher_base.py             $(DESTDIR)${gamedatadir}/quake3/quake3-server
	install -d                                             $(DESTDIR)${gamedatadir}/quake4/
	install -m644 out/version.py                           $(DESTDIR)${gamedatadir}/quake4/gdp_launcher_version.py
	install -m755 runtime/gdp_launcher_base.py             $(DESTDIR)${gamedatadir}/quake4/quake4-dedicated
	install -d                                             $(DESTDIR)${libdir}/etqw/
	install -m644 out/version.py                           $(DESTDIR)${libdir}/etqw/gdp_launcher_version.py
	install -m755 runtime/gdp_launcher_base.py             $(DESTDIR)${libdir}/etqw/etqw-dedicated
	install -d                                             $(DESTDIR)${sysconfdir}/apparmor.d/
	install -m0644 etc/apparmor.d/*                        $(DESTDIR)${sysconfdir}/apparmor.d/

	mkdir -p $(DESTDIR)${datadir}/bash-completion/completions
	install -m0644 data/bash-completion/game-data-packager $(DESTDIR)${datadir}/bash-completion/completions/
	sed -i 's#pkgdatadir=.*#pkgdatadir=$(pkgdatadir)#g' $(DESTDIR)${datadir}/bash-completion/completions/game-data-packager

	mkdir -p $(DESTDIR)${mandir}/man6/
	mkdir -p $(DESTDIR)${mandir}/fr/man6/
	install -m0644 doc/game-data-packager.6                $(DESTDIR)${mandir}/man6/
	install -m0644 doc/game-data-packager.fr.6             $(DESTDIR)${mandir}/fr/man6/game-data-packager.6

	mkdir -p $(DESTDIR)/etc/game-data-packager
	install -m0644 etc/game-data-packager.conf             $(DESTDIR)${sysconfdir}/
	install -m0644 etc/*-mirrors                           $(DESTDIR)${sysconfdir}/game-data-packager/

	mkdir -p $(DESTDIR)${datadir}/applications
	mkdir -p $(DESTDIR)${datadir}/pixmaps
	install -m0755 runtime/doom2-masterlevels.py           $(DESTDIR)$(bindir)/${program_prefix}doom2-masterlevels
	install -m0644 out/doom2-masterlevels.desktop          $(DESTDIR)${datadir}/applications/
	install -m0644 doc/doom2-masterlevels.6                $(DESTDIR)${mandir}/man6/
	install -m0644 out/doom-common.png                     $(DESTDIR)${datadir}/pixmaps/doom2-masterlevels.png
	install -d                                             $(DESTDIR)$(bindir)
	ln -s ${runtimedir}/gdp-launcher                       $(DESTDIR)$(bindir)/${program_prefix}quake
	ln -s ${gamedatadir}/quake/quake-server                $(DESTDIR)$(bindir)/${program_prefix}quake-server
	ln -s ${runtimedir}/gdp-launcher                       $(DESTDIR)$(bindir)/${program_prefix}quake2
	ln -s ${gamedatadir}/quake2/quake2-server              $(DESTDIR)$(bindir)/${program_prefix}quake2-server
	ln -s ${runtimedir}/gdp-launcher                       $(DESTDIR)$(bindir)/${program_prefix}quake3
	ln -s ${gamedatadir}/quake3/quake3-server              $(DESTDIR)$(bindir)/${program_prefix}quake3-server
	ln -s ${runtimedir}/gdp-launcher                       $(DESTDIR)$(bindir)/${program_prefix}quake4
	ln -s ${gamedatadir}/quake4/quake4-dedicated           $(DESTDIR)$(bindir)/${program_prefix}quake4-dedicated
	ln -s ${runtimedir}/gdp-launcher                       $(DESTDIR)$(bindir)/${program_prefix}etqw
	ln -s ${libdir}/etqw/etqw-dedicated                    $(DESTDIR)$(bindir)/${program_prefix}etqw-dedicated
	install -d                                             $(DESTDIR)$(datadir)/applications
	install -m644 out/etqw.desktop                         $(DESTDIR)$(datadir)/applications
	install -m644 out/quake*.desktop                       $(DESTDIR)$(datadir)/applications
	install -d                                             $(DESTDIR)$(datadir)/icons/hicolor/16x16/apps
	install -m644 out/16/*.png                             $(DESTDIR)$(datadir)/icons/hicolor/16x16/apps
	install -d                                             $(DESTDIR)$(datadir)/icons/hicolor/22x22/apps
	install -m644 out/22/*.png                             $(DESTDIR)$(datadir)/icons/hicolor/22x22/apps
	install -d                                             $(DESTDIR)$(datadir)/icons/hicolor/24x24/apps
	install -m644 out/24/*.png                             $(DESTDIR)$(datadir)/icons/hicolor/24x24/apps
	install -d                                             $(DESTDIR)$(datadir)/icons/hicolor/32x32/apps
	install -m644 out/32/*.png                             $(DESTDIR)$(datadir)/icons/hicolor/32x32/apps
	install -d                                             $(DESTDIR)$(datadir)/icons/hicolor/48x48/apps
	install -m644 out/48/*.png                             $(DESTDIR)$(datadir)/icons/hicolor/48x48/apps
	install -d                                             $(DESTDIR)$(datadir)/icons/hicolor/256x256/apps
	install -m644 out/256/*.png                            $(DESTDIR)$(datadir)/icons/hicolor/256x256/apps
	install -d                                             $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps
	install -m644 out/quake*.svg                           $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps
	install -m644 out/quake-*.svg                          $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps
	install -m644 out/quake2*.svg                          $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps
	install -m644 out/quake4*.svg                          $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps
	install -d                                             $(DESTDIR)${mandir}/man6
	install -m644 doc/etqw*.6                              $(DESTDIR)${mandir}/man6
	install -m644 doc/quake*.6                             $(DESTDIR)${mandir}/man6

html: $(DIRS) $(json)
	LC_ALL=C.UTF-8 GDP_UNINSTALLED=1 PYTHONPATH=. python3 -m tools.babel
	rsync -P -e ssh out/index.html illusion.pseudorandom.co.uk:/srv/game-data-packager.debian.net/www/available.html -e ssh

.PHONY: all clean distclean check install html