2002-03-31 18:45:45 +00:00
#! /usr/bin/make -f
# Debian package information
package = strace
2004-10-19 23:23:34 +00:00
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
2004-08-31 08:40:50 +00:00
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
2005-02-03 03:19:34 +00:00
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
2004-08-31 08:40:50 +00:00
ifeq ($(DEB_HOST_GNU_TYPE),sparc-linux)
build64 = yes
HOST64 = sparc64-linux
CC64 = gcc -m64
endif
2004-10-19 23:23:34 +00:00
ifeq ($(DEB_HOST_GNU_TYPE),s390-linux)
build64 = yes
HOST64 = s390x-linux
CC64 = gcc -m64
endif
2004-08-31 08:40:50 +00:00
ifeq ($(build64),yes)
extra_build_targets += stamp-build64
endif
2004-10-19 23:23:34 +00:00
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
2004-08-31 08:40:50 +00:00
all build: stamp-build
stamp-%: %/Makefile
$(MAKE) -C $*
touch $@
build/Makefile:
mkdir -p $(@D)
2004-10-19 23:23:34 +00:00
cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
2004-08-31 08:40:50 +00:00
build64/Makefile:
mkdir -p $(@D)
2004-10-19 23:23:34 +00:00
cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
2002-03-31 18:45:45 +00:00
clean:
2007-07-05 20:55:07 +00:00
rm -rf debian/$(package) debian/substvars debian/files debian/files~
2004-08-31 08:40:50 +00:00
rm -rf build64 stamp-build64
rm -rf build stamp-build
2002-03-31 18:45:45 +00:00
binary: binary-indep binary-arch
binary-indep:
2004-08-31 08:40:50 +00:00
binary-arch: $(extra_build_targets) build checkroot
2002-03-31 18:45:45 +00:00
test -f stamp-build || make $(MFLAGS) -f debian/rules build
2007-07-05 20:55:07 +00:00
-rm -rf debian/$(package) debian/files debian/substvars
2002-03-31 18:45:45 +00:00
2007-07-05 20:55:07 +00:00
install -d -m 755 -o root -g root debian/$(package)
2002-03-31 18:45:45 +00:00
# reset the mode to work around a bug in install
2007-07-05 20:55:07 +00:00
chown 755 debian/$(package)
install -d -m 755 -o root -g root debian/$(package)/DEBIAN
2002-03-31 18:45:45 +00:00
2005-02-03 03:19:34 +00:00
# Install strace
2007-07-05 20:55:07 +00:00
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
2006-01-12 11:03:44 +00:00
dh_strip
2005-02-03 03:19:34 +00:00
dpkg-gencontrol -is -pstrace-udeb -fdebian/files~
2007-07-05 20:55:07 +00:00
dpkg-deb --build debian/$(package) ../$(UDEB)
2005-02-03 03:19:34 +00:00
dpkg-distaddfile $(UDEB) debian-installer extra
2006-01-12 11:03:44 +00:00
2002-03-31 18:45:45 +00:00
# Install documentation
2007-07-05 20:55:07 +00:00
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
2002-03-31 18:45:45 +00:00
install -p -o root -g root -m 644 debian/changelog \
2007-07-05 20:55:07 +00:00
debian/$(package)/usr/share/doc/$(package)/changelog.Debian
2002-03-31 18:45:45 +00:00
install -p -o root -g root -m 644 TODO \
2007-07-05 20:55:07 +00:00
debian/$(package)/usr/share/doc/$(package)/TODO
2002-03-31 18:45:45 +00:00
install -p -o root -g root -m 644 NEWS \
2007-07-05 20:55:07 +00:00
debian/$(package)/usr/share/doc/$(package)/changelog
gzip -9 debian/$(package)/usr/share/doc/$(package)/*
2002-03-31 18:45:45 +00:00
install -p -o root -g root -m 644 debian/copyright \
2007-07-05 20:55:07 +00:00
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
2002-03-31 18:45:45 +00:00
2004-08-31 08:40:50 +00:00
ifeq ($(build64),yes)
2007-07-05 20:55:07 +00:00
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
2006-01-12 11:03:44 +00:00
dh_strip
2004-08-31 08:40:50 +00:00
endif
2004-08-31 08:54:09 +00:00
dpkg-shlibdeps build/strace $(patsubst yes,build64/strace,$(build64))
2005-02-03 03:19:34 +00:00
dpkg-gencontrol -is -pstrace
2007-07-05 20:55:07 +00:00
dpkg-deb --build debian/$(package) ..
2002-03-31 18:45:45 +00:00
checkroot:
test root = "`whoami`"