source: palm/trunk/LIB/rrtmg/install_rrtmg @ 1585

Last change on this file since 1585 was 1585, checked in by maronga, 10 years ago

Added support for RRTMG radiation code

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 6.5 KB
RevLine 
[1585]1#!/bin/ksh
2
3# install_rrtmg - install script for creating a RRTMG library
4
5#--------------------------------------------------------------------------------#
6# This file is part of PALM.
7#
8# PALM is free software: you can redistribute it and/or modify it under the terms
9# of the GNU General Public License as published by the Free Software Foundation,
10# either version 3 of the License, or (at your option) any later version.
11#
12# PALM is distributed in the hope that it will be useful, but WITHOUT ANY
13# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along with
17# PALM. If not, see <http://www.gnu.org/licenses/>.
18#
19# Copyright 1997-2015  Leibniz Universitaet Hannover
20#--------------------------------------------------------------------------------#
21#
22# Current revisions:
23# ------------------
24# Initial revision
25#
26# Former revisions:
27# -----------------
28# $Id: install_rrtmg 1585 2015-04-30 07:05:52Z maronga $
29#
30#--------------------------------------------------------------------------------#
31# install_rrtmg - install script for creating a RRTMG library
32#--------------------------------------------------------------------------------#
33
34# the following variables must be modified for the local system according to
35# .mrun.config
36#
37# Example 1 (lcmuk):
38# compiler_name="mpif90"
39# fopts="-fltconsistency -O3 -cpp -r8 -nbs -convert little_endian -I /muksoft/packages/netcdf/4_intel/include"
40# fopts_trace="-fpe0 -C -check nooutput_conversion -debug -traceback -g -w -xT -O0 -ftz -fno-alias -no-prec-div -no-prec-sqrt -ip -nbs -convert little_endian -diag-disable 8290,8291 -I /muksoft/packages/netcdf/4_intel/include"
41#
42# Example 2 (lccrayh):
43# compiler_name="ftn"
44# fopts="-em -s real64 -O3 -hnoomp -hfp3 -hdynamic"
45#
46#
47
48 compiler_name="mpif90"
49 fopts="-fltconsistency -O3 -cpp -r8 -nbs -convert little_endian -I /muksoft/packages/netcdf/4_intel/include"
50 fopts_trace="-fpe0 -C -check nooutput_conversion -debug -traceback -g -w -xT -O0 -ftz -fno-alias -no-prec-div -no-prec-sqrt -ip -nbs -convert little_endian -diag-disable 8290,8291 -I /muksoft/packages/netcdf/4_intel/include"
51 install_path="$HOME/palm/rrtmg"
52 compile_static=true
53 compile_shared=true
54 compile_static_debug=false
55 compile_shared_debug=false
56
57 while  getopts  p: option
58 do
59   case  $option  in
60       (p)   install_path=$OPTARG;;
61 
62       (\?)  printf "\n  +++ unknown option $OPTARG \n"
63             printf "\n  --> type \"$0 ?\" for available options \n"
64             locat=parameter;exit;;
65   esac
66 done
67
68 (( to_shift = $OPTIND - 1 ))
69 shift $to_shift
70
71    # PRINT SHORT DESCRIPTION OF OPTIONS
72 if [[ "$1" = "?" ]]
73 then
74   (printf "\n  *** rrtmg_install can be called as follows:\n"
75    printf "\n      rrtmg_install -p.\n"
76    printf "\n      Description of available options:\n"
77    printf "\n      Option  Description                              Default-Value"
78    printf "\n        -p    installation path                                   ./"
79
80    printf "\n "
81    printf "\n      Possible values of positional parameter <modus>:"
82    printf "\n        \"?\"       -  this outline \n\n") | more
83    exit
84 elif [[ "$1" != "" ]]
85 then
86    printf "\n  +++ positional parameter $1 unknown \n"
87    locat=parameter; exit
88 fi
89
90 prog="librrtmg"
91 version="1.0"
92
93
94# 1 static
95
96 if [[ $compile_static = true ]]
97 then
98    printf "\n      Start compiling static library $prog... (make)\n\n"
99    mkdir -p static/lib
100    mkdir -p static/include
101    make -f Makefile_static F90=$compiler_name  PROG=$prog F90FLAGS="$fopts"
102    cp $prog.a  static/lib
103    cp *.mod    static/include
104    make -f Makefile_static clean
105    mkdir -p $install_path/static/lib
106    mkdir -p $install_path/static/include
107    cp static/lib/$prog.a $install_path/static/lib
108    cp static/include/*.mod $install_path/static/include/
109    rm -rf static
110    printf "\n      finished.\n"
111 fi
112
113# 2 static debug
114 if [[ $compile_static_debug = true ]]
115 then
116    printf "\n      Start compiling static debug library $prog... (make)\n\n"
117    mkdir -p static_trace/lib
118    mkdir -p static_trace/include
119    make -f Makefile_static F90=$compiler_name  PROG=$prog F90FLAGS="$fopts_trace"
120    cp $prog.a  static_trace/lib
121    cp *.mod    static_trace/include
122    make -f Makefile_static clean
123    mkdir -p $install_path/static_trace/lib
124    mkdir -p $install_path/static_trace/include
125    cp static_trace/lib/$prog.a $install_path/static_trace/lib
126    cp static_trace/include/*.mod $install_path/static_trace/include/
127    rm -rf static_trace
128    printf "\n      finished.\n"
129 fi
130
131# 3 shared
132 if [[ $compile_shared = true ]]
133 then
134    printf "\n      Start compiling shared (dynamic) library $prog... (make)\n\n"
135    mkdir -p shared/lib
136    mkdir -p shared/include
137    make -f Makefile F90=$compiler_name  PROG=$prog F90FLAGS="$fopts"
138    cp $prog.so shared/lib/$prog.so.$version
139    cp *.mod    shared/include/
140    make -f Makefile clean
141    mkdir -p $install_path/shared/lib
142    mkdir -p $install_path/shared/include
143    cp shared/lib/$prog.so.$version $install_path/shared/lib
144    cp shared/include/*.mod $install_path/shared/include/
145    rm $install_path/shared/lib/$prog.so.$version $install_path/shared/lib/$prog.so.1
146    ln -s $install_path/shared/lib/$prog.so.$version $install_path/shared/lib/$prog.so.1
147    ln -s $install_path/shared/lib/$prog.so.1 $install_path/shared/lib/$prog.so
148    rm -rf shared
149    printf "\n      finished.\n"
150 fi
151
152# 4 shared debug
153 if [[ $compile_static_debug = true ]]
154 then
155    printf "\n      Start compiling shared debug library $prog... (make)\n\n"
156    mkdir -p shared_trace/lib
157    mkdir -p shared_trace/include
158    make -f Makefile F90=$compiler_name  PROG=$prog F90FLAGS="$fopts_trace"
159    cp $prog.so shared_trace/lib/$prog.so.$version
160    cp *.mod    shared_trace/include/
161    make -f Makefile clean
162    mkdir -p $install_path/shared_trace/lib
163    mkdir -p $install_path/shared_trace/include
164    cp shared_trace/lib/$prog.so.$version $install_path/shared_trace/lib
165    cp shared_trace/include/*.mod $install_path/shared_trace/include/
166    rm $install_path/shared_trace/lib/$prog.so.$version $install_path/shared_trace/lib/$prog.so.1
167    ln -s $install_path/shared_trace/lib/$prog.so.$version $install_path/shared_trace/lib/$prog.so.1
168    ln -s $install_path/shared_trace/lib/$prog.so.1 $install_path/shared_trace/lib/$prog.so
169    rm -rf shared_trace
170    printf "\n      finished.\n"
171 fi
172
173 printf "\n      Libraries $prog are installed in \"$install_path\".\n\n" 
174 printf "\n\n  *** all actions complete."
175 
Note: See TracBrowser for help on using the repository browser.