File: rules

package info (click to toggle)
crawl 2%3A0.19.3-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 52,216 kB
  • ctags: 31,092
  • sloc: cpp: 301,387; ansic: 25,373; perl: 3,184; python: 3,148; makefile: 1,643; java: 792; sh: 323; objc: 250; xml: 32; cs: 15; sed: 9; lisp: 3
file content (160 lines) | stat: -rwxr-xr-x 5,585 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/usr/bin/make -f

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
        NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
        MAKEFLAGS += -j$(NUMJOBS)
endif

DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)

ifneq (,$(findstring amd64,$(DEB_HOST_ARCH)))
  LTO=y
endif
ifneq (,$(findstring x32,$(DEB_HOST_ARCH)))
  LTO=y
endif
ifneq (,$(findstring i386,$(DEB_HOST_ARCH)))
  LTO=y
endif

CFOPTIMIZE = $(shell dpkg-buildflags --get CXXFLAGS || echo -g -O2) \
             $(shell dpkg-buildflags --get LDFLAGS) \
             $(shell dpkg-buildflags --get CPPFLAGS)
ifneq ($(LTO),)
  ifeq ($(shell g++ -x c++ /dev/null -flto=jobserver -fwhole-program 2>&1 | grep 'unrecognized command line option'),)
    CFOPTIMIZE += -flto=jobserver -fwhole-program
  endif
  ifeq ($(shell g++ -x c++ /dev/null -fno-fat-lto-objects 2>&1 | grep 'unrecognized command line option'),)
    CFOPTIMIZE += -fno-fat-lto-objects
  endif
endif

ifeq (,$(filter terse%,$(DEB_BUILD_OPTIONS))$(filter quiet%,$(DEB_BUILD_OPTIONS)))
        VERBOSE=V=y
endif

tree-stamp:
	dh_testdir
	mkdir build-console
	cp -ldpR docs settings source CREDITS.txt build-console/
	mkdir build-tiles
	cp -ldpR docs settings source CREDITS.txt build-tiles/
	touch tree-stamp

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	CROSS=CROSSHOST=$(DEB_HOST_GNU_TYPE)
endif

# The makefile is unorthodox, requiring all options to be specified on every invocation.
ARGS_CONSOLE = prefix=/usr CFOPTIMIZE="$(CFOPTIMIZE)" STRIP=: $(CROSS) $(VERBOSE)
ARGS_TILES   = $(ARGS_CONSOLE) TILES=y GAME=crawl-tiles USE_ADVPNG= \
	PROPORTIONAL_FONT=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf \
	MONOSPACED_FONT=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf

build-arch build-indep: build-stamp
build-stamp: tree-stamp
	dh_testdir

	cd build-console/source && $(MAKE) $(ARGS_CONSOLE)
	cd build-tiles/source && $(MAKE) $(ARGS_TILES)

	touch build-stamp

# This should be done during build not install but upstream makefile makes
# it hard to isolate the targets the proper way.
install-indep: install
ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
	cd debian/crawl-tiles-data/usr/share/crawl && parallel advpng -z -4 -- \
		`find dat/tiles -name '*.png' -not -name 'title_*' -not -name 'stone_soup*'`
endif

clean:
	dh_testdir
	dh_testroot

	rm -f build-stamp tree-stamp
	rm -rf build-console build-tiles

	git clean -dfX || true

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	cd build-console/source && $(MAKE) $(ARGS_CONSOLE) install DESTDIR=../../debian/crawl-common
	#cd debian/crawl-common/usr/share && mkdir -p doc/crawl-common && \
	#	mv crawl/docs/* doc/crawl-common && \
	#	mv doc/crawl-common/crawl_manual.txt crawl/docs
	rm -rf debian/crawl-common/usr/share/crawl/docs/license
	mkdir -p debian/crawl/usr/
	mv debian/crawl-common/usr/games debian/crawl/usr/games
	cd build-tiles/source && $(MAKE) $(ARGS_TILES) install DESTDIR=../../debian/crawl-tiles
	rm -rf debian/crawl-tiles/var
	cd debian/crawl-tiles/usr/share/crawl/ && rm -rf docs settings
	mkdir -p debian/crawl-tiles-data/usr/share/crawl/dat
	mv debian/crawl-tiles/usr/share/crawl/dat/tiles debian/crawl-tiles-data/usr/share/crawl/dat/
	rm -rf debian/crawl-tiles/usr/share/crawl/dat
	
	mkdir -p debian/crawl/usr/share/man/man6
	cp docs/crawl.6 debian/crawl/usr/share/man/man6/
	mkdir -p debian/crawl-tiles/usr/share/man/man6
	cp docs/crawl.6 debian/crawl-tiles/usr/share/man/man6/crawl-tiles.6
	mkdir -p debian/crawl-common/usr/share/doc/crawl-common/examples
	cp settings/init.txt debian/crawl-common/usr/share/doc/crawl-common/examples/crawlrc
	for i in docs/*.txt; do \
		ln -sf /usr/share/crawl/$$i debian/crawl-common/usr/share/doc/crawl-common/; \
	done

	mkdir -p debian/crawl/usr/share/doc
	ln -sf crawl-common debian/crawl/usr/share/doc/crawl
	mkdir -p debian/crawl-tiles/usr/share/doc
	ln -sf crawl-common debian/crawl-tiles/usr/share/doc/crawl-tiles
	mkdir -p debian/crawl-tiles-data/usr/share/doc
	ln -sf crawl-common debian/crawl-tiles-data/usr/share/doc/crawl-tiles-data
	dh_install -pcrawl debian/crawl.desktop usr/share/applications/
	dh_install -pcrawl-tiles debian/crawl-tiles.desktop usr/share/applications/
	dh_install -pcrawl-tiles debian/crawl.png usr/share/icons/hicolor/48x48/apps/
	dh_link -pcrawl-tiles usr/share/crawl/dat/tiles/stone_soup_icon-32x32.png \
		usr/share/icons/hicolor/32x32/apps/crawl.png
	mkdir -p debian/crawl-tiles/usr/share/icons/hicolor/scalable/apps
	cp -p source/util/dcss.svg \
		debian/crawl-tiles/usr/share/icons/hicolor/scalable/apps/crawl.svg

# Build architecture-independent files here.
binary-indep: install-indep
	dh_testdir
	dh_testroot
	dh_installdocs -pcrawl-common -Xcrawl_manual.txt -Xaptitudes.txt -Xquickstart.txt -Xmacros_guide.txt -Xoptions_guide.txt -Xtiles_help.txt
	dh_installchangelogs -pcrawl-common docs/changelog.txt
	dh_link -i
	dh_compress -i -Xaptitudes.txt
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: install
	dh_testdir
	dh_testroot
	dh_installmenu -a
	dh_link -a
	dh_compress -a -Xaptitudes.txt
	dh_strip -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a -- --ignore-missing-info
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

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