blob: cc86e535fbad4022b1229046575646b8330f59b2 [file] [log] [blame]
Wichert Akkermand321ff92002-03-31 18:45:45 +00001#! /usr/bin/make -f
2
3# Debian package information
4package = strace
5
Roland McGrath38d88e62004-10-19 23:23:34 +00006DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
Roland McGrathc9b624f2004-08-31 08:40:50 +00007DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
Roland McGrath98d5f012005-02-03 03:19:34 +00008DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
9
10VERSION := $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }')
11UDEB := strace-udeb_$(VERSION)_$(DEB_HOST_ARCH).udeb
Wichert Akkermand321ff92002-03-31 18:45:45 +000012
Roland McGrath75df90e2007-08-03 09:59:09 +000013arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
14ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
15 HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
16 $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu
Roland McGrathc9b624f2004-08-31 08:40:50 +000017 CC64 = gcc -m64
Roland McGrath75df90e2007-08-03 09:59:09 +000018 extra_build_targets += stamp-build64
Roland McGrathc9b624f2004-08-31 08:40:50 +000019endif
20
Roland McGrath38d88e62004-10-19 23:23:34 +000021ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
22 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
23else
24 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
25endif
26
Roland McGrath75df90e2007-08-03 09:59:09 +000027all build: stamp-build $(extra_build_targets)
Roland McGrathc9b624f2004-08-31 08:40:50 +000028
29stamp-%: %/Makefile
30 $(MAKE) -C $*
31 touch $@
32
33build/Makefile:
34 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000035 cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
Roland McGrathc9b624f2004-08-31 08:40:50 +000036
37build64/Makefile:
38 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000039 cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
Roland McGrathc9b624f2004-08-31 08:40:50 +000040
Wichert Akkermand321ff92002-03-31 18:45:45 +000041clean:
Roland McGrath6c95bed2007-07-05 20:55:07 +000042 rm -rf debian/$(package) debian/substvars debian/files debian/files~
Roland McGrathc9b624f2004-08-31 08:40:50 +000043 rm -rf build64 stamp-build64
44 rm -rf build stamp-build
Wichert Akkermand321ff92002-03-31 18:45:45 +000045
46binary: binary-indep binary-arch
47
48binary-indep:
49
Roland McGrath75df90e2007-08-03 09:59:09 +000050binary-arch: build checkroot
Wichert Akkermand321ff92002-03-31 18:45:45 +000051 test -f stamp-build || make $(MFLAGS) -f debian/rules build
Roland McGrath6c95bed2007-07-05 20:55:07 +000052 -rm -rf debian/$(package) debian/files debian/substvars
Wichert Akkermand321ff92002-03-31 18:45:45 +000053
Roland McGrath6c95bed2007-07-05 20:55:07 +000054 install -d -m 755 -o root -g root debian/$(package)
Wichert Akkermand321ff92002-03-31 18:45:45 +000055 # reset the mode to work around a bug in install
Roland McGrath6c95bed2007-07-05 20:55:07 +000056 chown 755 debian/$(package)
57 install -d -m 755 -o root -g root debian/$(package)/DEBIAN
Wichert Akkermand321ff92002-03-31 18:45:45 +000058
Roland McGrath98d5f012005-02-03 03:19:34 +000059# Install strace
Roland McGrath6c95bed2007-07-05 20:55:07 +000060 install -d -o root -g root -m 755 debian/$(package)/usr/bin
61 install -o root -g root -m 755 build/strace \
62 debian/$(package)/usr/bin/strace
Roland McGrath0662b592006-01-12 11:03:44 +000063 dh_strip
Roland McGrath98d5f012005-02-03 03:19:34 +000064
65 dpkg-gencontrol -is -pstrace-udeb -fdebian/files~
Roland McGrath6c95bed2007-07-05 20:55:07 +000066 dpkg-deb --build debian/$(package) ../$(UDEB)
Roland McGrath98d5f012005-02-03 03:19:34 +000067 dpkg-distaddfile $(UDEB) debian-installer extra
Roland McGrath0662b592006-01-12 11:03:44 +000068
Wichert Akkermand321ff92002-03-31 18:45:45 +000069# Install documentation
Roland McGrath6c95bed2007-07-05 20:55:07 +000070 install -d -o root -g root -m 755 \
71 debian/$(package)/usr/share/doc/$(package)
72 install -d -o root -g root -m 755 debian/$(package)/usr/share/man/man1
Wichert Akkermand321ff92002-03-31 18:45:45 +000073 install -p -o root -g root -m 644 debian/changelog \
Roland McGrath6c95bed2007-07-05 20:55:07 +000074 debian/$(package)/usr/share/doc/$(package)/changelog.Debian
Wichert Akkermand321ff92002-03-31 18:45:45 +000075 install -p -o root -g root -m 644 TODO \
Roland McGrath6c95bed2007-07-05 20:55:07 +000076 debian/$(package)/usr/share/doc/$(package)/TODO
Wichert Akkermand321ff92002-03-31 18:45:45 +000077 install -p -o root -g root -m 644 NEWS \
Roland McGrath6c95bed2007-07-05 20:55:07 +000078 debian/$(package)/usr/share/doc/$(package)/changelog
79 gzip -9 debian/$(package)/usr/share/doc/$(package)/*
Wichert Akkermand321ff92002-03-31 18:45:45 +000080 install -p -o root -g root -m 644 debian/copyright \
Roland McGrath6c95bed2007-07-05 20:55:07 +000081 debian/$(package)/usr/share/doc/$(package)/copyright
82 install -p -o root -g root -m 644 strace.1 \
83 debian/$(package)/usr/share/man/man1/strace.1
84 gzip -9 debian/$(package)/usr/share/man/man1/strace.1
Wichert Akkermand321ff92002-03-31 18:45:45 +000085
Roland McGrath75df90e2007-08-03 09:59:09 +000086ifneq (,$(HOST64))
Roland McGrath6c95bed2007-07-05 20:55:07 +000087 install -o root -g root -m 755 build64/strace debian/$(package)/usr/bin/strace64
88 ln -s strace.1.gz debian/$(package)/usr/share/man/man1/strace64.1.gz
Roland McGrath0662b592006-01-12 11:03:44 +000089 dh_strip
Roland McGrathc9b624f2004-08-31 08:40:50 +000090endif
91
Roland McGrath5db90322004-08-31 08:54:09 +000092 dpkg-shlibdeps build/strace $(patsubst yes,build64/strace,$(build64))
93
Roland McGrath98d5f012005-02-03 03:19:34 +000094 dpkg-gencontrol -is -pstrace
Roland McGrath6c95bed2007-07-05 20:55:07 +000095 dpkg-deb --build debian/$(package) ..
Wichert Akkermand321ff92002-03-31 18:45:45 +000096
97checkroot:
98 test root = "`whoami`"