Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 1 | #! /usr/bin/make -f |
| 2 | |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 3 | #export DH_VERBOSE=1 |
Frederik Schüler | 881f573 | 2010-02-04 12:14:56 -0800 | [diff] [blame] | 4 | |
Dmitry V. Levin | 4182981 | 2014-06-03 12:56:42 +0000 | [diff] [blame] | 5 | export DEB_BUILD_MAINT_OPTIONS = hardening=+all |
| 6 | DPKG_EXPORT_BUILDFLAGS = 1 |
| 7 | include /usr/share/dpkg/buildflags.mk |
| 8 | |
| 9 | CFLAGS += -Wall -g |
Frederik Schüler | 881f573 | 2010-02-04 12:14:56 -0800 | [diff] [blame] | 10 | |
| 11 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
| 12 | CFLAGS += -O0 |
| 13 | else |
| 14 | CFLAGS += -O2 |
| 15 | endif |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 16 | |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 17 | ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 18 | NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 19 | MAKEFLAGS += -j$(NUMJOBS) |
| 20 | endif |
| 21 | |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 22 | DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 23 | DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
Roland McGrath | 98d5f01 | 2005-02-03 03:19:34 +0000 | [diff] [blame] | 24 | DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) |
| 25 | |
Roland McGrath | 75df90e | 2007-08-03 09:59:09 +0000 | [diff] [blame] | 26 | arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x |
| 27 | ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map))) |
| 28 | HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \ |
| 29 | $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 30 | CC64 = gcc -m64 |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 31 | extra_build_targets += build64-stamp |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 32 | endif |
| 33 | |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 34 | ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) |
| 35 | CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) |
| 36 | else |
| 37 | CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) |
| 38 | endif |
| 39 | |
Dmitry V. Levin | a283ae0 | 2014-08-15 13:14:15 +0000 | [diff] [blame] | 40 | all: build |
| 41 | |
| 42 | build: build-arch build-indep |
| 43 | |
| 44 | build-arch: build-stamp $(extra_build_targets) |
| 45 | build-indep: build-stamp $(extra_build_targets) |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 46 | |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 47 | %-stamp: %/Makefile |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 48 | $(MAKE) -C $* |
Dmitry V. Levin | 983e875 | 2011-02-27 10:16:41 +0000 | [diff] [blame] | 49 | ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) |
| 50 | $(MAKE) -C $* check |
| 51 | endif |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 52 | touch $@ |
| 53 | |
| 54 | build/Makefile: |
| 55 | mkdir -p $(@D) |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 56 | cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS) |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 57 | |
| 58 | build64/Makefile: |
| 59 | mkdir -p $(@D) |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 60 | cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64) |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 61 | |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 62 | clean: |
Frederik Schüler | 881f573 | 2010-02-04 12:14:56 -0800 | [diff] [blame] | 63 | dh_testdir |
| 64 | dh_testroot |
Dmitry V. Levin | 4fa8073 | 2015-12-20 00:51:51 +0000 | [diff] [blame] | 65 | rm -rf build build64 strace64.1 debian/strace64.substvars |
Roland McGrath | 6019fbb | 2008-07-18 00:18:27 +0000 | [diff] [blame] | 66 | dh_clean |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 67 | |
| 68 | binary: binary-indep binary-arch |
| 69 | |
| 70 | binary-indep: |
| 71 | |
Frederik Schüler | 881f573 | 2010-02-04 12:14:56 -0800 | [diff] [blame] | 72 | binary-arch: build |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 73 | test -f build-stamp || make $(MFLAGS) -f debian/rules build |
Dmitry V. Levin | 414fe7d | 2009-07-08 11:21:17 +0000 | [diff] [blame] | 74 | |
Roland McGrath | a04e213 | 2008-07-22 00:27:31 +0000 | [diff] [blame] | 75 | # prepare 64bit executable and manpage, if it has been built |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 76 | test -f build64-stamp && ( mv build64/strace build64/strace64 ; \ |
Roland McGrath | a04e213 | 2008-07-22 00:27:31 +0000 | [diff] [blame] | 77 | cp strace.1 strace64.1 ) || true |
Dmitry V. Levin | 414fe7d | 2009-07-08 11:21:17 +0000 | [diff] [blame] | 78 | |
Roland McGrath | a04e213 | 2008-07-22 00:27:31 +0000 | [diff] [blame] | 79 | dh_testdir -s |
| 80 | dh_testroot -s |
| 81 | dh_installdirs -s |
| 82 | dh_installdocs -s |
| 83 | dh_installman -s |
| 84 | dh_installexamples -s |
Frederik Schüler | f786da5 | 2009-10-05 20:50:07 +0000 | [diff] [blame] | 85 | dh_installchangelogs -s |
Roland McGrath | a04e213 | 2008-07-22 00:27:31 +0000 | [diff] [blame] | 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 |