blob: c87b35a11e2db8659c5f3d5b9445163ac81c261e [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 McGratha04e2132008-07-22 00:27:31 +000040 rm -rf build64 stamp-build64 strace64.1
Roland McGrathc9b624f2004-08-31 08:40:50 +000041 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
Dmitry V. Levin414fe7d2009-07-08 11:21:17 +000049
Roland McGratha04e2132008-07-22 00:27:31 +000050 # prepare 64bit executable and manpage, if it has been built
51 test -f stamp-build64 && ( mv build64/strace build64/strace64 ; \
52 cp strace.1 strace64.1 ) || true
Dmitry V. Levin414fe7d2009-07-08 11:21:17 +000053
Roland McGratha04e2132008-07-22 00:27:31 +000054 dh_testdir -s
55 dh_testroot -s
56 dh_installdirs -s
57 dh_installdocs -s
58 dh_installman -s
59 dh_installexamples -s
Frederik Schülerf786da52009-10-05 20:50:07 +000060 dh_installchangelogs -s
Roland McGratha04e2132008-07-22 00:27:31 +000061 dh_install -s
62 dh_link -s
63 dh_strip -s
64 dh_compress -s
65 dh_fixperms -s
66 dh_installdeb -s
67 dh_shlibdeps -s
68 dh_gencontrol -s
69 dh_md5sums -s
70 dh_builddeb -s
Wichert Akkermand321ff92002-03-31 18:45:45 +000071
72checkroot:
73 test root = "`whoami`"