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