Revision 41806ef4 Makefile.am

b/Makefile.am
135 135

  
136 136
BUILDTIME_DIRS = \
137 137
	$(BUILDTIME_DIR_AUTOCREATE) \
138
	doc/html
138
	doc/html \
139
	doc/man-html
139 140

  
140 141
DIRCHECK_EXCLUDE = \
141 142
	$(BUILDTIME_DIRS) \
142 143
	ganeti-[0-9]*.[0-9]*.[0-9]* \
143 144
	doc/html/_* \
145
	doc/man-html/_* \
144 146
	autom4te.cache
145 147

  
146 148
# some helper vars
......
171 173
	$(SHELL_ENV_INIT) \
172 174
	daemons/daemon-util \
173 175
	daemons/ganeti-cleaner \
176
	$(mandocrst) \
177
	doc/manpages-enabled.rst \
174 178
	$(BUILT_EXAMPLES) \
175 179
	doc/examples/bash_completion \
176 180
	doc/examples/bash_completion-debug \
......
403 407
	doc/install-quick.rst \
404 408
	doc/install.rst \
405 409
	doc/locking.rst \
410
	doc/manpages-disabled.rst \
406 411
	doc/move-instance.rst \
407 412
	doc/news.rst \
408 413
	doc/ovfconverter.rst \
......
412 417
	doc/virtual-cluster.rst \
413 418
	doc/walkthrough.rst
414 419

  
420
# Generates file names such as "doc/man-gnt-instance.rst"
421
mandocrst = $(addprefix doc/man-,$(notdir $(manrst)))
422

  
415 423
# Haskell programs to be installed in $PREFIX/bin
416 424
HS_BIN_PROGS=src/htools
417 425

  
......
580 588

  
581 589
$(RUN_IN_TEMPDIR): | stamp-directories
582 590

  
591
doc/html/index.html: ENABLE_MANPAGES =
592
doc/man-html/index.html: ENABLE_MANPAGES = 1
593
doc/man-html/index.html: doc/manpages-enabled.rst $(mandocrst)
594

  
583 595
# Note: we use here an order-only prerequisite, as the contents of
584 596
# _autoconf.py are not actually influencing the html build output: it
585 597
# has to exist in order for the sphinx module to be loaded
586 598
# successfully, but we certainly don't want the docs to be rebuilt if
587 599
# it changes
588
doc/html/index.html: $(docinput) doc/conf.py configure.ac \
589
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
600
doc/html/index.html doc/man-html/index.html: $(docinput) doc/conf.py \
601
	configure.ac $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
590 602
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
591 603
	doc/css/style.css \
592 604
	| $(BUILT_PYTHON_SOURCES)
593 605
	@test -n "$(SPHINX)" || \
594 606
	    { echo 'sphinx-build' not found during configure; exit 1; }
595
	@mkdir_p@ $(dir $@)
596
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
607
if !MANPAGES_IN_DOC
608
	if test -n '$(ENABLE_MANPAGES)'; then \
609
	  echo 'Man pages in documentation were disabled at configure time' >&2; \
610
	  exit 1; \
611
	fi
612
endif
613
	dir=$(dir $@) && \
614
	@mkdir_p@ $$dir && \
615
	PYTHONPATH=. ENABLE_MANPAGES=$(ENABLE_MANPAGES) \
616
	$(RUN_IN_TEMPDIR) bash autotools/sphinx-wrapper $(SPHINX) -q -W -b html \
597 617
	    -d . \
598 618
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
599 619
	    -D release="$(PACKAGE_VERSION)" \
600 620
	    -D graphviz_dot="$(DOT)" \
601
	    $(abs_top_builddir)/doc $(CURDIR)/doc/html
602
	rm -f doc/html/.buildinfo doc/html/objects.inv
621
	    -D enable_manpages="$(ENABLE_MANPAGES)" \
622
	    doc $(CURDIR)/$$dir && \
623
	rm -f $$dir/.buildinfo $$dir/objects.inv
603 624
	touch $@
604 625

  
605 626
doc/html: doc/html/index.html
606 627

  
628
doc/man-html: doc/man-html/index.html
629

  
607 630
doc/install-quick.rst: INSTALL
608 631
doc/news.rst: NEWS
609 632
doc/upgrade.rst: UPGRADE
......
616 639
	  cat $<; \
617 640
	} > $@
618 641

  
642
doc/manpages-enabled.rst: Makefile | $(built_base_sources)
643
	{ echo '.. This file is automatically generated, do not edit!'; \
644
	  echo ''; \
645
	  echo 'Man pages'; \
646
	  echo '========='; \
647
	  echo; \
648
	  echo '.. toctree::'; \
649
	  echo '   :maxdepth: 1'; \
650
	  echo; \
651
	  for i in $(notdir $(mandocrst)); do \
652
	    echo "   $$i"; \
653
	  done | LC_ALL=C sort; \
654
	} > $@
655

  
656
doc/man-%.rst: man/%.gen Makefile $(REPLACE_VARS_SED) | $(built_base_sources)
657
if MANPAGES_IN_DOC
658
	{ echo '.. This file is automatically updated at build time from $<.'; \
659
	  echo '.. Do not edit.'; \
660
	  echo; \
661
	  echo "$*"; \
662
	  echo '=========================================='; \
663
	  tail -n +3 $< | sed -f $(REPLACE_VARS_SED); \
664
	} > $@
665
else
666
	echo 'Man pages in documentation were disabled at configure time' >&2; \
667
	exit 1;
668
endif
669

  
619 670
# Things to build but not to install (add it to EXTRA_DIST if it should be
620 671
# distributed)
621 672
noinst_DATA = \
......
625 676
	doc/examples/bash_completion-debug \
626 677
	$(manhtml)
627 678

  
679
if MANPAGES_IN_DOC
680
noinst_DATA += doc/man-html
681
endif
682

  
628 683
gnt_scripts = \
629 684
	scripts/gnt-backup \
630 685
	scripts/gnt-cluster \
......
806 861
	autotools/convert-constants \
807 862
	autotools/docpp \
808 863
	autotools/gen-py-coverage \
864
	autotools/sphinx-wrapper \
809 865
	autotools/testrunner \
810 866
	autotools/wrong-hardcoded-paths \
811 867
	$(RUN_IN_TEMPDIR) \
......
1632 1688
	$(MAKE) $(AM_MAKEFLAGS) regen-vcs-version
1633 1689
	rm -f $(top_distdir)/vcs-version
1634 1690
	cp -p $(srcdir)/vcs-version $(top_distdir)
1691
if MANPAGES_IN_DOC
1692
	echo 'Building distribution with man pages included in documentation is' \
1693
	     'not allowed as they can contain fixed paths' >&2; \
1694
	exit 1
1695
endif
1635 1696

  
1636 1697
# a distcheck hook rule for catching revision control directories
1637 1698
distcheck-hook:

Also available in: Unified diff