]> granicus.if.org Git - strace/blob - debian/rules
Introduce generic STRINGIFY and STRINGIFY_VAL macros
[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         $(MAKE) -C $* check VERBOSE=1
51 endif
52         touch $@
53
54 build/Makefile:
55         mkdir -p $(@D)
56         cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
57
58 build64/Makefile:
59         mkdir -p $(@D)
60         cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
61
62 clean:
63         dh_testdir
64         dh_testroot
65         rm -rf build build64 strace64.1 debian/strace64.substvars
66         dh_clean
67
68 binary: binary-indep binary-arch
69
70 binary-indep:
71
72 binary-arch: build
73         test -f build-stamp || make $(MFLAGS) -f debian/rules build
74
75         # prepare 64bit executable and manpage, if it has been built
76         test -f build64-stamp && ( mv build64/strace build64/strace64 ; \
77                 cp strace.1 strace64.1 ) || true
78
79         dh_testdir -s
80         dh_testroot -s
81         dh_installdirs -s
82         dh_installdocs -s
83         dh_installman -s
84         dh_installexamples -s
85         dh_installchangelogs -s
86         dh_install -s
87         dh_link -s
88         dh_strip -s
89         dh_compress -s
90         dh_fixperms -s
91         dh_installdeb -s
92         dh_shlibdeps -s
93         dh_gencontrol -s
94         dh_md5sums -s
95         dh_builddeb -s