man: create parent directories in install recipe

Support the use of `make install` in packaging scripts, where the
$mandir tree might not exist under $DESTDIR.

For portability, create the parent directories using a separate install
command instead of relying on the non-portable `-D` flag.

Set errexit so the install target fails if any install step fails.

Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
Cory Snider
2024-08-27 15:49:43 -04:00
parent dfb88e57d5
commit 88b118688e

View File

@@ -35,7 +35,9 @@ man%:
.PHONY: install .PHONY: install
install: all install: all
@set -ex; \
for sec in $(sections); do \ for sec in $(sections); do \
$(INSTALL) -d $(DESTDIR)$(mandir)/man$$sec && \
$(INSTALL_DATA) man$$sec/* $(DESTDIR)$(mandir)/man$$sec; \ $(INSTALL_DATA) man$$sec/* $(DESTDIR)$(mandir)/man$$sec; \
done done