blob: 52220fa3c72a2ae40a7516975c3e2f84675e8a83 [file] [log] [blame]
Wichert Akkermand321ff92002-03-31 18:45:45 +00001#! /usr/bin/make -f
2
Frederik Schüler0c56f622010-04-13 13:04:00 +02003#export DH_VERBOSE=1
Frederik Schüler881f5732010-02-04 12:14:56 -08004
Dmitry V. Levin41829812014-06-03 12:56:42 +00005export DEB_BUILD_MAINT_OPTIONS = hardening=+all
6DPKG_EXPORT_BUILDFLAGS = 1
7include /usr/share/dpkg/buildflags.mk
8
9CFLAGS += -Wall -g
Frederik Schüler881f5732010-02-04 12:14:56 -080010
11ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
12 CFLAGS += -O0
13else
14 CFLAGS += -O2
15endif
Wichert Akkermand321ff92002-03-31 18:45:45 +000016
Frederik Schüler0c56f622010-04-13 13:04:00 +020017ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
18 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
19 MAKEFLAGS += -j$(NUMJOBS)
20endif
21
Roland McGrath38d88e62004-10-19 23:23:34 +000022DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
Roland McGrathc9b624f2004-08-31 08:40:50 +000023DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
Roland McGrath98d5f012005-02-03 03:19:34 +000024DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
25
Roland McGrath75df90e2007-08-03 09:59:09 +000026arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
27ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
28 HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
29 $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu
Roland McGrathc9b624f2004-08-31 08:40:50 +000030 CC64 = gcc -m64
Frederik Schüler0c56f622010-04-13 13:04:00 +020031 extra_build_targets += build64-stamp
Roland McGrathc9b624f2004-08-31 08:40:50 +000032endif
33
Roland McGrath38d88e62004-10-19 23:23:34 +000034ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
35 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
36else
37 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
38endif
39
Frederik Schüler0c56f622010-04-13 13:04:00 +020040all build: build-stamp $(extra_build_targets)
Roland McGrathc9b624f2004-08-31 08:40:50 +000041
Frederik Schüler0c56f622010-04-13 13:04:00 +020042%-stamp: %/Makefile
Roland McGrathc9b624f2004-08-31 08:40:50 +000043 $(MAKE) -C $*
Dmitry V. Levin983e8752011-02-27 10:16:41 +000044ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
45 $(MAKE) -C $* check
46endif
Roland McGrathc9b624f2004-08-31 08:40:50 +000047 touch $@
48
49build/Makefile:
50 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000051 cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
Roland McGrathc9b624f2004-08-31 08:40:50 +000052
53build64/Makefile:
54 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000055 cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
Roland McGrathc9b624f2004-08-31 08:40:50 +000056
Wichert Akkermand321ff92002-03-31 18:45:45 +000057clean:
Frederik Schüler881f5732010-02-04 12:14:56 -080058 dh_testdir
59 dh_testroot
Frederik Schüler0c56f622010-04-13 13:04:00 +020060 rm -rf build build64 strace64.1
Roland McGrath6019fbb2008-07-18 00:18:27 +000061 dh_clean
Wichert Akkermand321ff92002-03-31 18:45:45 +000062
63binary: binary-indep binary-arch
64
65binary-indep:
66
Frederik Schüler881f5732010-02-04 12:14:56 -080067binary-arch: build
Frederik Schüler0c56f622010-04-13 13:04:00 +020068 test -f build-stamp || make $(MFLAGS) -f debian/rules build
Dmitry V. Levin414fe7d2009-07-08 11:21:17 +000069
Roland McGratha04e2132008-07-22 00:27:31 +000070 # prepare 64bit executable and manpage, if it has been built
Frederik Schüler0c56f622010-04-13 13:04:00 +020071 test -f build64-stamp && ( mv build64/strace build64/strace64 ; \
Roland McGratha04e2132008-07-22 00:27:31 +000072 cp strace.1 strace64.1 ) || true
Dmitry V. Levin414fe7d2009-07-08 11:21:17 +000073
Roland McGratha04e2132008-07-22 00:27:31 +000074 dh_testdir -s
75 dh_testroot -s
76 dh_installdirs -s
77 dh_installdocs -s
78 dh_installman -s
79 dh_installexamples -s
Frederik Schülerf786da52009-10-05 20:50:07 +000080 dh_installchangelogs -s
Roland McGratha04e2132008-07-22 00:27:31 +000081 dh_install -s
82 dh_link -s
83 dh_strip -s
84 dh_compress -s
85 dh_fixperms -s
86 dh_installdeb -s
87 dh_shlibdeps -s
88 dh_gencontrol -s
89 dh_md5sums -s
90 dh_builddeb -s