File: rules

package info (click to toggle)
balazar3 0.1-9
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 45,440 kB
  • ctags: 1,229
  • sloc: python: 5,486; makefile: 71
file content (85 lines) | stat: -rwxr-xr-x 2,959 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
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

VERSIONS:=3d 2d

prepare: prepare-stamp
prepare-stamp:
	dh_testdir
	mkdir build
	$(foreach version,$(VERSIONS),rsync -r --link-dest=. --exclude=build --exclude=debian . build/$(version) ;)
	touch $@

build: $(foreach version,$(VERSIONS), build-$(version))
$(foreach version,$(VERSIONS), build-$(version)): build-%: build-stamp-%
$(foreach version,$(VERSIONS), build-stamp-$(version)): build-stamp-%: prepare
	dh_testdir
	(cd build/$(patsubst build-stamp-%,%,$@)  && \
	 python setup.py build --$(patsubst build-stamp-%,%,$@))
	touch $@

install: $(foreach version,$(VERSIONS), install/$(version))
	# Put files in common in balazar3-common
	find debian -name '*.pyo' -print0 | xargs -0 rm
	find debian/balazar3-2d -type f -name '*_3d.py' -exec rm {} \;
	find debian/balazar3-3d -type f -name '*_2d.py' -exec rm {} \;
	find debian/balazar3-3d -type f -name '*_2d800x480.py' -exec rm {} \;
	(cd debian/balazar3-2d ; find usr/share/games/balazar3 -type f) | sort > debian/2d-files
	(cd debian/balazar3-3d ; find usr/share/games/balazar3 -type f) | sort > debian/3d-files
	echo usr/games/balazar3 >> debian/2d-files
	echo usr/games/balazar3 >> debian/3d-files
	diff -U 99999999 debian/2d-files debian/3d-files | grep '^ ' | while read file; do \
		[ -d debian/balazar3-common/$$(dirname $$file) ] || \
			mkdir -p debian/balazar3-common/$$(dirname $$file) ; \
		mv debian/balazar3-2d/$$file debian/balazar3-common/$$(dirname $$file) ; \
		rm debian/balazar3-3d/$$file ; \
	done
	# Run three times because directories become empty when removing empty subdirectories
	find debian/balazar3-2d debian/balazar3-3d -type d -empty -print0 | xargs -r0 rm -rf
	find debian/balazar3-2d debian/balazar3-3d -type d -empty -print0 | xargs -r0 rm -rf
	find debian/balazar3-2d debian/balazar3-3d -type d -empty -print0 | xargs -r0 rm -rf
$(foreach version,$(VERSIONS), install/$(version)): install/%:
	dh_testdir
	dh_testroot
	dh_installdirs
	(cd build/$(patsubst install/%,%,$@) && \
	 python setup.py install --$(patsubst install/%,%,$@) \
	       --install-scripts=/usr/games \
	       --install-purelib=/usr/share/games --install-data=/usr/share/games \
	       --root=$(CURDIR)/debian/balazar3-$(patsubst install/%,%,$@))
	rm debian/balazar3-$(patsubst install/%,%,$@)/usr/share/games/*.egg-info

binary-arch:
binary-indep: install
	dh_testdir
	dh_testroot
	dh_lintian
	dh_installchangelogs
	dh_installdocs README
	dh_install
	dh_installmenu
	dh_installman
	dh_strip
	dh_compress
	dh_pysupport /usr/share/games/balazar3
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

clean:
	dh_testdir
	dh_testroot
	rm -f $(foreach version,$(VERSIONS), build-stamp-$(version)) prepare-stamp
	rm -f debian/2d-files debian/3d-files
	rm -rf build
	dh_clean

binary: binary-indep
.PHONY: build clean binary-indep binary-arch binary install