| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
| 4 |
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
| 5 |
|
| 6 |
configure_flags = --prefix=/usr |
| 7 |
configure_flags += --build $(DEB_BUILD_GNU_TYPE) |
| 8 |
ifneq "$(DEB_BUILD_GNU_TYPE)" "$(DEB_HOST_GNU_TYPE)" |
| 9 |
configure_flags += --host $(DEB_HOST_GNU_TYPE) |
| 10 |
endif |
| 11 |
configure_flags += $(shell DEB_BUILD_MAINT_OPTIONS=hardening=+all dpkg-buildflags --export=configure) |
| 12 |
|
| 13 |
n_jobs = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 14 |
parallel = -j$(or $(n_jobs),1) |
| 15 |
|
| 16 |
manpage_sources = $(wildcard debian/manpages/*.rst) |
| 17 |
manpages = $(manpage_sources:.rst=.1) |
| 18 |
|
| 19 |
.PHONY: clean |
| 20 |
clean: |
| 21 |
dh_clean |
| 22 |
rm -rf obj/ |
| 23 |
rm -rf $(manpages) |
| 24 |
$(RM) compile test-driver |
| 25 |
|
| 26 |
.PHONY: build build-arch build-indep |
| 27 |
build build-arch build-indep: obj/build-stamp |
| 28 |
ifeq "$(filter nocheck,$(DEB_BUILD_OPTIONS))" "" |
| 29 |
build build-arch build-indep: obj/test-stamp |
| 30 |
endif |
| 31 |
|
| 32 |
obj/autoconf-stamp: configure.ac |
| 33 |
dh_testdir |
| 34 |
autoreconf -vfi |
| 35 |
mkdir -p $(dir $@) |
| 36 |
touch $(@) |
| 37 |
|
| 38 |
obj/config.status: obj/autoconf-stamp |
| 39 |
dh_testdir |
| 40 |
cd obj/ && ../configure $(configure_flags) |
| 41 |
|
| 42 |
%.1: %.rst |
| 43 |
rst2man $(<) $(@) |
| 44 |
|
| 45 |
obj/build-stamp: obj/config.status $(manpages) |
| 46 |
dh_testdir |
| 47 |
$(MAKE) -C obj/ $(parallel) |
| 48 |
touch $(@) |
| 49 |
|
| 50 |
obj/test-stamp: obj/build-stamp |
| 51 |
$(MAKE) -C obj/test/ check |
| 52 |
touch $(@) |
| 53 |
|
| 54 |
.PHONY: binary binary-arch binary-indep |
| 55 |
binary: binary-arch binary-indep |
| 56 |
|
| 57 |
obj/install-stamp: obj/build-stamp |
| 58 |
dh_testdir |
| 59 |
$(MAKE) -C obj/ install DESTDIR=$(CURDIR)/debian/tmp |
| 60 |
touch $(@) |
| 61 |
|
| 62 |
binary-arch: obj/install-stamp |
| 63 |
dh_testdir |
| 64 |
dh_testroot |
| 65 |
dh_prep -a -X tmp |
| 66 |
dh_install -a --fail-missing |
| 67 |
dh_installdocs -a |
| 68 |
dh_installchangelogs -a |
| 69 |
dh_installman |
| 70 |
dh_compress -a |
| 71 |
dh_fixperms -a |
| 72 |
dh_strip -a |
| 73 |
dh_shlibdeps -a |
| 74 |
dh_installdeb -a |
| 75 |
dh_gencontrol -a |
| 76 |
dh_md5sums -a |
| 77 |
dh_builddeb -a |
| 78 |
|
| 79 |
binary-indep: obj/install-stamp |
| 80 |
dh_testdir |
| 81 |
dh_testroot |
| 82 |
dh_prep -i -X tmp |
| 83 |
dh_install -i --fail-missing |
| 84 |
dh_installdocs -i |
| 85 |
dh_installchangelogs -i |
| 86 |
dh_compress -i |
| 87 |
dh_fixperms -i |
| 88 |
dh_installdeb -i |
| 89 |
dh_gencontrol -i |
| 90 |
dh_md5sums -i |
| 91 |
dh_builddeb -i |
| 92 |
|
| 93 |
.SECONDARY: |
| 94 |
.NOTPARALLEL: |
| 95 |
|
| 96 |
# vim:ts=4 sw=4 noet |