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