• 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
8
9CFLAGS += -Wall -g
10
11ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
12  CFLAGS += -O0
13else
14  CFLAGS += -O2
15endif
16
17ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
18  NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
19  MAKEFLAGS += -j$(NUMJOBS)
20endif
21
22DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
23DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
24DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
25
26extra_build_targets += build-udeb-stamp
27
28arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
29ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
30  HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
31	     $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu
32  CC64 = gcc -m64
33  extra_build_targets += build64-stamp
34endif
35
36ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
37  CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
38else
39  CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
40endif
41
42all: build
43
44build: build-arch build-indep
45
46build-arch: build-stamp $(extra_build_targets)
47build-indep: build-stamp $(extra_build_targets)
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:
58	mkdir -p $(@D)
59	cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr $(CONFIG_OPTS)
60
61build-udeb/Makefile:
62	mkdir -p $(@D)
63	cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr \
64		--without-libunwind --without-libiberty $(CONFIG_OPTS)
65
66build64/Makefile:
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		cp strace.1 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