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 | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 13 | ifeq ($(DEB_HOST_GNU_TYPE),sparc-linux) |
| 14 | build64 = yes |
| 15 | HOST64 = sparc64-linux |
| 16 | CC64 = gcc -m64 |
| 17 | endif |
| 18 | |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 19 | ifeq ($(DEB_HOST_GNU_TYPE),s390-linux) |
| 20 | build64 = yes |
| 21 | HOST64 = s390x-linux |
| 22 | CC64 = gcc -m64 |
| 23 | endif |
| 24 | |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 25 | ifeq ($(build64),yes) |
| 26 | extra_build_targets += stamp-build64 |
| 27 | endif |
| 28 | |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 29 | ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) |
| 30 | CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) |
| 31 | else |
| 32 | CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) |
| 33 | endif |
| 34 | |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 35 | all build: stamp-build |
| 36 | |
| 37 | stamp-%: %/Makefile |
| 38 | $(MAKE) -C $* |
| 39 | touch $@ |
| 40 | |
| 41 | build/Makefile: |
| 42 | mkdir -p $(@D) |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 43 | cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS) |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 44 | |
| 45 | build64/Makefile: |
| 46 | mkdir -p $(@D) |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame] | 47 | 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] | 48 | |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 49 | clean: |
Roland McGrath | 98d5f01 | 2005-02-03 03:19:34 +0000 | [diff] [blame^] | 50 | rm -rf debian/tmp debian/substvars debian/files debian/files~ |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 51 | rm -rf build64 stamp-build64 |
| 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 | |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 58 | binary-arch: $(extra_build_targets) build checkroot |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 59 | test -f stamp-build || make $(MFLAGS) -f debian/rules build |
| 60 | -rm -rf debian/tmp debian/files debian/substvars |
| 61 | |
| 62 | install -d -m 755 -o root -g root debian/tmp |
| 63 | # reset the mode to work around a bug in install |
| 64 | chown 755 debian/tmp |
| 65 | install -d -m 755 -o root -g root debian/tmp/DEBIAN |
| 66 | |
Roland McGrath | 98d5f01 | 2005-02-03 03:19:34 +0000 | [diff] [blame^] | 67 | # Install strace |
| 68 | install -d -o root -g root -m 755 debian/tmp/usr/bin |
| 69 | install -s -o root -g root -m 755 build/strace debian/tmp/usr/bin/strace |
| 70 | |
| 71 | dpkg-gencontrol -is -pstrace-udeb -fdebian/files~ |
| 72 | dpkg-deb --build debian/tmp ../$(UDEB) |
| 73 | dpkg-distaddfile $(UDEB) debian-installer extra |
| 74 | |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 75 | # Install documentation |
| 76 | install -d -o root -g root -m 755 debian/tmp/usr/share/doc/$(package) |
Roland McGrath | 98d5f01 | 2005-02-03 03:19:34 +0000 | [diff] [blame^] | 77 | install -d -o root -g root -m 755 debian/tmp/usr/share/man/man1 |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 78 | install -p -o root -g root -m 644 debian/changelog \ |
| 79 | debian/tmp/usr/share/doc/$(package)/changelog.Debian |
| 80 | install -p -o root -g root -m 644 TODO \ |
| 81 | debian/tmp/usr/share/doc/$(package)/TODO |
| 82 | install -p -o root -g root -m 644 NEWS \ |
| 83 | debian/tmp/usr/share/doc/$(package)/changelog |
| 84 | gzip -9 debian/tmp/usr/share/doc/$(package)/* |
| 85 | install -p -o root -g root -m 644 debian/copyright \ |
| 86 | debian/tmp/usr/share/doc/$(package)/copyright |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 87 | install -p -o root -g root -m 644 strace.1 debian/tmp/usr/share/man/man1/strace.1 |
| 88 | gzip -9 debian/tmp/usr/share/man/man1/strace.1 |
| 89 | |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 90 | ifeq ($(build64),yes) |
| 91 | install -s -o root -g root -m 755 build64/strace debian/tmp/usr/bin/strace64 |
Roland McGrath | c5fa4ac | 2004-10-19 23:29:47 +0000 | [diff] [blame] | 92 | ln -s strace.1.gz debian/tmp/usr/share/man/man1/strace64.1.gz |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 93 | endif |
| 94 | |
Roland McGrath | 5db9032 | 2004-08-31 08:54:09 +0000 | [diff] [blame] | 95 | dpkg-shlibdeps build/strace $(patsubst yes,build64/strace,$(build64)) |
| 96 | |
Roland McGrath | 98d5f01 | 2005-02-03 03:19:34 +0000 | [diff] [blame^] | 97 | dpkg-gencontrol -is -pstrace |
| 98 | dpkg-deb --build debian/tmp .. |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 99 | |
| 100 | checkroot: |
| 101 | test root = "`whoami`" |