blob: 529184060dd5a4740e7e65b3cf5cd7360f20df27 [file] [log] [blame]
Wichert Akkermand321ff92002-03-31 18:45:45 +00001#! /usr/bin/make -f
2
Roland McGrath9a001a72008-07-18 00:49:31 +00003#export DH_VERBOSE=1
Wichert Akkermand321ff92002-03-31 18:45:45 +00004
Roland McGrath38d88e62004-10-19 23:23:34 +00005DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
Roland McGrathc9b624f2004-08-31 08:40:50 +00006DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
Roland McGrath98d5f012005-02-03 03:19:34 +00007DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
8
Roland McGrath75df90e2007-08-03 09:59:09 +00009arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
10ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
11 HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
12 $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu
Roland McGrathc9b624f2004-08-31 08:40:50 +000013 CC64 = gcc -m64
Roland McGrath75df90e2007-08-03 09:59:09 +000014 extra_build_targets += stamp-build64
Roland McGrathc9b624f2004-08-31 08:40:50 +000015endif
16
Roland McGrath38d88e62004-10-19 23:23:34 +000017ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
18 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
19else
20 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
21endif
22
Roland McGrath75df90e2007-08-03 09:59:09 +000023all build: stamp-build $(extra_build_targets)
Roland McGrathc9b624f2004-08-31 08:40:50 +000024
25stamp-%: %/Makefile
26 $(MAKE) -C $*
27 touch $@
28
29build/Makefile:
30 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000031 cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
Roland McGrathc9b624f2004-08-31 08:40:50 +000032
33build64/Makefile:
34 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000035 cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
Roland McGrathc9b624f2004-08-31 08:40:50 +000036
Wichert Akkermand321ff92002-03-31 18:45:45 +000037clean:
Roland McGrath6019fbb2008-07-18 00:18:27 +000038 dh_clean
Roland McGrath9a001a72008-07-18 00:49:31 +000039 rm -rf debian/strace debian/strace-udeb debian/substvars debian/files debian/files~
Roland McGrathc9b624f2004-08-31 08:40:50 +000040 rm -rf build64 stamp-build64
41 rm -rf build stamp-build
Wichert Akkermand321ff92002-03-31 18:45:45 +000042
43binary: binary-indep binary-arch
44
45binary-indep:
46
Roland McGrath75df90e2007-08-03 09:59:09 +000047binary-arch: build checkroot
Wichert Akkermand321ff92002-03-31 18:45:45 +000048 test -f stamp-build || make $(MFLAGS) -f debian/rules build
Roland McGrath9a001a72008-07-18 00:49:31 +000049 dh_testdir -a
50 dh_testroot -a
51 dh_installdirs -a
52 dh_installdocs -a
53 dh_installman -a
54 dh_installexamples -a
55 dh_installchangelogs ChangeLog
56 dh_install -a
57 # install 64bit executable and manpage if it has been built
58 if test -f stamp-build64; then \
59 mv build64/strace build64/strace64 ; \
60 dh_install build64/strace64 usr/bin ; \
61 dh_link usr/share/man/man1/strace.1 usr/share/man/man1/strace64.1; \
62 else : ; fi
63 dh_link -a
64 dh_strip -a
65 dh_compress -a
66 dh_fixperms -a
67 dh_installdeb -a
68 dh_shlibdeps -a
69 dh_gencontrol -a
70 dh_md5sums -a
71 dh_builddeb -a
Wichert Akkermand321ff92002-03-31 18:45:45 +000072
73checkroot:
74 test root = "`whoami`"