1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> 4<title>Making AutoIndex optional</title> 5<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> 7<link rel="home" href="../../../index.html" title="Boost.AutoIndex"> 8<link rel="up" href="../configure.html" title="Step 2: Configure Boost.Build jamfile to use AutoIndex"> 9<link rel="prev" href="options.html" title="Available Indexing Options"> 10<link rel="next" href="../add_indexes.html" title="Step 3: Add indexes to your documentation"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="options.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configure.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../add_indexes.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h4 class="title"> 27<a name="boost_autoindex.tut.configure.optional"></a><a class="link" href="optional.html" title="Making AutoIndex optional">Making AutoIndex 28 optional</a> 29</h4></div></div></div> 30<p> 31 It is considerate to make the <span class="bold"><strong>use of auto-index optional</strong></span> 32 in Boost.Build, to allow users who do not have AutoIndex installed to still 33 be able to build your documentation. 34 </p> 35<p> 36 This also very convenient while you are refining your documentation, to 37 allow you to decide to build indexes, or not: building indexes can take 38 long time, if you are just correcting typos, you won't want to wait while 39 you keep rebuilding the index! 40 </p> 41<p> 42 One method of setting up optional AutoIndex support is to place all AutoIndex 43 configuration in a the body of a bjam if statement: 44 </p> 45<pre class="programlisting">if --enable-index in [ modules.peek : ARGV ] 46 { 47 ECHO "Building the docs with automatic index generation enabled." ; 48 49 using auto-index ; 50 project : requirements 51 <auto-index>on 52 <auto-index-script>index.idx 53 54 ... other AutoIndex options here... 55 56 # And tell Quickbook that it should enable indexing. 57 <quickbook-define>enable_index 58 ; 59 } 60 else 61 { 62 ECHO "Building the my_library docs with automatic index generation disabled. To get an Index, try building with --enable-index." ; 63 } 64</pre> 65<p> 66 You will also need to add a conditional statement at the end of your Quickbook 67 file, so that the index(es) is/are only added after the last section if 68 indexing is enabled. 69 </p> 70<pre class="programlisting">[? enable_index 71''' 72 <index/> 73''' 74] 75</pre> 76<p> 77 To use this jamfile, you need to cd to your docs folder, for example: 78 </p> 79<pre class="programlisting"><span class="identifier">cd</span> <span class="special">\</span><span class="identifier">boost</span><span class="special">-</span><span class="identifier">sandbox</span><span class="special">\</span><span class="identifier">guild</span><span class="special">\</span><span class="identifier">mylibrary</span><span class="special">\</span><span class="identifier">libs</span><span class="special">\</span><span class="identifier">mylibrary</span><span class="special">\</span><span class="identifier">doc</span> 80</pre> 81<p> 82 and then run <code class="computeroutput"><span class="identifier">bjam</span></code> to build 83 the docs without index, for example: 84 </p> 85<pre class="programlisting"><span class="identifier">bjam</span> <span class="special">-</span><span class="identifier">a</span> <span class="identifier">html</span> <span class="special">></span> <span class="identifier">mylibrary_html</span><span class="special">.</span><span class="identifier">log</span> 86</pre> 87<p> 88 or with index(es) 89 </p> 90<pre class="programlisting"><span class="identifier">bjam</span> <span class="special">-</span><span class="identifier">a</span> <span class="identifier">html</span> <span class="special">--</span><span class="identifier">enable</span><span class="special">-</span><span class="identifier">index</span> <span class="special">></span> <span class="identifier">mylibrary_html_index</span><span class="special">.</span><span class="identifier">log</span> 91</pre> 92</div> 93<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 94<td align="left"></td> 95<td align="right"><div class="copyright-footer">Copyright © 2008, 2011 John Maddock<p> 96 Distributed under the Boost Software License, Version 1.0. (See accompanying 97 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 98 </p> 99</div></td> 100</tr></table> 101<hr> 102<div class="spirit-nav"> 103<a accesskey="p" href="options.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configure.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../add_indexes.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 104</div> 105</body> 106</html> 107