From d94bc6e0a656189f535c5a6e65ba354d7643496b Mon Sep 17 00:00:00 2001
From: Lubomir Bucek <lubomir.bucek@eox.at>
Date: Thu, 2 Jul 2020 16:48:03 +0200
Subject: [PATCH] update makefile to sync html files and pdf with client/html

---
 README.md                         |  6 ++++--
 documentation/user-guide/Makefile | 23 +++++++++++++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index dac0b817..44153c54 100644
--- a/README.md
+++ b/README.md
@@ -219,7 +219,7 @@ docker exec -it $(docker ps -qf "name=emg-pvs_renderer") mv Emergency.sqlite /ca
 python3 -m pip install sphinx recommonmark sphinx-autobuild
 ```
 
-## Generation
+## Generate html and synchronize with client/html/user-guide
 
 ```bash
 make html
@@ -227,10 +227,12 @@ make html
 # For watched html automatic building
 make html-watch
 
-# For pdf output
+# For pdf output and sync it to client/html/
 make latexpdf
 # To shrink size of pdf
 gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dPrinted=false -q -o View-Server_-_User-Guide_small.pdf View-Server_-_User-Guide.pdf
+# make latexpdf and make html combined
+make build
 ```
 
 The documentation is generated in the respective *_build/html* directory.
diff --git a/documentation/user-guide/Makefile b/documentation/user-guide/Makefile
index 11527607..e994f10c 100644
--- a/documentation/user-guide/Makefile
+++ b/documentation/user-guide/Makefile
@@ -8,6 +8,7 @@ SPHINXBUILD   ?= sphinx-build
 SPHINXAUTOBUILD   ?= sphinx-autobuild
 SOURCEDIR     = .
 BUILDDIR      = _build
+USERGUIDE_VERSION = v1.1.0
 
 # Put it first so that "make" without argument is like "make help".
 help:
@@ -18,6 +19,28 @@ help:
 html-watch:
 	@$(SPHINXAUTOBUILD) -i "$(BUILDDIR)/*" "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS) $(O)
 
+html:
+	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+	rm -rf ../../client/html/user-guide/*
+	rsync -rpE _build/html/ ../../client/html/user-guide/
+
+latexpdf:
+	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+	gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dPrinted=false -q -o _build/latex/View-Server_-_User-Guide_small.pdf _build/latex/View-Server_-_User-Guide.pdf
+	rm -f ../../client/html/View-Server_-_User-Guide*pdf
+	rsync -rpE _build/latex/View-Server_-_User-Guide_small.pdf ../../client/html/View-Server_-_User-Guide_"$(USERGUIDE_VERSION)".pdf
+
+build:
+	# just do html and latexpdf combined
+	@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+	rm -rf ../../client/html/user-guide/*
+	rsync -rpE _build/html/ ../../client/html/user-guide/
+	@$(SPHINXBUILD) -M latexpdf "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+	gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dPrinted=false -q -o _build/latex/View-Server_-_User-Guide_small.pdf _build/latex/View-Server_-_User-Guide.pdf
+	rm -f ../../client/html/View-Server_-_User-Guide*pdf
+	rsync -rpE _build/latex/View-Server_-_User-Guide_small.pdf ../../client/html/View-Server_-_User-Guide_"$(USERGUIDE_VERSION)".pdf
+
+
 # Catch-all target: route all unknown targets to Sphinx using the new
 # "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
 %: Makefile
-- 
GitLab