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