#!/usr/bin/make -f # resolve DEB_VERSION_UPSTREAM include /usr/share/dpkg/pkg-info.mk export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic export DEB_CXXFLAGS_MAINT_APPEND = -Wall -pedantic # trust upstream optimization level unless explicitly disabled ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS))) export DEB_CFLAGS_MAINT_STRIP=-O2 export DEB_CXXFLAGS_MAINT_STRIP=-O2 endif # generate documentation unless nodoc requested ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) MANPAGES = debian/build/hypothesis-client.1 endif # generate manual pages from output of clap-based Rust binary # arguments: 1:MANFILEPATH 2:COMMANDPATH 3:SUBCOMMAND(S) _help2man = \ $(eval suffix = $(lastword $(subst ., ,$(1))))\ $(eval stem = $(patsubst %.$(suffix),%,$(1)))\ help2man --section $(suffix) --no-info \ --version-string='$(DEB_VERSION_UPSTREAM)' \ --name $(shell $(2) $(3) --help | head --lines=1 | xargs -0 shell-quote --) \ --output '$(stem)$(if $(3),-$(subst $() ,-,$(strip $(3)))).$(suffix)' \ '$(2)$(if $(3), $(3))' \ || { $(2) $(3) --help; false; } # set dummy API values to cheat too invasive validation export HYPOTHESIS_NAME = foo export HYPOTHESIS_KEY = bar export TEST_GROUP_ID = baz %: dh $@ # generate shell completion scripts and manual pages execute_after_dh_auto_install-arch: $(MANPAGES) debian/build/hypothesis-client.1: debian/build/%.1: debian/hypothesis-client/usr/bin/% mkdir --parents debian/build $< complete bash > debian/build/bash-completion $< complete zsh > debian/build/_hypothesis-client $(call _help2man,$@,$<) $(call _help2man,$@,$<,annotations) set -e; $(foreach x,create update search fetch delete flag hide show,\ $(call _help2man,$@,$<,annotations $x);) $(call _help2man,$@,$<,groups) set -e; $(foreach x,list create fetch update members leave,\ $(call _help2man,$@,$<,groups $x);) $(call _help2man,$@,$<,profile)