| 1 |
#! /usr/bin/make -f |
| 2 |
|
| 3 |
#export DH_VERBOSE=1 |
| 4 |
|
| 5 |
CFLAGS = -Wall -g |
| 6 |
|
| 7 |
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
| 8 |
CFLAGS += -O0 |
| 9 |
else |
| 10 |
CFLAGS += -O2 |
| 11 |
endif |
| 12 |
|
| 13 |
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 14 |
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 15 |
MAKEFLAGS += -j$(NUMJOBS) |
| 16 |
endif |
| 17 |
|
| 18 |
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
| 19 |
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
| 20 |
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) |
| 21 |
|
| 22 |
arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x |
| 23 |
ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map))) |
| 24 |
HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \ |
| 25 |
$(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu |
| 26 |
CC64 = gcc -m64 |
| 27 |
extra_build_targets += build64-stamp |
| 28 |
endif |
| 29 |
|
| 30 |
ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) |
| 31 |
CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) |
| 32 |
else |
| 33 |
CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) |
| 34 |
endif |
| 35 |
|
| 36 |
all build: build-stamp $(extra_build_targets) |
| 37 |
|
| 38 |
%-stamp: %/Makefile |
| 39 |
$(MAKE) -C $* |
| 40 |
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) |
| 41 |
$(MAKE) -C $* check |
| 42 |
endif |
| 43 |
touch $@ |
| 44 |
|
| 45 |
build/Makefile: |
| 46 |
mkdir -p $(@D) |
| 47 |
cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS) |
| 48 |
|
| 49 |
build64/Makefile: |
| 50 |
mkdir -p $(@D) |
| 51 |
cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64) |
| 52 |
|
| 53 |
clean: |
| 54 |
dh_testdir |
| 55 |
dh_testroot |
| 56 |
rm -rf build build64 strace64.1 |
| 57 |
dh_clean |
| 58 |
|
| 59 |
binary: binary-indep binary-arch |
| 60 |
|
| 61 |
binary-indep: |
| 62 |
|
| 63 |
binary-arch: build |
| 64 |
test -f build-stamp || make $(MFLAGS) -f debian/rules build |
| 65 |
|
| 66 |
# prepare 64bit executable and manpage, if it has been built |
| 67 |
test -f build64-stamp && ( mv build64/strace build64/strace64 ; \ |
| 68 |
cp strace.1 strace64.1 ) || true |
| 69 |
|
| 70 |
dh_testdir -s |
| 71 |
dh_testroot -s |
| 72 |
dh_installdirs -s |
| 73 |
dh_installdocs -s |
| 74 |
dh_installman -s |
| 75 |
dh_installexamples -s |
| 76 |
dh_installchangelogs -s |
| 77 |
dh_install -s |
| 78 |
dh_link -s |
| 79 |
dh_strip -s |
| 80 |
dh_compress -s |
| 81 |
dh_fixperms -s |
| 82 |
dh_installdeb -s |
| 83 |
dh_shlibdeps -s |
| 84 |
dh_gencontrol -s |
| 85 |
dh_md5sums -s |
| 86 |
dh_builddeb -s |