[1714] | 1 | #!/bin/bash |
---|
| 2 | #--------------------------------------------------------------------------------# |
---|
[2696] | 3 | # This file is part of the PALM model system. |
---|
[1714] | 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 | # |
---|
[2696] | 16 | # Copyright 1997-2017 Leibniz Universitaet Hannover |
---|
[1714] | 17 | #--------------------------------------------------------------------------------# |
---|
| 18 | # |
---|
| 19 | # Current revisions: |
---|
| 20 | # ------------------ |
---|
| 21 | # |
---|
[1758] | 22 | # |
---|
[1714] | 23 | # Former revisions: |
---|
| 24 | # ----------------- |
---|
| 25 | # $Id: $ |
---|
| 26 | # |
---|
[1758] | 27 | # |
---|
| 28 | # Initial revision |
---|
| 29 | # |
---|
[1714] | 30 | #--------------------------------------------------------------------------------# |
---|
| 31 | # generate_documentation - script for generating the PALM code documentation |
---|
| 32 | #--------------------------------------------------------------------------------# |
---|
| 33 | |
---|
| 34 | echo "Generating PALM source code documentation..." |
---|
| 35 | |
---|
| 36 | # Checking if the environment variable PALM_BIN is set. |
---|
| 37 | if [[ -z $PALM_BIN ]]; then |
---|
| 38 | echo "PALM_BIN is not set." |
---|
| 39 | exit 1 |
---|
| 40 | fi |
---|
| 41 | |
---|
[1715] | 42 | doc_dir=$PALM_BIN/../../documentation |
---|
| 43 | |
---|
[1714] | 44 | # Checking for doxygen |
---|
| 45 | if type -t doxygen; then |
---|
| 46 | |
---|
| 47 | # Removing old documentation |
---|
[1715] | 48 | if [[ -d $doc_dir ]];then |
---|
[1714] | 49 | echo "Remove old documentation" |
---|
[1715] | 50 | rm -r $doc_dir |
---|
[1714] | 51 | fi |
---|
| 52 | # Generating HTML documentation |
---|
| 53 | echo "found doxygen. Continuing..." |
---|
| 54 | cd $PALM_BIN/../DOC |
---|
| 55 | doxygen palm2doxygen.config |
---|
| 56 | if [[ $? -ne 0 ]];then |
---|
| 57 | echo "doxygen detected an error." |
---|
| 58 | exit 1 |
---|
| 59 | fi |
---|
[1715] | 60 | cd $doc_dir |
---|
| 61 | doc_dir=$(pwd) |
---|
[1714] | 62 | ln -s $(pwd)/html/index.html PALM_doc.html |
---|
| 63 | echo "HTML source code documentation generated." |
---|
| 64 | |
---|
| 65 | # Checking for pdflatex |
---|
| 66 | if type -t pdflatex; then |
---|
| 67 | |
---|
| 68 | # Generating PDF documentation |
---|
[1715] | 69 | cd $doc_dir/latex |
---|
[1714] | 70 | make pdf |
---|
[1715] | 71 | cd $doc_dir |
---|
[1714] | 72 | ln -s $(pwd)/latex/refman.pdf PALM_doc.pdf |
---|
| 73 | echo "PDF source code documentation generated." |
---|
| 74 | |
---|
| 75 | else |
---|
| 76 | echo "ERROR: pdflatex not found." |
---|
| 77 | echo "Skipping PDF documentation generation. Terminating!" |
---|
| 78 | exit 1 |
---|
| 79 | fi |
---|
| 80 | else |
---|
| 81 | echo "ERROR: doxygen not found." |
---|
| 82 | echo "Skipping PALM documentation generation. Terminating!" |
---|
| 83 | exit 1 |
---|
| 84 | fi |
---|
| 85 | |
---|
[1715] | 86 | echo "The PALM source code documentation is located in: $doc_dir" |
---|
| 87 | echo "Done." |
---|