File: rules

package info (click to toggle)
crawl 2%3A0.34.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 100,188 kB
  • sloc: cpp: 363,709; ansic: 27,765; javascript: 9,516; python: 8,463; perl: 3,293; java: 3,132; xml: 2,380; makefile: 1,835; sh: 611; objc: 250; cs: 15; sed: 9; lisp: 3
file content (149 lines) | stat: -rwxr-xr-x 4,961 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
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
#!/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
ifneq (,$(findstring arm64,$(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
## Package fails to build on ubuntu with LTO unless -g is remove on my system.
## Doesn't build on debian testing even with -g removed. --gammafunk
CFOPTIMIZE := $(filter-out -g,$(CFOPTIMIZE))

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 \
	PROPORTIONAL_FONT=$(shell fc-match -f "${file}" dejavusans) \
	MONOSPACED_FONT=$(shell fc-match -f "${file}" dejavusansmono)

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

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 install-xdg-data DESTDIR=../../debian/crawl-common
	rm -rf debian/crawl-common/usr/share/crawl/docs/license
	mkdir -p debian/crawl/usr/share
	mv debian/crawl-common/usr/games debian/crawl/usr/games
	mv debian/crawl-common/usr/share/applications debian/crawl/usr/share
	mv debian/crawl-common/usr/share/icons debian/crawl/usr/share
	mv debian/crawl-common/usr/share/metainfo debian/crawl/usr/share
	cd build-tiles/source && $(MAKE) $(ARGS_TILES) install install-xdg-data 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
	
	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

# Build architecture-independent files here.
binary-indep: install
	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_link -a
	dh_compress -a -Xaptitudes.txt
	dh_strip -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	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