\documentclass{book}

\usepackage[colorlinks=true]{hyperref}
\usepackage{color}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[strings]{underscore}
\usepackage{textcomp}
\usepackage{ocamldoc}

\newcommand{\docitem}[2]{\input{#2}}
\begin{document}
\chapter{Stdlib}
\docitem{libref}{Stdlib.tex}
\input{stdlib_input}
\docitem{libref}{Ocaml_operators.tex}
\chapter{Dynlink}
\docitem{libref}{Dynlink.tex}
\chapter{Str}
\docitem{libref}{Str.tex}
\chapter{Thread}
\docitem{libref}{Condition.tex}
\docitem{libref}{Event.tex}
\docitem{libref}{Mutex.tex}
\docitem{libref}{Thread.tex}
\docitem{libref}{ThreadUnix.tex}
\docitem{libref}{Semaphore.tex}
\chapter{Unix}
\docitem{libref}{UnixLabels.tex}
\docitem{libref}{Unix.tex}
\chapter{Compilerlibs}
\docitem{compilerlibref}{Compiler_libs.tex}
\input{compilerlibs_input.tex}
\end{document}
