blob: 912b4103ee25f20d113cc13f9bf2af7d3f713624 [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
Dmitry V. Levina283ae02014-08-15 13:14:15 +000040all: build
41
42build: build-arch build-indep
43
44build-arch: build-stamp $(extra_build_targets)
45build-indep: build-stamp $(extra_build_targets)
Roland McGrathc9b624f2004-08-31 08:40:50 +000046
Frederik Schüler0c56f622010-04-13 13:04:00 +020047%-stamp: %/Makefile
Roland McGrathc9b624f2004-08-31 08:40:50 +000048 $(MAKE) -C $*
Dmitry V. Levin983e8752011-02-27 10:16:41 +000049ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
50 $(MAKE) -C $* check
51endif
Roland McGrathc9b624f2004-08-31 08:40:50 +000052 touch $@
53
54build/Makefile:
55 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000056 cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
Roland McGrathc9b624f2004-08-31 08:40:50 +000057
58build64/Makefile:
59 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000060 cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
Roland McGrathc9b624f2004-08-31 08:40:50 +000061
Wichert Akkermand321ff92002-03-31 18:45:45 +000062clean:
Frederik Schüler881f5732010-02-04 12:14:56 -080063 dh_testdir
64 dh_testroot
Frederik Schüler0c56f622010-04-13 13:04:00 +020065 rm -rf build build64 strace64.1
Roland McGrath6019fbb2008-07-18 00:18:27 +000066 dh_clean
Wichert Akkermand321ff92002-03-31 18:45:45 +000067
68binary: binary-indep binary-arch
69
70binary-indep:
71
Frederik Schüler881f5732010-02-04 12:14:56 -080072binary-arch: build
Frederik Schüler0c56f622010-04-13 13:04:00 +020073 test -f build-stamp || make $(MFLAGS) -f debian/rules build
Dmitry V. Levin414fe7d2009-07-08 11:21:17 +000074
Roland McGratha04e2132008-07-22 00:27:31 +000075 # prepare 64bit executable and manpage, if it has been built
Frederik Schüler0c56f622010-04-13 13:04:00 +020076 test -f build64-stamp && ( mv build64/strace build64/strace64 ; \
Roland McGratha04e2132008-07-22 00:27:31 +000077 cp strace.1 strace64.1 ) || true
Dmitry V. Levin414fe7d2009-07-08 11:21:17 +000078
Roland McGratha04e2132008-07-22 00:27:31 +000079 dh_testdir -s
80 dh_testroot -s
81 dh_installdirs -s
82 dh_installdocs -s
83 dh_installman -s
84 dh_installexamples -s
Frederik Schülerf786da52009-10-05 20:50:07 +000085 dh_installchangelogs -s
Roland McGratha04e2132008-07-22 00:27:31 +000086 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