• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /usr/bin/make -f
2
3#export DH_VERBOSE=1
4
5export DEB_BUILD_MAINT_OPTIONS = hardening=+all
6DPKG_EXPORT_BUILDFLAGS = 1
7include /usr/share/dpkg/buildflags.mk
8include /usr/share/dpkg/architecture.mk
9
10CFLAGS += -Wall -g
11
12ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
13  CFLAGS += -O0
14else
15  CFLAGS += -O2
16endif
17
18ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
19  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
20  MAKEFLAGS += -j$(NUMJOBS)
21endif
22
23extra_build_targets += build-udeb-stamp
24
25arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
26ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
27  HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
28	     $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu
29  CC64 = gcc -m64
30  extra_build_targets += build64-stamp
31endif
32
33ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
34  CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
35else
36  CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
37endif
38
39all: build
40
41build: build-arch build-indep
42
43build-arch: build-stamp $(extra_build_targets)
44build-indep: build-stamp $(extra_build_targets)
45
46configure:
47	./bootstrap
48
49%-stamp: %/Makefile
50	$(MAKE) -C $*
51ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
52	$*/strace -V
53	$(MAKE) -C $* check VERBOSE=1
54endif
55	touch $@
56
57build/Makefile: configure
58	mkdir -p $(@D)
59	cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr $(CONFIG_OPTS)
60
61build-udeb/Makefile: configure
62	mkdir -p $(@D)
63	cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr \
64		--without-stacktrace --without-libiberty $(CONFIG_OPTS)
65
66build64/Makefile: configure
67	mkdir -p $(@D)
68	cd $(@D); CC="$(CC64)" sh ../configure --enable-mpers=check --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
69
70clean:
71	dh_testdir
72	dh_testroot
73	rm -rf build build-udeb build64 strace64.1 debian/strace64.substvars
74	dh_clean
75
76binary: binary-indep binary-arch
77
78binary-indep:
79
80binary-arch: build
81	test -f build-stamp || make $(MFLAGS) -f debian/rules build
82
83	# prepare 64bit executable and manpage, if it has been built
84	test -f build64-stamp && ( mv build64/strace build64/strace64 ; \
85		mv build64/strace.1 build64/strace64.1 ) || true
86
87	dh_testdir -a
88	dh_testroot -a
89	dh_installdirs -a
90	dh_installdocs -a
91	dh_installman -a
92	dh_installexamples -a
93	dh_installchangelogs -a
94	dh_install -a
95	dh_link -a
96	dh_strip -a
97	dh_compress -a
98	dh_fixperms -a
99	dh_installdeb -a
100	dh_shlibdeps -a
101	dh_gencontrol -a
102	dh_md5sums -a
103	dh_builddeb -a
104