[2225] | 1 | #!/bin/bash |
---|
[1046] | 2 | #--------------------------------------------------------------------------------# |
---|
[2696] | 3 | # This file is part of the PALM model system. |
---|
[1046] | 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 |
---|
[1046] | 17 | #--------------------------------------------------------------------------------# |
---|
| 18 | # |
---|
| 19 | # Current revisions: |
---|
| 20 | # ----------------- |
---|
[2226] | 21 | # |
---|
[2716] | 22 | # |
---|
[1046] | 23 | # Former revisions: |
---|
| 24 | # ----------------- |
---|
| 25 | # $Id: palm_simple_install 2716 2017-12-29 16:35:59Z kanani $ |
---|
[2716] | 26 | # Corrected "Former revisions" section |
---|
[1047] | 27 | # |
---|
[2716] | 28 | # 2696 2017-12-14 17:12:51Z kanani |
---|
| 29 | # Change in file header (GPL part) |
---|
| 30 | # |
---|
[2226] | 31 | # 2225 2017-05-16 11:36:20Z raasch |
---|
| 32 | # shell changed to bash |
---|
| 33 | # |
---|
[2716] | 34 | # 1310 2014-03-14 08:01:56Z raasch |
---|
| 35 | # update GPL copyright |
---|
| 36 | # |
---|
[1047] | 37 | # 1046 2012-11-09 14:38:45Z maronga |
---|
| 38 | # code put under GPL (PALM 3.9) |
---|
| 39 | # |
---|
[421] | 40 | # palm_simple_install - a script for simple installation and compilation of |
---|
| 41 | # the palm code without using mbuild |
---|
| 42 | # This script creates (from the working copy of the palm repository) |
---|
| 43 | # a subdirectory MAKE_DEPOSITORY_simple which contains a copy of the |
---|
| 44 | # palm source code and a modified makefile which loads required compiler |
---|
| 45 | # and preprocessor settings via "include MAKE.inc" |
---|
| 46 | |
---|
| 47 | # Options: -i <include file> |
---|
| 48 | # one of the include files in ~/palm/current_version/trunk/INSTALL |
---|
| 49 | |
---|
| 50 | # Last changes: |
---|
| 51 | # 25/01/10 - Siggi - Generating the first version |
---|
[515] | 52 | # 18/03/10 - Siggi - switch to palm/current_version removed: working |
---|
| 53 | # copy can be in any directory |
---|
[421] | 54 | |
---|
| 55 | |
---|
| 56 | # Variable declarations + default values |
---|
| 57 | include_file=unknown |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | # Read shellscript options |
---|
| 61 | while getopts :i: option |
---|
| 62 | do |
---|
| 63 | case $option in |
---|
| 64 | (i) include_file=$OPTARG;; |
---|
| 65 | (\?) printf "\n +++ unknown option $OPTARG \n" |
---|
| 66 | printf "\n allowed option are -d, -f, -l, -s \n" |
---|
| 67 | exit;; |
---|
| 68 | esac |
---|
| 69 | done |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | |
---|
| 73 | # Check, if include file exists |
---|
| 74 | if [[ ! -f trunk/INSTALL/$include_file ]] |
---|
| 75 | then |
---|
| 76 | echo "+++ ERROR: include file" |
---|
| 77 | echo " \"trunk/INSTALL/$include_file\"" |
---|
| 78 | echo " not found" |
---|
| 79 | exit |
---|
| 80 | fi |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | # Create the make depository |
---|
| 84 | if [[ ! -d MAKE_DEPOSITORY_simple ]] |
---|
| 85 | then |
---|
| 86 | mkdir MAKE_DEPOSITORY_simple |
---|
| 87 | else |
---|
| 88 | rm MAKE_DEPOSITORY_simple/* |
---|
| 89 | fi |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | # Copy makefile and all source code files to make depository |
---|
| 93 | cp trunk/SOURCE/Makefile MAKE_DEPOSITORY_simple/Makefile_old |
---|
| 94 | cp trunk/INSTALL/$include_file MAKE_DEPOSITORY_simple/MAKE.inc |
---|
| 95 | cp trunk/SOURCE/*.f90 MAKE_DEPOSITORY_simple |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | # Replace comment in makefile by include statement |
---|
| 99 | sed 's/#to_be_replaced_by_include/include MAKE.inc/g' MAKE_DEPOSITORY_simple/Makefile_old > MAKE_DEPOSITORY_simple/Makefile |
---|
| 100 | rm MAKE_DEPOSITORY_simple/Makefile_old |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | # Create directory for input files |
---|
| 104 | if [[ ! -d JOBS/example_cbl/INPUT ]] |
---|
| 105 | then |
---|
| 106 | mkdir -p JOBS/example_cbl/INPUT |
---|
| 107 | cp trunk/INSTALL/example_cbl_p3d JOBS/example_cbl/INPUT |
---|
| 108 | fi |
---|