File: doom-common.mk

package info (click to toggle)
game-data-packager 37
  • links: PTS, VCS
  • area: contrib
  • in suites: jessie, jessie-kfreebsd
  • size: 512 kB
  • ctags: 97
  • sloc: sh: 235; makefile: 109
file content (77 lines) | stat: -rw-r--r-- 2,667 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
# "IWAD", "VERSION" and "LONG" are passed in by the parent make;
# e.g.
#   IWAD=doom2, VERSION=22, LONG="Doom 2: Hell on Earth"
# or
#   IWAD=doom, VERSION=22, LONG="Ultimate Doom"

$(IWAD)DEB=out/$(IWAD)-wad_$(VERSION)_all.deb

$(IWAD)TARGETS := $(addprefix build/, $(IWAD)DIRS $(IWAD)-wad/DEBIAN/control $(IWAD)-wad/usr/share/doc/$(IWAD)-wad/changelog.gz $(IWAD)-wad/usr/share/pixmaps/$(IWAD).xpm $(IWAD)-wad/DEBIAN/preinst $(IWAD)-wad/usr/share/applications/$(IWAD)-wad.desktop $(IWAD)-wad/usr/share/doc/$(IWAD)-wad/README.Debian $(IWAD)-wad/usr/share/doc/$(IWAD)-wad/copyright $(IWAD)-wad/DEBIAN/md5sums)

# defined as a variable so it can be overriden by the caller, e.g. heretic
GAME = doom
CONTROLIN = doom-common/DEBIAN/control.in

DIRS := \
	$(IWAD)-wad/DEBIAN \
	$(IWAD)-wad/usr/share/pixmaps \
	$(IWAD)-wad/usr/share/applications \
	$(IWAD)-wad/usr/share/doc/$(IWAD)-wad \
	$(IWAD)-wad/usr/share/doc \
	$(IWAD)-wad/usr/share/games/game-data-packager \
	$(IWAD)-wad/usr/share/games/$(GAME) \
	$(IWAD)-wad/usr/share/games \
	$(IWAD)-wad/usr/share \
	$(IWAD)-wad/usr \
	$(IWAD)-wad

$($(IWAD)DEB): $($(IWAD)TARGETS) fixperms 
	cd build/ && fakeroot dpkg-deb -b $(IWAD)-wad ../$@

build/$(IWAD)DIRS:
	mkdir -p $(addprefix "build/", $(DIRS))

build/$(IWAD)-wad/usr/share/doc/$(IWAD)-wad/copyright:
	m4 -DPACKAGE=$(IWAD)-wad -DIWAD=$(IWAD).wad \
		doom-common/usr/share/doc/doom-common/copyright.in \
		> $@

build/$(IWAD)-wad/usr/share/doc/$(IWAD)-wad/README.Debian:
	m4 -DPACKAGE=$(IWAD)-wad -DGAME="$(LONG)" \
		doom-common/usr/share/doc/doom-common/README.Debian.in \
		> $@

build/$(IWAD)-wad/usr/share/applications/$(IWAD)-wad.desktop:
	m4 -DGAME=$(IWAD) -DLONG="$(LONG)" -DENGINE=$(GAME) \
		doom-common/usr/share/applications/doom-common.desktop.in \
		> $@

build/$(IWAD)-wad/DEBIAN/preinst:
	m4 -DIWAD=$(IWAD).wad \
		doom-common/DEBIAN/preinst.in > $@

build/$(IWAD)-wad/DEBIAN/control: $(CONTROLIN)
	m4 -DPACKAGE=$(IWAD)-wad -DGAME=$(IWAD) -DVERSION=$(VERSION) \
		-DLONG="$(LONG)" -DENGINE=$(GAME) $(CONTROLIN) > $@

build/$(IWAD)-wad/usr/share/doc/$(IWAD)-wad/changelog.gz:
	gzip -c9 debian/changelog > $@

build/$(IWAD)-wad/usr/share/pixmaps/$(IWAD).xpm:
	cp -p doom-common/doom2.xpm $@

build/$(IWAD)-wad/DEBIAN/md5sums:
	cd build/$(IWAD)-wad && find usr/ -type f -print0 |\
		xargs -r0 md5sum >DEBIAN/md5sums

fixperms:
	find build/$(IWAD)-wad -type f -print0 | xargs -r0 chmod 644
	find build/$(IWAD)-wad -type d -print0 | xargs -r0 chmod 755
	chmod 755 build/$(IWAD)-wad/DEBIAN/preinst

clean:
	rm -f $($(IWAD)DEB) $($(IWAD)TARGETS)
	-for dir in $(addprefix "build/", $(DIRS)); do \
		[ -d $$dir ] && rmdir $$dir; done

PHONY: fixperms clean