upload-doc.mak 2.91 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
# this snippet is to be included by both our docbook manuals
# and gtk-doc API references

# it adds an upload target to each of these dir's Makefiles

# each Makefile.am should define the following variables:
# - DOC: the base name of the documentation
#        (faq, manual, pwg, gstreamer, gstreamer-libs)
# - FORMATS: the formats in which DOC is output
#            (html ps pdf)

12
# if you want to use it, make sure your $HOME/.ssh/config file contains the
13 14 15
# correct User entry for the Host entry for the DOC_SERVER

# these variables define the location of the online docs
16 17 18
DOC_SERVER = gstreamer.freedesktop.org
DOC_BASE = /srv/gstreamer.freedesktop.org/www/data/doc
DOC_URL = $(DOC_SERVER):$(DOC_BASE)
19 20

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