Makefile.common.inc: add {,un}install targets

Allow installing generated pdfs with 'make install' in all Osmocom
projects using osmo-gsm-manuals. This makes proper debian packaging of
the manuals easier.

Autotools will automatically run this file's install target, when
running 'make install' in the top source dir. Do not install anything,
when OSMO_GSM_MANUALS_NO_INSTALL is set, and set this variable for the
tests dir, so we don't install the test pdfs.

Related: OS#3899
Change-Id: I66f33172fa410681acbaef4592e9405627948705
This commit is contained in:
Oliver Smith 2019-04-05 14:44:55 +02:00
parent 7390b95c11
commit 5501ba607b
2 changed files with 30 additions and 1 deletions

View File

@ -3,12 +3,18 @@
# Other makefiles like Makefile.asciidoc.inc and Makefile.vty-reference.inc add
# entries to UPLOAD_FILES and CLEAN_FILES.
#
# Include this file at the end to have the common targets (upload, clean etc.).
# Put the repository name (e.g. "osmo-bts") into OSMO_REPOSITORY and include
# this file at the end to have the common targets (upload, clean, install etc.).
SSH_COMMAND = ssh -o 'UserKnownHostsFile=$(OSMO_GSM_MANUALS_DIR)/build/known_hosts' -p 48
UPLOAD_PATH ?= generic@sysmocom-downloads:documents
SYMLINKS = common build
CLEAN_FILES += $(SYMLINKS)
PDF_FILES = $(patsubst %.adoc,%.pdf,$(ASCIIDOC)) $(patsubst %.xml,%.pdf,$(VTY_REFERENCE))
OSMO_REPOSITORY ?= osmo-gsm-manuals
# Prefix (Makefile.am sets this to configure's --prefix when including)
prefix ?= /usr/local
$(SYMLINKS):
ln -s $(OSMO_GSM_MANUALS_DIR)/$@ $@
@ -25,3 +31,23 @@ publish: all
mkdir -p out
cp *.pdf out
rsync -avz -e "$(SSH_COMMAND)" ./out/ docs@rita.osmocom.org:web-files/latest/
# Install and uninstall targets
# Notes about OSMO_GSM_MANUALS_NO_INSTALL:
# - osmo-gsm-manuals.git's tests/Makefile.am sets this, so the test pdfs will not
# get installed
# - installing manuals by default is fine, because Osmocom projects won't include
# the whole Makefile.common.inc unless --enable-manuals is passed to configure.
install: $(PDF_FILES)
if [ "$(OSMO_GSM_MANUALS_NO_INSTALL)" != "1" ]; then \
for i in $(PDF_FILES); do \
install -vDm644 "$$i" "$(DESTDIR)$(prefix)/share/doc/$(OSMO_REPOSITORY)-doc/$$i" || exit 1; \
done; \
fi
uninstall:
if [ "$(OSMO_GSM_MANUALS_NO_INSTALL)" != "1" ]; then \
for i in $(PDF_FILES); do \
rm -v "$(DESTDIR)$(prefix)/share/doc/$(OSMO_REPOSITORY)-doc/$$i"; \
done; \
fi

View File

@ -3,6 +3,9 @@ EXTRA_DIST = test-usermanual-docinfo.xml \
test-vty-reference.xml \
vty
# Do not install any of the test pdfs
OSMO_GSM_MANUALS_NO_INSTALL = 1
# Generate adoc file that includes all chapters
ASCIIDOC = test-usermanual.adoc
ASCIIDOC_DEPS =