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