rules revision 0c56f62207d81713f9ce7705e865b75f921e6a1b
1#! /usr/bin/make -f
2
3#export DH_VERBOSE=1
4
5CFLAGS = -Wall -g
6
7ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
8  CFLAGS += -O0
9else
10  CFLAGS += -O2
11endif
12
13ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
14  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
15  MAKEFLAGS += -j$(NUMJOBS)
16endif
17
18DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
19DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
20DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
21
22arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
23ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
24  HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
25	     $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu
26  CC64 = gcc -m64
27  extra_build_targets += build64-stamp
28endif
29
30ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
31  CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
32else
33  CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
34endif
35
36all build: build-stamp $(extra_build_targets)
37
38%-stamp: %/Makefile
39	$(MAKE) -C $*
40	touch $@
41
42build/Makefile:
43	mkdir -p $(@D)
44	cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
45
46build64/Makefile:
47	mkdir -p $(@D)
48	cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
49
50clean:
51	dh_testdir
52	dh_testroot
53	rm -rf build build64 strace64.1
54	dh_clean
55
56binary: binary-indep binary-arch
57
58binary-indep:
59
60binary-arch: build
61	test -f build-stamp || make $(MFLAGS) -f debian/rules build
62
63	# prepare 64bit executable and manpage, if it has been built
64	test -f build64-stamp && ( mv build64/strace build64/strace64 ; \
65		cp strace.1 strace64.1 ) || true
66
67	dh_testdir -s
68	dh_testroot -s
69	dh_installdirs -s
70	dh_installdocs -s
71	dh_installman -s
72	dh_installexamples -s
73	dh_installchangelogs -s
74	dh_install -s
75	dh_link -s
76	dh_strip -s
77	dh_compress -s
78	dh_fixperms -s
79	dh_installdeb -s
80	dh_shlibdeps -s
81	dh_gencontrol -s
82	dh_md5sums -s
83	dh_builddeb -s
84