source: palm/trunk/SCRIPTS/generate_documentation @ 3712

Last change on this file since 3712 was 3197, checked in by knoop, 6 years ago

Bugfix: corrected name of file "palm2doxygen.config"

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
1#!/bin/bash
2#--------------------------------------------------------------------------------#
3# This file is part of the PALM model system.
4#
5# PALM is free software: you can redistribute it and/or modify it under the terms
6# of the GNU General Public License as published by the Free Software Foundation,
7# either version 3 of the License, or (at your option) any later version.
8#
9# PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License along with
14# PALM. If not, see <http://www.gnu.org/licenses/>.
15#
16# Copyright 1997-2018  Leibniz Universitaet Hannover
17#--------------------------------------------------------------------------------#
18#
19# Current revisions:
20# ------------------
21#
22#
23# Former revisions:
24# -----------------
25# $Id: generate_documentation 3197 2018-08-14 15:10:43Z kanani $
26# Corrected "Former revisions" section
27# svn propset keyword
28#
29#
30#
31# 2696 2017-12-14 17:12:51Z kanani
32# Change in file header (GPL part)
33#
34# 1714 knoop
35# Initial revision
36#
37#--------------------------------------------------------------------------------#
38# generate_documentation - script for generating the PALM code documentation
39#--------------------------------------------------------------------------------#
40SOURCE="${BASH_SOURCE[0]}"
41while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
42  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
43  SOURCE="$(readlink "$SOURCE")"
44  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
45done
46SCRIPT_LOCATION="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
47
48working_dir=$(readlink -f "${SCRIPT_LOCATION}/../../")
49
50echo "Generating PALM source code documentation..."
51
52
53doc_dir=$working_dir/documentation
54
55# Checking for doxygen
56if type -t doxygen; then
57
58   # Removing old documentation
59   if [[ -d $doc_dir ]];then
60      echo "Remove old documentation"
61      rm -r $doc_dir
62   fi
63   # Generating HTML documentation
64   echo "found doxygen. Continuing..."
65   cd $SCRIPT_LOCATION
66   doxygen palm2doxygen.config
67   if [[ $? -ne 0 ]];then
68      echo "doxygen detected an error."
69      exit 1
70   fi
71   cd $doc_dir
72   doc_dir=$(pwd)
73   ln -s $(pwd)/html/index.html PALM_doc.html
74   echo "HTML source code documentation generated."
75   
76   # Checking for pdflatex
77   if type -t pdflatex; then
78   
79      # Generating PDF documentation
80      cd $doc_dir/latex
81      make pdf
82      cd $doc_dir
83      ln -s $(pwd)/latex/refman.pdf PALM_doc.pdf
84      echo "PDF source code documentation generated."
85   
86   else
87      echo "ERROR: pdflatex not found."
88      echo "Skipping PDF documentation generation. Terminating!"
89      exit 1
90   fi
91else
92   echo "ERROR: doxygen not found."
93   echo "Skipping PALM documentation generation. Terminating!"
94   exit 1
95fi
96
97echo "The PALM source code documentation is located in: $doc_dir"
98echo "Done."
Note: See TracBrowser for help on using the repository browser.