File: rules

package info (click to toggle)
heroes 0.21-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 4,716 kB
  • ctags: 3,157
  • sloc: ansic: 27,954; sh: 3,959; makefile: 722; yacc: 318; sed: 51; lisp: 10; perl: 9
file content (146 lines) | stat: -rwxr-xr-x 4,433 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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

# This is the debhelper compatability version to use.
export DH_COMPAT=3

# Set one of these to an empty value to disable the given target.
BUILD_GGI=$(shell dpkg -s libggi2-dev | grep -q "^Status:.* installed$$" && echo yes)
BUILD_SDL=$(shell dpkg -s libsdl1.2-dev | grep -q "^Status:.* installed$$" && echo yes)

ifeq ($(BUILD_GGI), yes)

ifeq ($(BUILD_SDL), yes)

DH_OPTIONS_ARCH=-pheroes-ggi -pheroes-sdl
INSTALL_TARGETS=install-ggi install-sdl
else

DH_OPTIONS_ARCH=-pheroes-ggi
INSTALL_TARGETS=install-ggi
endif

else

ifeq ($(BUILD_SDL), yes)

DH_OPTIONS_ARCH=-pheroes-sdl
INSTALL_TARGETS=install-sdl
else
$(error ACK!  You have to build at least one of heroes-sdl and heroes-ggi)
endif

endif

ifeq ($(BUILD_GGI), yes)
build-ggi: build-stamp-ggi
build-stamp-ggi:
	echo $(BUILD_GGI)
	echo $(BUILD_SDL)
	dh_testdir

	if [ -f build-stamp-sdl ]; then $(MAKE) distclean; rm -f build-stamp-sdl; fi

	./configure --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --datadir=\$${prefix}/share/games --bindir=\$${prefix}/games --with-ggi --without-sdl --with-mikmod --without-sdl-mixer
	$(MAKE)

	touch build-stamp-ggi
endif

ifeq ($(BUILD_SDL), yes)
build-sdl: build-stamp-sdl
build-stamp-sdl:
	dh_testdir

	if [ -f build-stamp-ggi ]; then $(MAKE) distclean; rm -f build-stamp-ggi; fi

	env LDFLAGS="$$(sdl-config --libs)" ./configure --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --datadir=\$${prefix}/share/games --bindir=\$${prefix}/games --without-ggi --with-sdl --without-mikmod --with-sdl-mixer
	$(MAKE)

	touch build-stamp-sdl
endif

# As suggested in the Packaging Manual, do nothing.
build:

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp-sdl build-stamp-ggi install-stamp

	-$(MAKE) distclean

	dh_clean

ifeq ($(BUILD_GGI), yes)
install-ggi: build-ggi
	dh_testdir
	dh_testroot
	rm -fr debian/heroes-ggi
	dh_installdirs -pheroes-ggi -pheroes-common

	$(MAKE) install prefix=`pwd`/debian/heroes-common/usr # localedir=`pwd`/debian/heroes-common/usr/share/locale
	mv debian/heroes-common/usr/games/heroes debian/heroes-ggi/usr/games/heroes-ggi
	chown root.games debian/heroes-ggi/usr/games/heroes-ggi
	chmod g+s debian/heroes-ggi/usr/games/heroes-ggi
	ln -s heroes-common debian/heroes-ggi/usr/share/doc/heroes-ggi
	ln -s heroes.6.gz debian/heroes-ggi/usr/share/man/man6/heroes-ggi.6.gz
endif

ifeq ($(BUILD_SDL), yes)
install-sdl: build-sdl
	dh_testdir
	dh_testroot
	rm -fr debian/heroes-sdl
	dh_installdirs -pheroes-sdl -pheroes-common

	$(MAKE) install prefix=`pwd`/debian/heroes-common/usr # localedir=`pwd`/debian/heroes-common/usr/share/locale
	mv debian/heroes-common/usr/games/heroes debian/heroes-sdl/usr/games/heroes-sdl
	chown root.games debian/heroes-sdl/usr/games/heroes-sdl
	chmod g+s debian/heroes-sdl/usr/games/heroes-sdl
	ln -s heroes-common debian/heroes-sdl/usr/share/doc/heroes-sdl
	ln -s heroes.6.gz debian/heroes-sdl/usr/share/man/man6/heroes-sdl.6.gz
endif

install-stamp: $(INSTALL_TARGETS)
	touch install-stamp

install: install-stamp

# Build architecture-independent files here.
binary-indep: install

# Build architecture-dependent files here.
binary-arch: install
	mkdir -p debian/heroes-common/usr/X11R6/include/X11/pixmaps
	cp debian/heroes.xpm debian/heroes-common/usr/X11R6/include/X11/pixmaps

	mkdir -m755 -p debian/heroes-common/var/games/heroes
	chown root.root debian/heroes-common/var/games/heroes

	dh_testdir $(DH_OPTIONS_ARCH) -pheroes-common
	dh_testroot $(DH_OPTIONS_ARCH) -pheroes-common
	dh_installdocs $(DH_OPTIONS_ARCH) -pheroes-common
	dh_installmenu $(DH_OPTIONS_ARCH) -pheroes-common

	dh_installchangelogs ChangeLog -pheroes-common
	dh_installinfo doc/heroes.info -pheroes-common

	dh_strip $(DH_OPTIONS_ARCH) -pheroes-common
	dh_compress $(DH_OPTIONS_ARCH) -pheroes-common

	dh_fixperms -Xusr/games/heroes-ggi -Xusr/games/heroes-sdl $(DH_OPTIONS_ARCH)
	dh_fixperms -Xvar/games/heroes -pheroes-common

	dh_installdeb $(DH_OPTIONS_ARCH) -pheroes-common
	dh_shlibdeps $(DH_OPTIONS_ARCH) -pheroes-common
	dh_gencontrol $(DH_OPTIONS_ARCH) -pheroes-common
	dh_md5sums $(DH_OPTIONS_ARCH) -pheroes-common
	dh_builddeb $(DH_OPTIONS_ARCH) -pheroes-common

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