File: rules

package info (click to toggle)
tworld 1.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 6,620 kB
  • ctags: 1,407
  • sloc: ansic: 12,442; perl: 2,465; makefile: 191; sh: 16
file content (138 lines) | stat: -rwxr-xr-x 3,940 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
#!/usr/bin/make -f
# debian/rules for tworld
# copyright 2006-2008 by Gerfried Fuchs <rhonda@debian.at>
# Licenced BSD style

PKG1 = tworld
PKG2 = tworld-data
TMP1 = $(CURDIR)/debian/$(PKG1)
TMP2 = $(CURDIR)/debian/$(PKG2)

INSTALL = install
INSTALL_FILE    = $(INSTALL) -p    -oroot -groot -m644
INSTALL_SCRIPT  = $(INSTALL) -p    -oroot -groot -m755
INSTALL_DIR     = $(INSTALL) -p -d -oroot -groot -m755

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)


CFLAGS  = -Wall -W -fomit-frame-pointer -DNDEBUG
LDFLAGS = -Wall -W

ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif
ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
	LDFLAGS += -s
	STRIP = true
endif

include /usr/share/quilt/quilt.make


clean: unpatch
	$(checkdir)
	$(checkroot)
	[ ! -f Makefile ] || $(MAKE) clean
	-rm -rf $(TMP1) $(TMP2) debian/substvars debian/files build-stamp \
		Makefile oshw-sdl/Makefile oshw install-stamp


config.status: configure patch
	$(checkdir)
	CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure \
		--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
		--prefix=/usr/games --with-sharedir=\$${prefix}/../share/games/tworld \
		--bindir=\$${prefix} --mandir=\$${prefix}/../share/man


build: build-stamp
build-stamp: config.status
	$(checkdir)
	$(MAKE)
	touch build-stamp


install: install-stamp
install-stamp: build
	$(checkdir)
	$(checkroot)
	-rm -rf $(TMP1) $(TMP2)

	$(MAKE) install prefix=$(TMP2)/usr/games
	test "$(STRIP)" != true || strip \
		--remove-section=.comment --remove-section=.note \
		$(TMP2)/usr/games/tworld

	$(INSTALL_DIR) $(TMP1)/usr
	cd $(TMP1)/usr && $(INSTALL_DIR) games share/man/man6 share/doc \
		share/applications share/pixmaps
	mv $(TMP2)/usr/games/tworld $(TMP1)/usr/games
	mv $(TMP2)/usr/share/man/man6/tworld.6 $(TMP1)/usr/share/man/man6
	gzip --best $(TMP1)/usr/share/man/man6/tworld.6
	ln -s $(PKG2) $(TMP1)/usr/share/doc/$(PKG1)
	$(INSTALL_FILE) debian/tworld.desktop $(TMP1)/usr/share/applications
	$(INSTALL_FILE) debian/tworld.xpm $(TMP1)/usr/share/pixmaps

	$(INSTALL_SCRIPT) debian/c4 $(TMP2)/usr/games
	pod2man -s 6 -r 'Tile World' -c '' debian/c4 \
		$(TMP2)/usr/share/man/man6/c4.6
	$(INSTALL_DIR) $(TMP2)/usr/share/doc/$(PKG2)
	$(INSTALL_FILE) BUGS README docs/tworld.html \
		$(TMP2)/usr/share/doc/$(PKG2)
	cd $(TMP2)/usr/share && gzip -9 man/man6/c4.6 \
		doc/$(PKG2)/README doc/$(PKG2)/tworld.html

	touch install-stamp


# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	$(checkdir)
	$(checkroot)
	$(INSTALL_DIR) $(TMP1)/DEBIAN $(TMP2)/DEBIAN \
		$(TMP1)/usr/share/menu

	$(INSTALL_FILE) debian/menu $(TMP1)/usr/share/menu/$(PKG1)
	$(INSTALL_SCRIPT) debian/postinst debian/postrm \
		$(TMP1)/DEBIAN
	dpkg-shlibdeps -Tdebian/substvars -dDepends \
		$(TMP1)/usr/games/*
	dpkg-gencontrol -ldebian/changelog -isp -Tdebian/substvars \
		-p$(PKG1) -P$(TMP1)
	cd $(TMP1) && find * -type f ! -regex '^DEBIAN/.*' -print0 | \
		xargs -r0 md5sum > DEBIAN/md5sums
	dpkg --build $(TMP1) ..

	$(INSTALL_FILE) debian/copyright debian/README.Debian \
		$(TMP2)/usr/share/doc/$(PKG2)
	$(INSTALL_FILE) debian/changelog \
		$(TMP2)/usr/share/doc/$(PKG2)/changelog.Debian
	gzip -9 $(TMP2)/usr/share/doc/$(PKG2)/changelog.Debian
	dpkg-gencontrol -ldebian/changelog -isp \
		-p$(PKG2) -P$(TMP2)
	cd $(TMP2) && find * -type f ! -regex '^DEBIAN/.*' -print0 | \
		xargs -r0 md5sum > DEBIAN/md5sums
	dpkg --build $(TMP2) ..

binary: binary-indep binary-arch


define checkdir
	test -f debian/rules
endef

define checkroot
	test root = "`whoami`"
endef

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