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) |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 8 | |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 9 | ifeq ($(DEB_HOST_GNU_TYPE),sparc-linux) |
| 10 | build64 = yes |
| 11 | HOST64 = sparc64-linux |
| 12 | CC64 = gcc -m64 |
| 13 | endif |
| 14 | |
Roland McGrath | 38d88e6 | 2004-10-19 23:23:34 +0000 | [diff] [blame^] | 15 | ifeq ($(DEB_HOST_GNU_TYPE),s390-linux) |
| 16 | build64 = yes |
| 17 | HOST64 = s390x-linux |
| 18 | CC64 = gcc -m64 |
| 19 | endif |
| 20 | |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 21 | ifeq ($(build64),yes) |
| 22 | extra_build_targets += stamp-build64 |
| 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 | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 31 | all build: stamp-build |
| 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: |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 46 | rm -rf debian/tmp debian/substvars debian/files |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 47 | rm -rf build64 stamp-build64 |
| 48 | rm -rf build stamp-build |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 49 | |
| 50 | binary: binary-indep binary-arch |
| 51 | |
| 52 | binary-indep: |
| 53 | |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 54 | binary-arch: $(extra_build_targets) build checkroot |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 55 | test -f stamp-build || make $(MFLAGS) -f debian/rules build |
| 56 | -rm -rf debian/tmp debian/files debian/substvars |
| 57 | |
| 58 | install -d -m 755 -o root -g root debian/tmp |
| 59 | # reset the mode to work around a bug in install |
| 60 | chown 755 debian/tmp |
| 61 | install -d -m 755 -o root -g root debian/tmp/DEBIAN |
| 62 | |
| 63 | # Install documentation |
| 64 | install -d -o root -g root -m 755 debian/tmp/usr/share/doc/$(package) |
| 65 | install -p -o root -g root -m 644 debian/changelog \ |
| 66 | debian/tmp/usr/share/doc/$(package)/changelog.Debian |
| 67 | install -p -o root -g root -m 644 TODO \ |
| 68 | debian/tmp/usr/share/doc/$(package)/TODO |
| 69 | install -p -o root -g root -m 644 NEWS \ |
| 70 | debian/tmp/usr/share/doc/$(package)/changelog |
| 71 | gzip -9 debian/tmp/usr/share/doc/$(package)/* |
| 72 | install -p -o root -g root -m 644 debian/copyright \ |
| 73 | debian/tmp/usr/share/doc/$(package)/copyright |
| 74 | |
| 75 | # Install strace |
| 76 | install -d -o root -g root -m 755 debian/tmp/usr/bin debian/tmp/usr/share/man/man1 |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 77 | install -s -o root -g root -m 755 build/strace debian/tmp/usr/bin/strace |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 78 | install -p -o root -g root -m 644 strace.1 debian/tmp/usr/share/man/man1/strace.1 |
| 79 | gzip -9 debian/tmp/usr/share/man/man1/strace.1 |
| 80 | |
Roland McGrath | c9b624f | 2004-08-31 08:40:50 +0000 | [diff] [blame] | 81 | ifeq ($(build64),yes) |
| 82 | install -s -o root -g root -m 755 build64/strace debian/tmp/usr/bin/strace64 |
| 83 | ln -s strace.1 debian/tmp/usr/share/man/man1/strace64.1 |
| 84 | endif |
| 85 | |
Roland McGrath | 5db9032 | 2004-08-31 08:54:09 +0000 | [diff] [blame] | 86 | dpkg-shlibdeps build/strace $(patsubst yes,build64/strace,$(build64)) |
| 87 | |
Wichert Akkerman | d321ff9 | 2002-03-31 18:45:45 +0000 | [diff] [blame] | 88 | dpkg-gencontrol -isp |
| 89 | dpkg --build debian/tmp .. |
| 90 | |
| 91 | checkroot: |
| 92 | test root = "`whoami`" |