blob: 633a5a60e0a4ddd6006f07e402ce5127ba292999 [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)
Wichert Akkermand321ff92002-03-31 18:45:45 +00008
Roland McGrathc9b624f2004-08-31 08:40:50 +00009ifeq ($(DEB_HOST_GNU_TYPE),sparc-linux)
10 build64 = yes
11 HOST64 = sparc64-linux
12 CC64 = gcc -m64
13endif
14
Roland McGrath38d88e62004-10-19 23:23:34 +000015ifeq ($(DEB_HOST_GNU_TYPE),s390-linux)
16 build64 = yes
17 HOST64 = s390x-linux
18 CC64 = gcc -m64
19endif
20
Roland McGrathc9b624f2004-08-31 08:40:50 +000021ifeq ($(build64),yes)
22 extra_build_targets += stamp-build64
23endif
24
Roland McGrath38d88e62004-10-19 23:23:34 +000025ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
26 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
27else
28 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
29endif
30
Roland McGrathc9b624f2004-08-31 08:40:50 +000031all build: stamp-build
32
33stamp-%: %/Makefile
34 $(MAKE) -C $*
35 touch $@
36
37build/Makefile:
38 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000039 cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
Roland McGrathc9b624f2004-08-31 08:40:50 +000040
41build64/Makefile:
42 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000043 cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
Roland McGrathc9b624f2004-08-31 08:40:50 +000044
Wichert Akkermand321ff92002-03-31 18:45:45 +000045clean:
Wichert Akkermand321ff92002-03-31 18:45:45 +000046 rm -rf debian/tmp debian/substvars debian/files
Roland McGrathc9b624f2004-08-31 08:40:50 +000047 rm -rf build64 stamp-build64
48 rm -rf build stamp-build
Wichert Akkermand321ff92002-03-31 18:45:45 +000049
50binary: binary-indep binary-arch
51
52binary-indep:
53
Roland McGrathc9b624f2004-08-31 08:40:50 +000054binary-arch: $(extra_build_targets) build checkroot
Wichert Akkermand321ff92002-03-31 18:45:45 +000055 test -f stamp-build || make $(MFLAGS) -f debian/rules build
56 -rm -rf debian/tmp debian/files debian/substvars
57
58 install -d -m 755 -o root -g root debian/tmp
59 # reset the mode to work around a bug in install
60 chown 755 debian/tmp
61 install -d -m 755 -o root -g root debian/tmp/DEBIAN
62
63# Install documentation
64 install -d -o root -g root -m 755 debian/tmp/usr/share/doc/$(package)
65 install -p -o root -g root -m 644 debian/changelog \
66 debian/tmp/usr/share/doc/$(package)/changelog.Debian
67 install -p -o root -g root -m 644 TODO \
68 debian/tmp/usr/share/doc/$(package)/TODO
69 install -p -o root -g root -m 644 NEWS \
70 debian/tmp/usr/share/doc/$(package)/changelog
71 gzip -9 debian/tmp/usr/share/doc/$(package)/*
72 install -p -o root -g root -m 644 debian/copyright \
73 debian/tmp/usr/share/doc/$(package)/copyright
74
75# Install strace
76 install -d -o root -g root -m 755 debian/tmp/usr/bin debian/tmp/usr/share/man/man1
Roland McGrathc9b624f2004-08-31 08:40:50 +000077 install -s -o root -g root -m 755 build/strace debian/tmp/usr/bin/strace
Wichert Akkermand321ff92002-03-31 18:45:45 +000078 install -p -o root -g root -m 644 strace.1 debian/tmp/usr/share/man/man1/strace.1
79 gzip -9 debian/tmp/usr/share/man/man1/strace.1
80
Roland McGrathc9b624f2004-08-31 08:40:50 +000081ifeq ($(build64),yes)
82 install -s -o root -g root -m 755 build64/strace debian/tmp/usr/bin/strace64
83 ln -s strace.1 debian/tmp/usr/share/man/man1/strace64.1
84endif
85
Roland McGrath5db90322004-08-31 08:54:09 +000086 dpkg-shlibdeps build/strace $(patsubst yes,build64/strace,$(build64))
87
Wichert Akkermand321ff92002-03-31 18:45:45 +000088 dpkg-gencontrol -isp
89 dpkg --build debian/tmp ..
90
91checkroot:
92 test root = "`whoami`"