| 1 |
|
| 2 |
|
| 3 |
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 4 |
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 5 |
MAKEFLAGS += -j$(NUMJOBS) |
| 6 |
endif |
| 7 |
|
| 8 |
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) |
| 9 |
|
| 10 |
ifneq (,$(findstring amd64,$(DEB_HOST_ARCH))) |
| 11 |
LTO=y |
| 12 |
endif |
| 13 |
ifneq (,$(findstring x32,$(DEB_HOST_ARCH))) |
| 14 |
LTO=y |
| 15 |
endif |
| 16 |
ifneq (,$(findstring i386,$(DEB_HOST_ARCH))) |
| 17 |
LTO=y |
| 18 |
endif |
| 19 |
ifneq (,$(findstring arm64,$(DEB_HOST_ARCH))) |
| 20 |
LTO=y |
| 21 |
endif |
| 22 |
|
| 23 |
CFOPTIMIZE = $(shell dpkg-buildflags --get CXXFLAGS || echo -g -O2) \ |
| 24 |
$(shell dpkg-buildflags --get LDFLAGS) \ |
| 25 |
$(shell dpkg-buildflags --get CPPFLAGS) |
| 26 |
ifneq ($(LTO),) |
| 27 |
ifeq ($(shell g++ -x c++ /dev/null -flto=jobserver -fwhole-program 2>&1 | grep 'unrecognized command line option'),) |
| 28 |
CFOPTIMIZE += -flto=jobserver -fwhole-program |
| 29 |
endif |
| 30 |
ifeq ($(shell g++ -x c++ /dev/null -fno-fat-lto-objects 2>&1 | grep 'unrecognized command line option'),) |
| 31 |
CFOPTIMIZE += -fno-fat-lto-objects |
| 32 |
endif |
| 33 |
endif |
| 34 |
|
| 35 |
ifeq (,$(filter terse%,$(DEB_BUILD_OPTIONS))$(filter quiet%,$(DEB_BUILD_OPTIONS))) |
| 36 |
VERBOSE=V=y |
| 37 |
endif |
| 38 |
|
| 39 |
tree-stamp: |
| 40 |
dh_testdir |
| 41 |
mkdir build-console |
| 42 |
cp -ldpR docs settings source CREDITS.txt build-console/ |
| 43 |
mkdir build-tiles |
| 44 |
cp -ldpR docs settings source CREDITS.txt build-tiles/ |
| 45 |
touch tree-stamp |
| 46 |
|
| 47 |
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
| 48 |
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
| 49 |
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
| 50 |
CROSS=CROSSHOST=$(DEB_HOST_GNU_TYPE) |
| 51 |
endif |
| 52 |
|
| 53 |
|
| 54 |
ARGS_CONSOLE = prefix=/usr CFOPTIMIZE="$(CFOPTIMIZE)" STRIP=: $(CROSS) $(VERBOSE) |
| 55 |
ARGS_TILES = $(ARGS_CONSOLE) TILES=y GAME=crawl-tiles \ |
| 56 |
PROPORTIONAL_FONT=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf \ |
| 57 |
MONOSPACED_FONT=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf |
| 58 |
|
| 59 |
build-arch build-indep: build-stamp |
| 60 |
build-stamp: tree-stamp |
| 61 |
dh_testdir |
| 62 |
|
| 63 |
cd build-console/source && $(MAKE) $(ARGS_CONSOLE) |
| 64 |
cd build-tiles/source && $(MAKE) $(ARGS_TILES) |
| 65 |
|
| 66 |
touch build-stamp |
| 67 |
|
| 68 |
clean: |
| 69 |
dh_testdir |
| 70 |
dh_testroot |
| 71 |
|
| 72 |
rm -f build-stamp tree-stamp |
| 73 |
rm -rf build-console build-tiles |
| 74 |
|
| 75 |
git clean -dfX || true |
| 76 |
|
| 77 |
dh_clean |
| 78 |
|
| 79 |
install: build |
| 80 |
dh_testdir |
| 81 |
dh_testroot |
| 82 |
dh_prep |
| 83 |
dh_installdirs |
| 84 |
|
| 85 |
cd build-console/source && $(MAKE) $(ARGS_CONSOLE) install install-xdg-data DESTDIR=../../debian/crawl-common |
| 86 |
rm -rf debian/crawl-common/usr/share/crawl/docs/license |
| 87 |
mkdir -p debian/crawl/usr/share |
| 88 |
mv debian/crawl-common/usr/games debian/crawl/usr/games |
| 89 |
mv debian/crawl-common/usr/share/applications debian/crawl/usr/share |
| 90 |
mv debian/crawl-common/usr/share/icons debian/crawl/usr/share |
| 91 |
mv debian/crawl-common/usr/share/metainfo debian/crawl/usr/share |
| 92 |
cd build-tiles/source && $(MAKE) $(ARGS_TILES) install install-xdg-data DESTDIR=../../debian/crawl-tiles |
| 93 |
rm -rf debian/crawl-tiles/var |
| 94 |
cd debian/crawl-tiles/usr/share/crawl/ && rm -rf docs settings |
| 95 |
mkdir -p debian/crawl-tiles-data/usr/share/crawl/dat |
| 96 |
mv debian/crawl-tiles/usr/share/crawl/dat/tiles debian/crawl-tiles-data/usr/share/crawl/dat/ |
| 97 |
rm -rf debian/crawl-tiles/usr/share/crawl |
| 98 |
|
| 99 |
mkdir -p debian/crawl/usr/share/man/man6 |
| 100 |
cp docs/crawl.6 debian/crawl/usr/share/man/man6/ |
| 101 |
mkdir -p debian/crawl-tiles/usr/share/man/man6 |
| 102 |
cp docs/crawl.6 debian/crawl-tiles/usr/share/man/man6/crawl-tiles.6 |
| 103 |
mkdir -p debian/crawl-common/usr/share/doc/crawl-common/examples |
| 104 |
cp settings/init.txt debian/crawl-common/usr/share/doc/crawl-common/examples/crawlrc |
| 105 |
for i in docs/*.txt; do \ |
| 106 |
ln -sf /usr/share/crawl/$$i debian/crawl-common/usr/share/doc/crawl-common/; \ |
| 107 |
done |
| 108 |
|
| 109 |
mkdir -p debian/crawl/usr/share/doc |
| 110 |
ln -sf crawl-common debian/crawl/usr/share/doc/crawl |
| 111 |
mkdir -p debian/crawl-tiles/usr/share/doc |
| 112 |
ln -sf crawl-common debian/crawl-tiles/usr/share/doc/crawl-tiles |
| 113 |
mkdir -p debian/crawl-tiles-data/usr/share/doc |
| 114 |
ln -sf crawl-common debian/crawl-tiles-data/usr/share/doc/crawl-tiles-data |
| 115 |
|
| 116 |
|
| 117 |
binary-indep: install |
| 118 |
dh_testdir |
| 119 |
dh_testroot |
| 120 |
dh_installdocs -pcrawl-common -Xcrawl_manual.txt -Xaptitudes.txt -Xquickstart.txt -Xmacros_guide.txt -Xoptions_guide.txt -Xtiles_help.txt |
| 121 |
dh_installchangelogs -pcrawl-common docs/changelog.txt |
| 122 |
dh_link -i |
| 123 |
dh_compress -i -Xaptitudes.txt |
| 124 |
dh_fixperms -i |
| 125 |
dh_installdeb -i |
| 126 |
dh_gencontrol -i |
| 127 |
dh_md5sums -i |
| 128 |
dh_builddeb -i |
| 129 |
|
| 130 |
|
| 131 |
binary-arch: install |
| 132 |
dh_testdir |
| 133 |
dh_testroot |
| 134 |
dh_link -a |
| 135 |
dh_compress -a -Xaptitudes.txt |
| 136 |
dh_strip -a |
| 137 |
dh_fixperms -a |
| 138 |
dh_installdeb -a |
| 139 |
dh_shlibdeps -a |
| 140 |
dh_gencontrol -a |
| 141 |
dh_md5sums -a |
| 142 |
dh_builddeb -a |
| 143 |
|
| 144 |
build: build-indep build-arch |
| 145 |
binary: binary-indep binary-arch |
| 146 |
.PHONY: build-indep build-arch build clean binary-indep binary-arch binary install |