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