Skip to content
Browse files

Install built documentation during 'make install'

Previously you had to pick from the build directory manually.
  • Loading branch information...
1 parent cb38a3c commit 93cdb01a0f5d02503d71065d5ee9a59171adf584 @dottedmag dottedmag committed Jun 21, 2012
View
38 configure.ac
@@ -12,12 +12,19 @@ AC_INIT
AC_CONFIG_SRCDIR([src/cf-promises.c])
AC_CANONICAL_TARGET
+dnl
+dnl This program needs to be checked early, as MAKEINFO variable is expanded in
+dnl AM_INIT_AUTOMAKE.
+dnl
+AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo)
+
define([revision], esyscmd([sh -c "(git rev-list -1 --abbrev-commit HEAD || echo unknown) | tr -d '\n'" 2>/dev/null]))dnl
dnl
dnl The version in the next line is the only one to set
dnl
+_AM_SET_OPTION([tar-ustar])
AM_INIT_AUTOMAKE(cfengine, 3.4.0a1.revision)
AM_MAINTAINER_MODE([enable])
@@ -79,8 +86,6 @@ AC_CONFIG_LIBOBJ_DIR(pub)
AC_FUNC_GETLOADAVG
AC_PATH_PROG(GETCONF, getconf, false, $PATH:$prefix/bin:/usr/bin:/usr/local/bin:/sw/bin)
-AM_MISSING_PROG(TEXI2PDF, texi2pdf)
-
AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = "xyes")
#
@@ -833,6 +838,33 @@ if test "x$use_coverage" = "xyes"; then
LDFLAGS="$LDFLAGS -lgcov"
fi
+dnl
+dnl Documentation generation
+dnl
+
+AC_ARG_ENABLE(docs, AC_HELP_STRING([--enable-docs=html|pdf|all],
+ [Enable generation of documentation in specified formats]),
+ [use_docs=$enableval], [use_docs=no])
+
+if test "x$use_docs" != "xno"; then
+ if test "x$use_docs" = "xhtml" || test "x$use_docs" = "xall"; then
+ if test "$MAKEINFO" = "${am_missing_run}makeinfo"; then
+ AC_MSG_ERROR([makeinfo tool is required for HTML documentation generation])
+ fi
+ fi
+
+ if test "x$use_docs" = "xpdf" || test "x$use_docs" = "xall"; then
+ AC_CHECK_PROG(TEXI2PDF, texi2pdf, texi2pdf)
+
+ if test -z "$TEXI2PDF"; then
+ AC_MSG_ERROR([texi2pdf tool is required for PDF documentation generation])
+ fi
+ fi
+fi
+
+AM_CONDITIONAL(HTML_DOCS, test "x$use_docs" = "xhtml" || test "x$use_docs" = "xall")
+AM_CONDITIONAL(PDF_DOCS, test "x$use_docs" = "xpdf" || test "x$use_docs" = "xall")
+
dnl ######################################################################
dnl Summarize
@@ -889,11 +921,13 @@ AC_CONFIG_FILES([Makefile
docs/manpages/Makefile
docs/reference/Makefile
docs/tools/Makefile
+ docs/tex-include/Makefile
examples/Makefile
masterfiles/Makefile
tests/Makefile
tests/acceptance/Makefile
tests/unit/Makefile
+ tests/unit/data/Makefile
tests/load/Makefile])
m4_indir(incstart[]incend, [nova/output.m4])
View
2 docs/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = manpages tools guides reference
+SUBDIRS = manpages tools guides reference tex-include
html:
$(MAKE) -C guides $(AM_MAKEFLAGS) html
View
45 docs/guides/Makefile.am
@@ -55,12 +55,16 @@ COMMON_GUIDES = \
cf3-upgrade \
cf_Quickref3
-HTML_GUIDES = $(COMMON_GUIDES)
+HTML_ONLY_GUIDES =
-PDF_GUIDES = $(COMMON_GUIDES) \
+PDF_ONLY_GUIDES = \
cf3-nova-mission-portal \
cf3-nova-2-1-supplement
+HTML_GUIDES = $(COMMON_GUIDES) $(HTML_ONLY_GUIDES)
+
+PDF_GUIDES = $(COMMON_GUIDES) $(PDF_ONLY_GUIDES)
+
.PRECIOUS: ../tools/build-solutions-guide
../tools/build-solutions-guide:
@@ -91,4 +95,41 @@ pdf: $(patsubst %,%.pdf,$(PDF_GUIDES))
all:
+GUIDEDIR=$(DESTDIR)/$(projdocdir)/guides
+
+dist-guide-%: %
+ $(INSTALL_DATA) $^ $(distdir)
+ if test -n "`$(srcdir)/../tools/extract-images $^ | sort | uniq`"; then \
+ $(INSTALL_DATA) `$(srcdir)/../tools/extract-images $^ | sort | uniq` $(distdir); \
+ fi
+
+dist-common: $(patsubst %,dist-guide-%.texinfo,$(COMMON_GUIDES))
+
+install-html: html
+ $(MKDIR_P) $(GUIDEDIR)/html
+ $(INSTALL_DATA) $(patsubst %,%.html,$(HTML_GUIDES)) $(GUIDEDIR)/html
+ $(INSTALL_DATA) `$(srcdir)/../tools/extract-images $(patsubst %,%.texinfo,$(HTML_GUIDES)) | sort | uniq` $(GUIDEDIR)/html
+
+dist-html-only:
+
+install-pdf: pdf
+ $(MKDIR_P) $(GUIDEDIR)/pdf
+ $(INSTALL_DATA) $(patsubst %,%.pdf,$(PDF_GUIDES)) $(GUIDEDIR)/pdf
+
+dist-pdf-only: $(patsubst %,dist-guide-%.texinfo,$(PDF_ONLY_GUIDES))
+
+if PDF_DOCS
+all: pdf
+install-data-hook: install-pdf
+dist-hook: dist-pdf-only dist-common
+endif
+
+if HTML_DOCS
+all: html
+install-data-hook: install-html
+dist-hook: dist-html-only dist-common
+endif
+
+EXTRA_DIST = cf3-solutions.texinfo.in CFEngineFrontPage.pdf NewLogo.pdf cfcomdoc.css
+
CLEANFILES = cf3-solutions.texinfo $(patsubst %,%.pdf,$(PDF_GUIDES)) $(patsubst %,%.html,$(HTML_GUIDES))
View
2 docs/guides/cf3-nova-2-1-supplement.texinfo
@@ -181,7 +181,7 @@ centralize updating of policy and report aggregation for convenience
however.
@sp 1
-@image{hub,10cm,,The front page,pdf}
+@image{hub,10cm,,The front page,png}
@center Figure: A policy server or `hub' is implemented in CFEngine Nova
@center as a simple solution that will scale for most sites `out of the box'.
@sp 1
View
35 docs/reference/Makefile.am
@@ -34,5 +34,38 @@ pdf: cf3-Reference.pdf
all:
-CLEANFILES = cf3-Reference.html cf3-Reference.pdf cf3-Reference.texinfo
+install: install-html install-pdf
+
+REFDIR=$(DESTDIR)/$(projdocdir)/reference
+
+dist-reference-%: %
+ $(MKDIR_P) $(distdir)/$^
+ $(INSTALL_DATA) $(subst *,\*,$(wildcard $(srcdir)/$^/*.texinfo)) $(distdir)/$^
+
+dist-reference: $(addprefix dist-reference-,bodyparts bundletypes control functions promises varcontexts vars)
+ $(INSTALL_DATA) $(filter-out cf3-Reference.texinfo,$(wildcard $(srcdir)/*.texinfo)) $(distdir)
+
+install-html: html
+ $(MKDIR_P) $(REFDIR)/html
+ $(INSTALL_DATA) cf3-Reference.html $(REFDIR)/html
+ $(INSTALL_DATA) `$(srcdir)/../tools/extract-images cf3-Reference.texinfo | sort | uniq` $(REFDIR)/html
+install-pdf: pdf
+ $(MKDIR_P) $(REFDIR)/pdf
+ $(INSTALL_DATA) cf3-Reference.pdf $(REFDIR)/pdf
+
+if PDF_DOCS
+all: pdf
+install-data-hook: install-pdf
+dist-hook: dist-reference
+endif
+
+if HTML_DOCS
+all: html
+install-data-hook: install-html
+dist-hook: dist-reference
+endif
+
+EXTRA_DIST = CFEngineFrontPage.pdf NewLogo.pdf filelogic.png generate_manual.cf
+
+CLEANFILES = cf3-Reference.html cf3-Reference.pdf cf3-Reference.texinfo
View
1 docs/tex-include/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = texinfo-altfont.tex texinfo-logo.tex texinfo.tex txi-cmbright.tex txi-helvetica.tex txi-iwona.tex
View
4 docs/tools/Makefile.am
@@ -1,2 +1,6 @@
noinst_PROGRAMS = build-solutions-guide
+
+noinst_SCRIPTS = texi2pdfclean extract-images
+
+EXTRA_DIST = texi2pdfclean extract-images
View
20 docs/tools/extract-images
@@ -0,0 +1,20 @@
+#!/bin/sh -e
+
+if [ "$#" -eq 0 ]; then
+ echo "Usage: extract-images <texinfo file>..."
+ echo
+ echo " This tool extracts all image file names referenced in Texinfo file"
+ echo " and prints them out to standard output"
+
+ exit 1
+fi
+
+# @c are comments
+# ...@image{filename,...,...,..}... -> filename.png
+# ...@image{filename,...,...,..,extension}... -> filename.extension
+
+sed -n \
+ -e 's/^@c .*//' \
+ -e 's/^.*@image{\([^,]*\),[^,]*,[^,]*,[^,]*,\([^,}]*\)}.*$/\1.\2/p' \
+ -e 's/^.*@image{\([^,]*\)[^}]*}.*$/\1.png/p' \
+ "$@"
View
2 tests/unit/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = data
+
AM_CFLAGS = $(NOVA_CFLAGS) $(CONSTELLATION_CFLAGS) $(GCC_CFLAG) -I$(srcdir)/../../src
LDADD = ../../src/libpromises.la libtest.la
View
1 tests/unit/data/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = $(wildcard *.cf)

0 comments on commit 93cdb01

Please sign in to comment.
Something went wrong with that request. Please try again.