File: rules

package info (click to toggle)
ogamesim 20130107-3
  • links: PTS
  • area: main
  • in suites: buster, sid
  • size: 804 kB
  • ctags: 214
  • sloc: ansic: 1,621; perl: 1,041; makefile: 201
file content (118 lines) | stat: -rwxr-xr-x 2,622 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
#!/usr/bin/make -f
# -*- makefile -*-

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

SIMULATOR	:=	ogamesim
WEBGUI		:=	ogamesim-www

SIMPATH		:=	/usr/games/$(SIMULATOR)

REVISION	:=	$(shell dpkg-parsechangelog| \
	grep '^Version' | sed 's/.*-//')

DEBVERSION	:=	$(shell dpkg-parsechangelog| \
	grep '^Version' | awk '{ print $$2 }'| sed 's/-.*//')


SIMVERSION	:=	$(shell grep 'define[[:space:]]\+VERSION' \
	csim/version.h | \
	awk -- '{ print $$3 }' | \
	sed 's/[^0-9\.]//g')-$(REVISION)
GUIVERSION	:=	$(shell grep 'our[[:space:]]\+$$VERSION' \
	www/index.cgi| \
	sed 's/.*=//'| \
	sed 's/[^0-9\.]//g')-$(REVISION)

DOWNLOAD_URL	:=	'http://www.o-o-d.com/tool/sim/sim.tar.bz2'

tarball: clean
	test -d ../ogamesim-$(DEBVERSION)
	cd .. && \
		tar --exclude=debian --exclude=.git \
			-czvf ogamesim_$(DEBVERSION).orig.tar.gz \
			ogamesim-$(DEBVERSION)

build: build-stamp

build-stamp:
	dh_testdir
	make -C csim for_linux
	cp csim/csim $(SIMULATOR)
	make -C www
	install -m 0755 www/index.cgi .
	perl -pi -e \
		's#^my\s+\$$units_conf.*#my \$$units_conf = "units.conf";#; \
		 s#^my\s+\$$lang.*#my \$$lang = "en";#; \
		 s#my\s+\$$counter_file.*#my \$$counter_file = "";#; \
		 s#^my\s+\$$simulator.*#my \$$simulator = "$(SIMPATH)";#' \
		index.cgi
	mkdir -p template
	for tmpl in `ls www/template/|grep 'sim\...\.html$$'`; do \
		cat www/template/$$tmpl \
		|sed 's~href="sim\.tar\.bz2"~href="$(DOWNLOAD_URL)"~' \
		> template/$$tmpl; \
	done
	install -m 0644 csim/csim.6 $(SIMULATOR).6
	perl -pi -e 's/csim/$(SIMULATOR)/g' $(SIMULATOR).6
	touch $@


clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp $(SIMULATOR) install-stamp \
		csim/csim index.cgi $(SIMULATOR).6
	rm -fr template
	make -C csim clean
	dh_clean

install: build install-stamp

install-stamp:
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	dh_install
	dh_installdocs -A
	dh_installchangelogs
	dh_installexamples
	dh_installman
	touch $@

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_gencontrol -p$(WEBGUI) -- -v$(GUIVERSION)
	dh_link
	dh_strip
	dh_compress -A
	dh_fixperms
	dh_installdeb
	dh_md5sums
	dh_builddeb -p$(WEBGUI)

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_shlibdeps -p$(SIMULATOR)
	dh_gencontrol -p$(SIMULATOR) -- -v$(SIMVERSION)
	dh_link
	dh_strip
	dh_compress -A
	dh_fixperms
	dh_installdeb
	dh_md5sums
	dh_builddeb -p$(SIMULATOR)

binary: binary-indep binary-arch

build-arch: build

build-indep: build

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