docs: do a gtkdoc-rebase --online before 'make upload'
[platform/upstream/gst-common.git] / upload-doc.mak
1 # this snippet is to be included by both our docbook manuals
2 # and gtk-doc API references
3
4 # it adds an upload target to each of these dir's Makefiles
5
6 # each Makefile.am should define the following variables:
7 # - DOC: the base name of the documentation
8 #        (faq, manual, pwg, gstreamer, gstreamer-libs)
9 # - FORMATS: the formats in which DOC is output
10 #            (html ps pdf)
11
12 # if you want to use it, make sure your $HOME/.ssh/config file contains the
13 # correct User entry for the Host entry for the DOC_SERVER
14
15 # these variables define the location of the online docs
16 DOC_SERVER = gstreamer.freedesktop.org
17 DOC_BASE = /srv/gstreamer.freedesktop.org/www/data/doc
18 DOC_URL = $(DOC_SERVER):$(DOC_BASE)
19
20 upload: $(FORMATS)
21         @if test "x$(PACKAGE_VERSION_NANO)" = x0; then \
22             export DOCVERSION=$(VERSION); \
23         else export DOCVERSION=head; \
24         fi; \
25         export DIR=$(DOC_BASE)/gstreamer/$$DOCVERSION/$(DOC); \
26         ssh $(DOC_SERVER) mkdir -p $$DIR; \
27         if echo $(FORMATS) | grep html > /dev/null; then \
28           echo "Preparing docs for upload (rebasing cross-references) ..." ; \
29           if test x$(builddir) != x$(srcdir); then \
30             echo "make upload can only be used if srcdir == builddir"; \
31             exit 1; \
32           fi; \
33           gtkdoc-rebase --online --html-dir=$(builddir)/html ; \
34           export SRC="$$SRC html"; \
35         fi; \
36         if echo $(FORMATS) | grep ps > /dev/null; then export SRC="$$SRC $(DOC).ps"; fi; \
37         if echo $(FORMATS) | grep pdf > /dev/null; then export SRC="$$SRC $(DOC).pdf"; fi; \
38         echo Uploading $$SRC to $(DOC_SERVER):$$DIR; \
39         rsync -rv -e ssh --delete $$SRC $(DOC_SERVER):$$DIR; \
40         ssh $(DOC_SERVER) chmod -R g+w $$DIR; \
41         if echo $(FORMATS) | grep html > /dev/null; then \
42           echo "Un-preparing docs for upload (rebasing cross-references) ..." ; \
43           gtkdoc-rebase --html-dir=$(builddir)/html ; \
44         fi; \
45         echo Done