From 729e9a74041917c62f6ae9067da6f197ba0430e7 Mon Sep 17 00:00:00 2001
From: Oliver Bock <oliver.bock@aei.mpg.de>
Date: Fri, 11 Jul 2008 15:28:44 +0200
Subject: [PATCH] Added doc target to build script

* Invokes doxygen
* Copies required images (finally!)
---
 build.sh            | 20 +++++++++++++++++---
 src/doxygen_index.h |  5 +++++
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/build.sh b/build.sh
index c3ee49f..39eeb10 100755
--- a/build.sh
+++ b/build.sh
@@ -492,6 +492,7 @@ print_usage()
 	echo "  --linux"
 	echo "  --mac"
 	echo "  --win32"
+	echo "  --doc"
 	echo "*************************"
 
 	echo "Wrong usage. Stopping!" >> $LOGFILE
@@ -505,6 +506,7 @@ print_usage()
 TARGET_LINUX=1
 TARGET_MAC=2
 TARGET_WIN32=3
+TARGET_DOC=4
 
 echo "************************************" | tee -a $LOGFILE
 echo "Starting new build!" | tee -a $LOGFILE
@@ -534,6 +536,10 @@ case "$1" in
 		check_last_build "$1" || failure
 		echo "Building win32 version:" | tee -a $LOGFILE
 		;;
+	"--doc")
+		TARGET=$TARGET_DOC
+		echo "Building documentation..." | tee -a $LOGFILE
+		;;
 	"--distclean")
 		distclean || failure
 		exit 0
@@ -552,19 +558,27 @@ esac
 
 # here we go...
 
-check_prerequisites || failure
-prepare_generic || failure
-
 case $TARGET in
 	$TARGET_LINUX)
+		check_prerequisites || failure
+		prepare_generic || failure
 		build_linux || failure
 		;;
 	$TARGET_MAC)
+		check_prerequisites || failure
+		prepare_generic || failure
 		build_mac || failure
 		;;
 	$TARGET_WIN32)
+		check_prerequisites || failure
+		prepare_generic || failure
 		build_win32 || failure
 		;;
+	$TARGET_DOC)
+		doxygen Doxyfile >> $LOGFILE 2>&1 || failure
+		cp -f $ROOT/doc/default/*.png $ROOT/doc/html >> $LOGFILE 2>&1 || failure
+		cp -f $ROOT/doc/default/*.gif $ROOT/doc/html >> $LOGFILE 2>&1 || failure
+		;;
 	*)
 		# should be unreachable
 		print_usage
diff --git a/src/doxygen_index.h b/src/doxygen_index.h
index 728158e..c91b0ee 100644
--- a/src/doxygen_index.h
+++ b/src/doxygen_index.h
@@ -192,6 +192,7 @@
  * - ar
  * - lex (i.e. flex)
  * - yacc (i.e. bison)
+ * - doxygen (optional)
  *
  * \subsubsection sec_build_usage Usage
  *
@@ -201,6 +202,10 @@
  * - Linux build: \code build.sh --linux \endcode
  * - Mac OS X build: \code build.sh --mac \endcode
  * - Windows build (uses MinGW cross-compile with Linux as build system!): \code build.sh --win32 \endcode
+ *
+ * Additional tools are provided as follows:
+ *
+ * - Build this documentation (requires doxygen): \code build.sh --doc \endcode
  * - Purge build tree: \code build.sh --distclean \endcode
  *
  * \section cha_license The License
-- 
GitLab