]> granicus.if.org Git - strace/blob - debian/rules
2006-01-12 Roland McGrath <roland@redhat.com>
[strace] / debian / rules
1 #! /usr/bin/make -f
2
3 # Debian package information
4 package         = strace
5
6 DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
7 DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
8 DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
9
10 VERSION := $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }')
11 UDEB := strace-udeb_$(VERSION)_$(DEB_HOST_ARCH).udeb
12
13 ifeq ($(DEB_HOST_GNU_TYPE),sparc-linux)
14   build64 = yes
15   HOST64 = sparc64-linux
16   CC64 = gcc -m64
17 endif
18
19 ifeq ($(DEB_HOST_GNU_TYPE),s390-linux)
20   build64 = yes
21   HOST64 = s390x-linux
22   CC64 = gcc -m64
23 endif
24
25 ifeq ($(build64),yes)
26    extra_build_targets += stamp-build64
27 endif
28
29 ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
30   CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
31 else
32   CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
33 endif
34
35 all build: stamp-build
36
37 stamp-%: %/Makefile
38         $(MAKE) -C $*
39         touch $@
40
41 build/Makefile:
42         mkdir -p $(@D)
43         cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
44
45 build64/Makefile:
46         mkdir -p $(@D)
47         cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
48
49 clean:
50         rm -rf debian/tmp debian/substvars debian/files debian/files~
51         rm -rf build64 stamp-build64
52         rm -rf build stamp-build
53
54 binary: binary-indep binary-arch
55
56 binary-indep:
57
58 binary-arch: $(extra_build_targets) build checkroot
59         test -f stamp-build || make $(MFLAGS) -f debian/rules build
60         -rm -rf debian/tmp debian/files debian/substvars
61
62         install -d -m 755 -o root -g root debian/tmp
63         # reset the mode to work around a bug in install
64         chown 755 debian/tmp
65         install -d -m 755 -o root -g root debian/tmp/DEBIAN
66
67 # Install strace
68         install -d -o root -g root -m 755 debian/tmp/usr/bin
69         install -o root -g root -m 755 build/strace debian/tmp/usr/bin/strace
70         dh_strip
71
72         dpkg-gencontrol -is -pstrace-udeb -fdebian/files~
73         dpkg-deb --build debian/tmp ../$(UDEB)
74         dpkg-distaddfile $(UDEB) debian-installer extra
75
76 # Install documentation
77         install -d -o root -g root -m 755 debian/tmp/usr/share/doc/$(package)
78         install -d -o root -g root -m 755 debian/tmp/usr/share/man/man1
79         install -p -o root -g root -m 644 debian/changelog \
80                         debian/tmp/usr/share/doc/$(package)/changelog.Debian
81         install -p -o root -g root -m 644 TODO \
82                         debian/tmp/usr/share/doc/$(package)/TODO
83         install -p -o root -g root -m 644 NEWS \
84                         debian/tmp/usr/share/doc/$(package)/changelog
85         gzip -9 debian/tmp/usr/share/doc/$(package)/*
86         install -p -o root -g root -m 644 debian/copyright \
87                         debian/tmp/usr/share/doc/$(package)/copyright
88         install -p -o root -g root -m 644 strace.1 debian/tmp/usr/share/man/man1/strace.1
89         gzip -9 debian/tmp/usr/share/man/man1/strace.1
90
91 ifeq ($(build64),yes)
92         install -o root -g root -m 755 build64/strace debian/tmp/usr/bin/strace64
93         ln -s strace.1.gz debian/tmp/usr/share/man/man1/strace64.1.gz
94         dh_strip
95 endif
96
97         dpkg-shlibdeps build/strace $(patsubst yes,build64/strace,$(build64))
98
99         dpkg-gencontrol -is -pstrace
100         dpkg-deb --build debian/tmp ..
101
102 checkroot:
103         test root = "`whoami`"