Update, simplify, and clarify the doc-build chapter.

This commit is contained in:
Warren Block 2013-07-20 01:21:45 +00:00
parent 32622975a2
commit 93bfc7e929
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=42328

View file

@ -34,75 +34,41 @@
<chapter id="doc-build"> <chapter id="doc-build">
<title>The Documentation Build Process</title> <title>The Documentation Build Process</title>
<para>This chapter's main purpose is to clearly explain <para>This chapter covers organization of the
<emphasis>how the documentation build process is documentation build process
organized</emphasis>, and <emphasis>how to affect modifications and how &man.make.1; is used to control
to this process</emphasis>.</para> it.</para>
<para>After you have finished reading this chapter you
should:</para>
<itemizedlist>
<listitem>
<para>Know what you need to build the FDP documentation, in
addition to those mentioned in the
<link linkend="tools">XML tools chapter</link>.</para>
</listitem>
<listitem>
<para>Be able to read and understand the
<application>make</application> instructions that are present
in each document's <filename>Makefile</filename>s, as well as
an overview of the <filename>doc.project.mk</filename>
includes.</para>
</listitem>
<listitem>
<para>Be able to customize the build process by using
<application>make</application> variables and
<application>make</application> targets.</para>
</listitem>
</itemizedlist>
<sect1 id="doc-build-toolset"> <sect1 id="doc-build-toolset">
<title>The FreeBSD Documentation Build Toolset</title> <title>The &os; Documentation Build Toolset</title>
<para>Here are your tools. Use them every way you can.</para> <para>These are the tools used to build and install the <acronym>FDP</acronym> documentation.</para>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para>The primary build tool you will need is <para>The primary build tool is
<application>make</application>, but specifically &man.make.1;, specifically
<application>Berkeley Make</application>.</para> <application>Berkeley Make</application>.</para>
</listitem> </listitem>
<listitem> <listitem>
<para>Package building is handled by FreeBSD's <para>Package building is handled by &os;'s
<application>pkg_create</application>. If you are not using &man.pkg.create.1;.</para>
FreeBSD, you will either have to live without packages, or
compile the source yourself.</para>
</listitem> </listitem>
<listitem> <listitem>
<para><application>gzip</application> is needed to create <para>&man.gzip.1; is used to create
compressed versions of the document. compressed versions of the document.
<application>bzip2</application> compression and &man.bzip2.1; archives are also supported.
<application>zip</application> archives are also supported. &man.tar.1; is used for package
<application>tar</application> is supported, but package building.</para>
building demands it.</para>
</listitem> </listitem>
<listitem> <listitem>
<para><application>install</application> is the default method <para>&man.install.1; is used
to install the documentation. There are alternatives, to install the documentation.</para>
however.</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<note>
<para>It is unlikely you will have any trouble finding these
last two, they are mentioned for completeness only.</para>
</note>
</sect1> </sect1>
<sect1 id="doc-build-makefiles"> <sect1 id="doc-build-makefiles">
@ -111,7 +77,7 @@
Documentation Tree</title> Documentation Tree</title>
<para>There are three main types of <filename>Makefile</filename>s <para>There are three main types of <filename>Makefile</filename>s
in the FreeBSD Documentation Project tree.</para> in the &os; Documentation Project tree.</para>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
@ -150,13 +116,13 @@ COMPAT_SYMLINK = en
DOC_PREFIX?= ${.CURDIR}/.. DOC_PREFIX?= ${.CURDIR}/..
.include "${DOC_PREFIX}/share/mk/doc.project.mk"</programlisting> .include "${DOC_PREFIX}/share/mk/doc.project.mk"</programlisting>
<para>In quick summary, the first four non-empty lines define <para>The first four non-empty lines define
the <application>make</application> variables, the &man.make.1; variables
<makevar>SUBDIR</makevar>, <makevar>COMPAT_SYMLINK</makevar>, <makevar>SUBDIR</makevar>, <makevar>COMPAT_SYMLINK</makevar>,
and <makevar>DOC_PREFIX</makevar>.</para> and <makevar>DOC_PREFIX</makevar>.</para>
<para>The first <makevar>SUBDIR</makevar> statement, as well as <para>The <makevar>SUBDIR</makevar> statement and
the <makevar>COMPAT_SYMLINK</makevar> statement, shows how to <makevar>COMPAT_SYMLINK</makevar> statement show how to
assign a value to a variable, overriding any previous assign a value to a variable, overriding any previous
value.</para> value.</para>
@ -172,7 +138,7 @@ DOC_PREFIX?= ${.CURDIR}/..
<filename>Makefile</filename> thinks it is - the user can <filename>Makefile</filename> thinks it is - the user can
override this and provide the correct value.</para> override this and provide the correct value.</para>
<para>Now what does it all mean? <makevar>SUBDIR</makevar> <para>What does it all mean? <makevar>SUBDIR</makevar>
mentions which subdirectories below this one the build process mentions which subdirectories below this one the build process
should pass any work on to.</para> should pass any work on to.</para>
@ -182,14 +148,14 @@ DOC_PREFIX?= ${.CURDIR}/..
point to <filename>en_US.ISO-8859-1</filename>).</para> point to <filename>en_US.ISO-8859-1</filename>).</para>
<para><makevar>DOC_PREFIX</makevar> is the path to the root of <para><makevar>DOC_PREFIX</makevar> is the path to the root of
the FreeBSD Document Project tree. This is not always that the &os; Document Project tree. This is not always that
easy to find, and is also easily overridden, to allow for easy to find, and is also easily overridden, to allow for
flexibility. <makevar>.CURDIR</makevar> is a flexibility. <makevar>.CURDIR</makevar> is a
<application>make</application> builtin variable with the path &man.make.1; builtin variable with the path
to the current directory.</para> to the current directory.</para>
<para>The final line includes the FreeBSD Documentation <para>The final line includes the &os; Documentation
Project's project-wide <application>make</application> system Project's project-wide &man.make.1; system
file <filename>doc.project.mk</filename> which is the glue file <filename>doc.project.mk</filename> which is the glue
which converts these variables into build instructions.</para> which converts these variables into build instructions.</para>
</sect2> </sect2>
@ -197,8 +163,8 @@ DOC_PREFIX?= ${.CURDIR}/..
<sect2 id="doc-make"> <sect2 id="doc-make">
<title>Documentation <filename>Makefile</filename>s</title> <title>Documentation <filename>Makefile</filename>s</title>
<para>These <filename>Makefile</filename>s set a bunch of <para>These <filename>Makefile</filename>s set
<application>make</application> variables that describe how to &man.make.1; variables that describe how to
build the documentation contained in that directory.</para> build the documentation contained in that directory.</para>
<para>Here is an example:</para> <para>Here is an example:</para>
@ -219,10 +185,10 @@ DOC_PREFIX?= ${.CURDIR}/../../..
.include "$(DOC_PREFIX)/share/mk/docproj.docbook.mk"</programlisting> .include "$(DOC_PREFIX)/share/mk/docproj.docbook.mk"</programlisting>
<para>The <makevar>MAINTAINER</makevar> variable is a very <para>The <makevar>MAINTAINER</makevar> variable
important one. This variable provides the ability to claim allows committers to claim
ownership over a document in the FreeBSD Documentation ownership of a document in the &os; Documentation
Project, whereby you gain the responsibility for maintaining Project, and take responsibility for maintaining
it.</para> it.</para>
<para><makevar>DOC</makevar> is the name (sans the <para><makevar>DOC</makevar> is the name (sans the
@ -240,21 +206,16 @@ DOC_PREFIX?= ${.CURDIR}/../../..
default, should be non-empty if only compressed documents are default, should be non-empty if only compressed documents are
desired in the build.</para> desired in the build.</para>
<note>
<para>We covered optional variable assignments in the
<link linkend="sub-make">previous section</link>.</para>
</note>
<para>The <makevar>DOC_PREFIX</makevar> and include statements <para>The <makevar>DOC_PREFIX</makevar> and include statements
should be familiar already.</para> should be familiar already.</para>
</sect2> </sect2>
</sect1> </sect1>
<sect1 id="make-includes"> <sect1 id="make-includes">
<title>FreeBSD Documentation Project <title>&os; Documentation Project
<application>Make</application> Includes</title> <application>Make</application> Includes</title>
<para>This is best explained by inspection of the code. Here are <para>&man.make.1; includes are best explained by inspection of the code. Here are
the system include files:</para> the system include files:</para>
<itemizedlist> <itemizedlist>
@ -321,10 +282,10 @@ PRI_LANG?= en_US.ISO8859-1
default.</para> default.</para>
<note> <note>
<para><makevar>PRI_LANG</makevar> in no way affects what <para><makevar>PRI_LANG</makevar> does not affect which
documents can, or even will, be built. Its main use is documents can, or even will, be built. Its main use is
creating links to commonly referenced documents into the creating links to commonly referenced documents into the
FreeBSD documentation install root.</para> &os; documentation install root.</para>
</note> </note>
</sect3> </sect3>
@ -332,7 +293,7 @@ PRI_LANG?= en_US.ISO8859-1
<title>Conditionals</title> <title>Conditionals</title>
<para>The <literal>.if defined(DOC)</literal> line is an <para>The <literal>.if defined(DOC)</literal> line is an
example of a <application>make</application> conditional example of a &man.make.1; conditional
which, like in other programs, defines behavior if some which, like in other programs, defines behavior if some
condition is true or if it is false. condition is true or if it is false.
<literal>defined</literal> is a function which returns <literal>defined</literal> is a function which returns
@ -351,9 +312,8 @@ PRI_LANG?= en_US.ISO8859-1
<sect2> <sect2>
<title><filename>doc.subdir.mk</filename></title> <title><filename>doc.subdir.mk</filename></title>
<para>This is too long to explain by inspection, you should be <para>This file is too long to explain in detail. These
able to work it out with the knowledge gained from the notes describe the most important features.</para>
previous chapters, and a little help given here.</para>
<sect3> <sect3>
<title>Variables</title> <title>Variables</title>
@ -389,8 +349,8 @@ PRI_LANG?= en_US.ISO8859-1
<literal><replaceable>target</replaceable>: <literal><replaceable>target</replaceable>:
<replaceable>dependency1 dependency2 <replaceable>dependency1 dependency2
...</replaceable></literal> tuples, where to build ...</replaceable></literal> tuples, where to build
<literal>target</literal>, you need to build the given <literal>target</literal>, the given
dependencies first.</para> dependencies must be built first.</para>
<para>After that descriptive tuple, instructions on how to <para>After that descriptive tuple, instructions on how to
build the target may be given, if the conversion process build the target may be given, if the conversion process