| #! /usr/bin/make -f |
| |
| # Debian package information |
| package = strace |
| |
| DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
| DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
| DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) |
| |
| VERSION := $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }') |
| UDEB := strace-udeb_$(VERSION)_$(DEB_HOST_ARCH).udeb |
| |
| arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x |
| ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map))) |
| HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \ |
| $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu |
| CC64 = gcc -m64 |
| extra_build_targets += stamp-build64 |
| endif |
| |
| ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) |
| CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) |
| else |
| CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) |
| endif |
| |
| all build: stamp-build $(extra_build_targets) |
| |
| stamp-%: %/Makefile |
| $(MAKE) -C $* |
| touch $@ |
| |
| build/Makefile: |
| mkdir -p $(@D) |
| cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS) |
| |
| build64/Makefile: |
| mkdir -p $(@D) |
| cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64) |
| |
| clean: |
| rm -rf debian/$(package) debian/substvars debian/files debian/files~ |
| rm -rf build64 stamp-build64 |
| rm -rf build stamp-build |
| |
| binary: binary-indep binary-arch |
| |
| binary-indep: |
| |
| binary-arch: build checkroot |
| test -f stamp-build || make $(MFLAGS) -f debian/rules build |
| -rm -rf debian/$(package) debian/files debian/substvars |
| |
| install -d -m 755 -o root -g root debian/$(package) |
| # reset the mode to work around a bug in install |
| chown 755 debian/$(package) |
| install -d -m 755 -o root -g root debian/$(package)/DEBIAN |
| |
| # Install strace |
| install -d -o root -g root -m 755 debian/$(package)/usr/bin |
| install -o root -g root -m 755 build/strace \ |
| debian/$(package)/usr/bin/strace |
| dh_strip |
| |
| dpkg-gencontrol -is -pstrace-udeb -fdebian/files~ |
| dpkg-deb --build debian/$(package) ../$(UDEB) |
| dpkg-distaddfile $(UDEB) debian-installer extra |
| |
| # Install documentation |
| install -d -o root -g root -m 755 \ |
| debian/$(package)/usr/share/doc/$(package) |
| install -d -o root -g root -m 755 debian/$(package)/usr/share/man/man1 |
| install -p -o root -g root -m 644 debian/changelog \ |
| debian/$(package)/usr/share/doc/$(package)/changelog.Debian |
| install -p -o root -g root -m 644 TODO \ |
| debian/$(package)/usr/share/doc/$(package)/TODO |
| install -p -o root -g root -m 644 NEWS \ |
| debian/$(package)/usr/share/doc/$(package)/changelog |
| gzip -9 debian/$(package)/usr/share/doc/$(package)/* |
| install -p -o root -g root -m 644 debian/copyright \ |
| debian/$(package)/usr/share/doc/$(package)/copyright |
| install -p -o root -g root -m 644 strace.1 \ |
| debian/$(package)/usr/share/man/man1/strace.1 |
| gzip -9 debian/$(package)/usr/share/man/man1/strace.1 |
| |
| ifneq (,$(HOST64)) |
| install -o root -g root -m 755 build64/strace debian/$(package)/usr/bin/strace64 |
| ln -s strace.1.gz debian/$(package)/usr/share/man/man1/strace64.1.gz |
| dh_strip |
| endif |
| |
| dpkg-shlibdeps build/strace $(patsubst yes,build64/strace,$(build64)) |
| |
| dpkg-gencontrol -is -pstrace |
| dpkg-deb --build debian/$(package) .. |
| |
| checkroot: |
| test root = "`whoami`" |