blob: 2460f2b131ff03570ce91ddd03728cfacb9ab707 [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 McGrath6019fbb2008-07-18 00:18:27 +000042 dh_clean
Roland McGrath6c95bed2007-07-05 20:55:07 +000043 rm -rf debian/$(package) debian/substvars debian/files debian/files~
Roland McGrathc9b624f2004-08-31 08:40:50 +000044 rm -rf build64 stamp-build64
45 rm -rf build stamp-build
Wichert Akkermand321ff92002-03-31 18:45:45 +000046
47binary: binary-indep binary-arch
48
49binary-indep:
50
Roland McGrath75df90e2007-08-03 09:59:09 +000051binary-arch: build checkroot
Wichert Akkermand321ff92002-03-31 18:45:45 +000052 test -f stamp-build || make $(MFLAGS) -f debian/rules build
Roland McGrath6c95bed2007-07-05 20:55:07 +000053 -rm -rf debian/$(package) debian/files debian/substvars
Wichert Akkermand321ff92002-03-31 18:45:45 +000054
Roland McGrath6c95bed2007-07-05 20:55:07 +000055 install -d -m 755 -o root -g root debian/$(package)
Wichert Akkermand321ff92002-03-31 18:45:45 +000056 # reset the mode to work around a bug in install
Roland McGrathe53d8892008-05-20 01:55:48 +000057 chmod 755 debian/$(package)
Roland McGrath6c95bed2007-07-05 20:55:07 +000058 install -d -m 755 -o root -g root debian/$(package)/DEBIAN
Wichert Akkermand321ff92002-03-31 18:45:45 +000059
Roland McGrath98d5f012005-02-03 03:19:34 +000060# Install strace
Roland McGrath6c95bed2007-07-05 20:55:07 +000061 install -d -o root -g root -m 755 debian/$(package)/usr/bin
62 install -o root -g root -m 755 build/strace \
63 debian/$(package)/usr/bin/strace
Roland McGrath0662b592006-01-12 11:03:44 +000064 dh_strip
Roland McGrath98d5f012005-02-03 03:19:34 +000065
Roland McGrath6019fbb2008-07-18 00:18:27 +000066 dpkg-gencontrol -is -pstrace-udeb -fdebian/files~ -Pdebian/$(package)
67 dh_md5sums
Roland McGrath6c95bed2007-07-05 20:55:07 +000068 dpkg-deb --build debian/$(package) ../$(UDEB)
Roland McGrath98d5f012005-02-03 03:19:34 +000069 dpkg-distaddfile $(UDEB) debian-installer extra
Roland McGrath0662b592006-01-12 11:03:44 +000070
Wichert Akkermand321ff92002-03-31 18:45:45 +000071# Install documentation
Roland McGrath6c95bed2007-07-05 20:55:07 +000072 install -d -o root -g root -m 755 \
73 debian/$(package)/usr/share/doc/$(package)
74 install -d -o root -g root -m 755 debian/$(package)/usr/share/man/man1
Wichert Akkermand321ff92002-03-31 18:45:45 +000075 install -p -o root -g root -m 644 debian/changelog \
Roland McGrath6c95bed2007-07-05 20:55:07 +000076 debian/$(package)/usr/share/doc/$(package)/changelog.Debian
Wichert Akkermand321ff92002-03-31 18:45:45 +000077 install -p -o root -g root -m 644 TODO \
Roland McGrath6c95bed2007-07-05 20:55:07 +000078 debian/$(package)/usr/share/doc/$(package)/TODO
Wichert Akkermand321ff92002-03-31 18:45:45 +000079 install -p -o root -g root -m 644 NEWS \
Roland McGrath6c95bed2007-07-05 20:55:07 +000080 debian/$(package)/usr/share/doc/$(package)/changelog
81 gzip -9 debian/$(package)/usr/share/doc/$(package)/*
Wichert Akkermand321ff92002-03-31 18:45:45 +000082 install -p -o root -g root -m 644 debian/copyright \
Roland McGrath6c95bed2007-07-05 20:55:07 +000083 debian/$(package)/usr/share/doc/$(package)/copyright
84 install -p -o root -g root -m 644 strace.1 \
85 debian/$(package)/usr/share/man/man1/strace.1
86 gzip -9 debian/$(package)/usr/share/man/man1/strace.1
Roland McGrath91802a62008-05-20 01:46:58 +000087 install -d -o root -g root -m 755 \
88 debian/$(package)/usr/share/doc/$(package)/examples
89 install -p -o root -g root -m 755 strace-graph \
90 debian/$(package)/usr/share/doc/$(package)/examples
Wichert Akkermand321ff92002-03-31 18:45:45 +000091
Roland McGrath75df90e2007-08-03 09:59:09 +000092ifneq (,$(HOST64))
Roland McGrath6c95bed2007-07-05 20:55:07 +000093 install -o root -g root -m 755 build64/strace debian/$(package)/usr/bin/strace64
94 ln -s strace.1.gz debian/$(package)/usr/share/man/man1/strace64.1.gz
Roland McGrath0662b592006-01-12 11:03:44 +000095 dh_strip
Roland McGrathc9b624f2004-08-31 08:40:50 +000096endif
97
Roland McGrath5db90322004-08-31 08:54:09 +000098 dpkg-shlibdeps build/strace $(patsubst yes,build64/strace,$(build64))
99
Roland McGrath6019fbb2008-07-18 00:18:27 +0000100 dpkg-gencontrol -is -pstrace -Pdebian/$(package)
Roland McGrath6c95bed2007-07-05 20:55:07 +0000101 dpkg-deb --build debian/$(package) ..
Wichert Akkermand321ff92002-03-31 18:45:45 +0000102
103checkroot:
104 test root = "`whoami`"