#!/usr/bin/make -f # resolve DEB_VERSION_UPSTREAM include /usr/share/dpkg/pkg-info.mk # generate documentation unless nodoc requested ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) DOCS = README.html README.txt CHANGELOGS = CHANGELOG.html CHANGELOG.txt MANPAGES = debian/scaphandre.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; } # Fails on a virtual machine TEST_VM = \ read_core_stats \ read_socket_stats \ get_topology_returns_topology_type \ read_topology_stats %: dh $@ --with-linktree override_dh_auto_test: dh_auto_test --buildsystem rust -- \ --no-fail-fast -- $(addprefix --skip ,$(TEST_VM)) %.html: %.md cmark-gfm $< > $@ %.txt: %.md cmark-gfm --to plaintext $< > $@ execute_after_dh_auto_build: $(DOCS) $(CHANGELOGS) mdbook build --dest-dir docs rm -rf docs/FontAwesome execute_after_dh_auto_install: $(MANPAGES) override_dh_installdocs: dh_installdocs --all -- $(DOCS) override_dh_installchangelogs: dh_installchangelogs -- $(CHANGELOGS) # build manpages debian/scaphandre.1: debian/%.1: debian/scaphandre/usr/bin/% $(call _help2man,$@,$<) set -e; $(foreach x,stdout json prometheus,\ $(call _help2man,$@,$<,$x);)