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
16DOC_SERVER = gstreamer.freedesktop.org
17DOC_BASE = /srv/gstreamer.freedesktop.org/www/data/doc
18DOC_URL = $(DOC_SERVER):$(DOC_BASE)
19
20upload: $(FORMATS)
21	@if echo $(FORMATS) | grep html > /dev/null; then \
22	  echo "Preparing docs for upload (rebasing cross-references) ..." ; \
23	  if test x$(builddir) != x$(srcdir); then \
24	    echo "make upload can only be used if srcdir == builddir"; \
25	    exit 1; \
26	  fi; \
27	  # gtkdoc-rebase sometimes gets confused, so reset everything to \
28	  # local links before rebasing to online links                   \
29	  gtkdoc-rebase --html-dir=$(builddir)/html 2>/dev/null 2>/dev/null ; \
30	  rebase=`gtkdoc-rebase --verbose --online --html-dir=$(builddir)/html` ; \
31	  echo "$$rebase" | grep -e "On-*line"; \
32	  for req in glib gobject gstreamer gstreamer-libs gst-plugins-base-libs; do \
33	    if ! ( echo "$$rebase" | grep -i -e "On-*line.*/$$req/" ); then \
34	      echo "===============================================================================" ; \
35	      echo " Could not determine online location for $$req docs. Cross-referencing will be " ; \
36	      echo " broken, so not uploading. Make sure the library's gtk-doc documentation is    " ; \
37	      echo " installed somewhere in /usr/share/gtk-doc.                                    " ; \
38	      echo "===============================================================================" ; \
39	      exit 1; \
40	    fi; \
41	  done; \
42	  export SRC="$$SRC html"; \
43	fi; \
44	if echo $(FORMATS) | grep ps > /dev/null; then export SRC="$$SRC $(DOC).ps"; fi; \
45	if echo $(FORMATS) | grep pdf > /dev/null; then export SRC="$$SRC $(DOC).pdf"; fi; \
46	\
47	# upload releases to both X.Y/ and head/ subdirectories \
48	export DIR=$(DOC_BASE)/gstreamer/$(PACKAGE_VERSION_MAJOR).$(PACKAGE_VERSION_MINOR)/$(DOC); \
49	echo Uploading $$SRC to $(DOC_SERVER):$$DIR; \
50	ssh $(DOC_SERVER) mkdir -p $$DIR; \
51	rsync -rv -e ssh --delete $$SRC $(DOC_SERVER):$$DIR; \
52	ssh $(DOC_SERVER) chmod -R g+w $$DIR; \
53	\
54	export DIR=$(DOC_BASE)/gstreamer/head/$(DOC); \
55	echo Uploading $$SRC to $(DOC_SERVER):$$DIR; \
56	ssh $(DOC_SERVER) mkdir -p $$DIR; \
57	rsync -rv -e ssh --delete $$SRC $(DOC_SERVER):$$DIR; \
58	ssh $(DOC_SERVER) chmod -R g+w $$DIR; \
59	\
60	if echo $(FORMATS) | grep html > /dev/null; then \
61	  echo "Un-preparing docs for upload (rebasing cross-references) ..." ; \
62	  gtkdoc-rebase --html-dir=$(builddir)/html ; \
63	fi; \
64	echo Done
65