| #! /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 |
| |
| ifeq ($(DEB_HOST_GNU_TYPE),sparc-linux) |
| build64 = yes |
| HOST64 = sparc64-linux |
| CC64 = gcc -m64 |
| endif |
| |
| ifeq ($(DEB_HOST_GNU_TYPE),s390-linux) |
| build64 = yes |
| HOST64 = s390x-linux |
| CC64 = gcc -m64 |
| endif |
| |
| ifeq ($(build64),yes) |
| 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 |
| |
| 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: $(extra_build_targets) 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 |
| |
| ifeq ($(build64),yes) |
| 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`" |