blob: e17c612453ba5d6f348af19f2cb0d1cfb7a62d03 [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 McGrathc9b624f2004-08-31 08:40:50 +000013ifeq ($(DEB_HOST_GNU_TYPE),sparc-linux)
14 build64 = yes
15 HOST64 = sparc64-linux
16 CC64 = gcc -m64
17endif
18
Roland McGrath38d88e62004-10-19 23:23:34 +000019ifeq ($(DEB_HOST_GNU_TYPE),s390-linux)
20 build64 = yes
21 HOST64 = s390x-linux
22 CC64 = gcc -m64
23endif
24
Roland McGrathc9b624f2004-08-31 08:40:50 +000025ifeq ($(build64),yes)
26 extra_build_targets += stamp-build64
27endif
28
Roland McGrath38d88e62004-10-19 23:23:34 +000029ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
30 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
31else
32 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
33endif
34
Roland McGrathc9b624f2004-08-31 08:40:50 +000035all build: stamp-build
36
37stamp-%: %/Makefile
38 $(MAKE) -C $*
39 touch $@
40
41build/Makefile:
42 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000043 cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
Roland McGrathc9b624f2004-08-31 08:40:50 +000044
45build64/Makefile:
46 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000047 cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
Roland McGrathc9b624f2004-08-31 08:40:50 +000048
Wichert Akkermand321ff92002-03-31 18:45:45 +000049clean:
Roland McGrath98d5f012005-02-03 03:19:34 +000050 rm -rf debian/tmp debian/substvars debian/files debian/files~
Roland McGrathc9b624f2004-08-31 08:40:50 +000051 rm -rf build64 stamp-build64
52 rm -rf build stamp-build
Wichert Akkermand321ff92002-03-31 18:45:45 +000053
54binary: binary-indep binary-arch
55
56binary-indep:
57
Roland McGrathc9b624f2004-08-31 08:40:50 +000058binary-arch: $(extra_build_targets) build checkroot
Wichert Akkermand321ff92002-03-31 18:45:45 +000059 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
Roland McGrath98d5f012005-02-03 03:19:34 +000067# Install strace
68 install -d -o root -g root -m 755 debian/tmp/usr/bin
69 install -s -o root -g root -m 755 build/strace debian/tmp/usr/bin/strace
70
71 dpkg-gencontrol -is -pstrace-udeb -fdebian/files~
72 dpkg-deb --build debian/tmp ../$(UDEB)
73 dpkg-distaddfile $(UDEB) debian-installer extra
74
Wichert Akkermand321ff92002-03-31 18:45:45 +000075# Install documentation
76 install -d -o root -g root -m 755 debian/tmp/usr/share/doc/$(package)
Roland McGrath98d5f012005-02-03 03:19:34 +000077 install -d -o root -g root -m 755 debian/tmp/usr/share/man/man1
Wichert Akkermand321ff92002-03-31 18:45:45 +000078 install -p -o root -g root -m 644 debian/changelog \
79 debian/tmp/usr/share/doc/$(package)/changelog.Debian
80 install -p -o root -g root -m 644 TODO \
81 debian/tmp/usr/share/doc/$(package)/TODO
82 install -p -o root -g root -m 644 NEWS \
83 debian/tmp/usr/share/doc/$(package)/changelog
84 gzip -9 debian/tmp/usr/share/doc/$(package)/*
85 install -p -o root -g root -m 644 debian/copyright \
86 debian/tmp/usr/share/doc/$(package)/copyright
Wichert Akkermand321ff92002-03-31 18:45:45 +000087 install -p -o root -g root -m 644 strace.1 debian/tmp/usr/share/man/man1/strace.1
88 gzip -9 debian/tmp/usr/share/man/man1/strace.1
89
Roland McGrathc9b624f2004-08-31 08:40:50 +000090ifeq ($(build64),yes)
91 install -s -o root -g root -m 755 build64/strace debian/tmp/usr/bin/strace64
Roland McGrathc5fa4ac2004-10-19 23:29:47 +000092 ln -s strace.1.gz debian/tmp/usr/share/man/man1/strace64.1.gz
Roland McGrathc9b624f2004-08-31 08:40:50 +000093endif
94
Roland McGrath5db90322004-08-31 08:54:09 +000095 dpkg-shlibdeps build/strace $(patsubst yes,build64/strace,$(build64))
96
Roland McGrath98d5f012005-02-03 03:19:34 +000097 dpkg-gencontrol -is -pstrace
98 dpkg-deb --build debian/tmp ..
Wichert Akkermand321ff92002-03-31 18:45:45 +000099
100checkroot:
101 test root = "`whoami`"