Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 1 | #! /usr/bin/make -f |
| 2 | |
| 3 | # Debian package information |
| 4 | package = strace |
| 5 | |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 6 | DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 7 | DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
Roland McGrath | 98d5f01 | 2005-02-03 03:19:34 +0000 | [diff] [blame] | 8 | DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) |
| 9 | |
| 10 | VERSION := $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }') |
| 11 | UDEB := strace-udeb_$(VERSION)_$(DEB_HOST_ARCH).udeb |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 12 | |
Roland McGrath | 75df90e | 2007-08-03 09:59:09 +0000 | [diff] [blame] | 13 | arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x |
| 14 | ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map))) |
| 15 | HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \ |
| 16 | $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 17 | CC64 = gcc -m64 |
Roland McGrath | 75df90e | 2007-08-03 09:59:09 +0000 | [diff] [blame] | 18 | extra_build_targets += stamp-build64 |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 19 | endif |
| 20 | |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 21 | ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) |
| 22 | CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) |
| 23 | else |
| 24 | CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) |
| 25 | endif |
| 26 | |
Roland McGrath | 75df90e | 2007-08-03 09:59:09 +0000 | [diff] [blame] | 27 | all build: stamp-build $(extra_build_targets) |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 28 | |
| 29 | stamp-%: %/Makefile |
| 30 | $(MAKE) -C $* |
| 31 | touch $@ |
| 32 | |
| 33 | build/Makefile: |
| 34 | mkdir -p $(@D) |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 35 | cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS) |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 36 | |
| 37 | build64/Makefile: |
| 38 | mkdir -p $(@D) |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 39 | 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] | 40 | |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 41 | clean: |
Roland McGrath | 6019fbb | 2008-07-18 00:18:27 +0000 | [diff] [blame^] | 42 | dh_clean |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 43 | rm -rf debian/$(package) debian/substvars debian/files debian/files~ |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 44 | rm -rf build64 stamp-build64 |
| 45 | rm -rf build stamp-build |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 46 | |
| 47 | binary: binary-indep binary-arch |
| 48 | |
| 49 | binary-indep: |
| 50 | |
Roland McGrath | 75df90e | 2007-08-03 09:59:09 +0000 | [diff] [blame] | 51 | binary-arch: build checkroot |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 52 | test -f stamp-build || make $(MFLAGS) -f debian/rules build |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 53 | -rm -rf debian/$(package) debian/files debian/substvars |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 54 | |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 55 | install -d -m 755 -o root -g root debian/$(package) |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 56 | # reset the mode to work around a bug in install |
Roland McGrath | e53d889 | 2008-05-20 01:55:48 +0000 | [diff] [blame] | 57 | chmod 755 debian/$(package) |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 58 | install -d -m 755 -o root -g root debian/$(package)/DEBIAN |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 59 | |
Roland McGrath | 98d5f01 | 2005-02-03 03:19:34 +0000 | [diff] [blame] | 60 | # Install strace |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 61 | install -d -o root -g root -m 755 debian/$(package)/usr/bin |
| 62 | install -o root -g root -m 755 build/strace \ |
| 63 | debian/$(package)/usr/bin/strace |
Roland McGrath | 0662b59 | 2006-01-12 11:03:44 +0000 | [diff] [blame] | 64 | dh_strip |
Roland McGrath | 98d5f01 | 2005-02-03 03:19:34 +0000 | [diff] [blame] | 65 | |
Roland McGrath | 6019fbb | 2008-07-18 00:18:27 +0000 | [diff] [blame^] | 66 | dpkg-gencontrol -is -pstrace-udeb -fdebian/files~ -Pdebian/$(package) |
| 67 | dh_md5sums |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 68 | dpkg-deb --build debian/$(package) ../$(UDEB) |
Roland McGrath | 98d5f01 | 2005-02-03 03:19:34 +0000 | [diff] [blame] | 69 | dpkg-distaddfile $(UDEB) debian-installer extra |
Roland McGrath | 0662b59 | 2006-01-12 11:03:44 +0000 | [diff] [blame] | 70 | |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 71 | # Install documentation |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 72 | install -d -o root -g root -m 755 \ |
| 73 | debian/$(package)/usr/share/doc/$(package) |
| 74 | install -d -o root -g root -m 755 debian/$(package)/usr/share/man/man1 |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 75 | install -p -o root -g root -m 644 debian/changelog \ |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 76 | debian/$(package)/usr/share/doc/$(package)/changelog.Debian |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 77 | install -p -o root -g root -m 644 TODO \ |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 78 | debian/$(package)/usr/share/doc/$(package)/TODO |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 79 | install -p -o root -g root -m 644 NEWS \ |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 80 | debian/$(package)/usr/share/doc/$(package)/changelog |
| 81 | gzip -9 debian/$(package)/usr/share/doc/$(package)/* |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 82 | install -p -o root -g root -m 644 debian/copyright \ |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 83 | debian/$(package)/usr/share/doc/$(package)/copyright |
| 84 | install -p -o root -g root -m 644 strace.1 \ |
| 85 | debian/$(package)/usr/share/man/man1/strace.1 |
| 86 | gzip -9 debian/$(package)/usr/share/man/man1/strace.1 |
Roland McGrath | 91802a6 | 2008-05-20 01:46:58 +0000 | [diff] [blame] | 87 | install -d -o root -g root -m 755 \ |
| 88 | debian/$(package)/usr/share/doc/$(package)/examples |
| 89 | install -p -o root -g root -m 755 strace-graph \ |
| 90 | debian/$(package)/usr/share/doc/$(package)/examples |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 91 | |
Roland McGrath | 75df90e | 2007-08-03 09:59:09 +0000 | [diff] [blame] | 92 | ifneq (,$(HOST64)) |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 93 | install -o root -g root -m 755 build64/strace debian/$(package)/usr/bin/strace64 |
| 94 | ln -s strace.1.gz debian/$(package)/usr/share/man/man1/strace64.1.gz |
Roland McGrath | 0662b59 | 2006-01-12 11:03:44 +0000 | [diff] [blame] | 95 | dh_strip |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 96 | endif |
| 97 | |
Roland McGrath | 5db9032 | 2004-08-31 08:54:09 +0000 | [diff] [blame] | 98 | dpkg-shlibdeps build/strace $(patsubst yes,build64/strace,$(build64)) |
| 99 | |
Roland McGrath | 6019fbb | 2008-07-18 00:18:27 +0000 | [diff] [blame^] | 100 | dpkg-gencontrol -is -pstrace -Pdebian/$(package) |
Roland McGrath | 6c95bed | 2007-07-05 20:55:07 +0000 | [diff] [blame] | 101 | dpkg-deb --build debian/$(package) .. |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 102 | |
| 103 | checkroot: |
| 104 | test root = "`whoami`" |