add proper error handling for all final exec calls
[hband-tools.git] / user-tools / Makefile.documentation.mk
blobd2e71cc7b56bd35889edb56d657185be6c2ac0ec
2 ifndef TOOLS
3 $(error TOOLS is not set in Makefile)
4 endif
6 ifndef REPO_ROOT
7 $(error REPO_ROOT is not set in Makefile)
8 endif
10 MANPAGE_SECTION ?= 1
11 MANPAGE_SECTION_EXT ?= $(MANPAGE_SECTION)
13 MANPAGES_DIR = $(REPO_ROOT)/doc/man
14 MANPAGE_FILE_SUFFIX = .$(MANPAGE_SECTION_EXT).xz
15 MANPAGES_SUBDIR = $(MANPAGES_DIR)/man$(MANPAGE_SECTION)
16 MANPAGE_FILES = $(foreach toolname,$(TOOLS),$(MANPAGES_SUBDIR)/$(toolname)$(MANPAGE_FILE_SUFFIX))
18 manpages: $(MANPAGE_FILES)
19 .PHONY: manpages
21 $(MANPAGE_FILES): | $(MANPAGES_SUBDIR)
23 $(MANPAGES_SUBDIR):
24 mkdir -p $@
25 @echo remove $@ >> uninstall.sh
27 $(MANPAGE_FILES): $(MANPAGES_SUBDIR)/%$(MANPAGE_FILE_SUFFIX): %
28 @if podchecker "$<"; then \
29 pod2man --name="$<" --section $(MANPAGE_SECTION_EXT) --utf8 "$<" | xz > "$@.tmp" &&\
30 mv -f "$@.tmp" "$@" ;\
31 else \
32 touch "$@" ;\
35 install-manpages: manpages
36 $(MAKE) -C $(REPO_ROOT)/doc/man install-manpages
37 .PHONY: install-manpages
40 descriptions.txt: $(TOOLS)
41 perl -ne 'if(/^=head1 NAME/){ <>; print while $$_=<> and !/^\s*$$/; }' -- $(sort $(TOOLS)) | uniq > $@~
42 mv -f $@~ $@