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 | |
| 5 | CFLAGS = -Wall -g |
| 6 | |
| 7 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
| 8 | CFLAGS += -O0 |
| 9 | else |
| 10 | CFLAGS += -O2 |
| 11 | endif |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 12 | |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 13 | ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 14 | NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 15 | MAKEFLAGS += -j$(NUMJOBS) |
| 16 | endif |
| 17 | |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 18 | DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 19 | DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
Roland McGrath | 98d5f01 | 2005-02-03 03:19:34 +0000 | [diff] [blame] | 20 | DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) |
| 21 | |
Roland McGrath | 75df90e | 2007-08-03 09:59:09 +0000 | [diff] [blame] | 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 |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 26 | CC64 = gcc -m64 |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 27 | extra_build_targets += build64-stamp |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 28 | endif |
| 29 | |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 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 | |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 36 | all build: build-stamp $(extra_build_targets) |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 37 | |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 38 | %-stamp: %/Makefile |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 39 | $(MAKE) -C $* |
| 40 | touch $@ |
| 41 | |
| 42 | build/Makefile: |
| 43 | mkdir -p $(@D) |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 44 | cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS) |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 45 | |
| 46 | build64/Makefile: |
| 47 | mkdir -p $(@D) |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 48 | 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] | 49 | |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 50 | clean: |
Frederik Schüler | 881f573 | 2010-02-04 12:14:56 -0800 | [diff] [blame] | 51 | dh_testdir |
| 52 | dh_testroot |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 53 | rm -rf build build64 strace64.1 |
Roland McGrath | 6019fbb | 2008-07-18 00:18:27 +0000 | [diff] [blame] | 54 | dh_clean |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 55 | |
| 56 | binary: binary-indep binary-arch |
| 57 | |
| 58 | binary-indep: |
| 59 | |
Frederik Schüler | 881f573 | 2010-02-04 12:14:56 -0800 | [diff] [blame] | 60 | binary-arch: build |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 61 | test -f build-stamp || make $(MFLAGS) -f debian/rules build |
Dmitry V. Levin | 414fe7d | 2009-07-08 11:21:17 +0000 | [diff] [blame] | 62 | |
Roland McGrath | a04e213 | 2008-07-22 00:27:31 +0000 | [diff] [blame] | 63 | # prepare 64bit executable and manpage, if it has been built |
Frederik Schüler | 0c56f62 | 2010-04-13 13:04:00 +0200 | [diff] [blame] | 64 | test -f build64-stamp && ( mv build64/strace build64/strace64 ; \ |
Roland McGrath | a04e213 | 2008-07-22 00:27:31 +0000 | [diff] [blame] | 65 | cp strace.1 strace64.1 ) || true |
Dmitry V. Levin | 414fe7d | 2009-07-08 11:21:17 +0000 | [diff] [blame] | 66 | |
Roland McGrath | a04e213 | 2008-07-22 00:27:31 +0000 | [diff] [blame] | 67 | dh_testdir -s |
| 68 | dh_testroot -s |
| 69 | dh_installdirs -s |
| 70 | dh_installdocs -s |
| 71 | dh_installman -s |
| 72 | dh_installexamples -s |
Frederik Schüler | f786da5 | 2009-10-05 20:50:07 +0000 | [diff] [blame] | 73 | dh_installchangelogs -s |
Roland McGrath | a04e213 | 2008-07-22 00:27:31 +0000 | [diff] [blame] | 74 | dh_install -s |
| 75 | dh_link -s |
| 76 | dh_strip -s |
| 77 | dh_compress -s |
| 78 | dh_fixperms -s |
| 79 | dh_installdeb -s |
| 80 | dh_shlibdeps -s |
| 81 | dh_gencontrol -s |
| 82 | dh_md5sums -s |
| 83 | dh_builddeb -s |