rules revision f786da5b1be84743bd9287304b6dad3633339ed8
1#! /usr/bin/make -f
2
3#export DH_VERBOSE=1
4
5DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
6DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
7DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
8
9arch64_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
13  CC64 = gcc -m64
14  extra_build_targets += stamp-build64
15endif
16
17ifeq ($(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
23all build: stamp-build $(extra_build_targets)
24
25stamp-%: %/Makefile
26	$(MAKE) -C $*
27	touch $@
28
29build/Makefile:
30	mkdir -p $(@D)
31	cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
32
33build64/Makefile:
34	mkdir -p $(@D)
35	cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
36
37clean:
38	dh_clean
39	rm -rf debian/strace debian/strace-udeb debian/substvars debian/files debian/files~
40	rm -rf build64 stamp-build64 strace64.1
41	rm -rf build stamp-build
42
43binary: binary-indep binary-arch
44
45binary-indep:
46
47binary-arch: build checkroot
48	test -f stamp-build || make $(MFLAGS) -f debian/rules build
49
50	# 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
53
54	dh_testdir -s
55	dh_testroot -s
56	dh_installdirs -s
57	dh_installdocs -s
58	dh_installman -s
59	dh_installexamples -s
60	dh_installchangelogs -s
61	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
71
72checkroot:
73	test root = "`whoami`"
74