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

Last change on this file since 1586 was 1586, checked in by maronga, 9 years ago

last commit documented

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 6.5 KB
Line 
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#
25#
26# Former revisions:
27# -----------------
28# $Id: install_rrtmg 1586 2015-04-30 07:11:33Z maronga $
29#
30# 1585 2015-04-30 07:05:52Z maronga
31# Initial revision
32#
33#--------------------------------------------------------------------------------#
34# install_rrtmg - install script for creating a RRTMG library
35#--------------------------------------------------------------------------------#
36
37# the following variables must be modified for the local system according to
38# .mrun.config
39#
40# Example 1 (lcmuk):
41# compiler_name="mpif90"
42# fopts="-fltconsistency -O3 -cpp -r8 -nbs -convert little_endian -I /muksoft/packages/netcdf/4_intel/include"
43# 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"
44#
45# Example 2 (lccrayh):
46# compiler_name="ftn"
47# fopts="-em -s real64 -O3 -hnoomp -hfp3 -hdynamic"
48#
49#
50
51 compiler_name="mpif90"
52 fopts="-fltconsistency -O3 -cpp -r8 -nbs -convert little_endian -I /muksoft/packages/netcdf/4_intel/include"
53 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"
54 install_path="$HOME/palm/rrtmg"
55 compile_static=true
56 compile_shared=true
57 compile_static_debug=false
58 compile_shared_debug=false
59
60 while  getopts  p: option
61 do
62   case  $option  in
63       (p)   install_path=$OPTARG;;
64 
65       (\?)  printf "\n  +++ unknown option $OPTARG \n"
66             printf "\n  --> type \"$0 ?\" for available options \n"
67             locat=parameter;exit;;
68   esac
69 done
70
71 (( to_shift = $OPTIND - 1 ))
72 shift $to_shift
73
74    # PRINT SHORT DESCRIPTION OF OPTIONS
75 if [[ "$1" = "?" ]]
76 then
77   (printf "\n  *** rrtmg_install can be called as follows:\n"
78    printf "\n      rrtmg_install -p.\n"
79    printf "\n      Description of available options:\n"
80    printf "\n      Option  Description                              Default-Value"
81    printf "\n        -p    installation path                                   ./"
82
83    printf "\n "
84    printf "\n      Possible values of positional parameter <modus>:"
85    printf "\n        \"?\"       -  this outline \n\n") | more
86    exit
87 elif [[ "$1" != "" ]]
88 then
89    printf "\n  +++ positional parameter $1 unknown \n"
90    locat=parameter; exit
91 fi
92
93 prog="librrtmg"
94 version="1.0"
95
96
97# 1 static
98
99 if [[ $compile_static = true ]]
100 then
101    printf "\n      Start compiling static library $prog... (make)\n\n"
102    mkdir -p static/lib
103    mkdir -p static/include
104    make -f Makefile_static F90=$compiler_name  PROG=$prog F90FLAGS="$fopts"
105    cp $prog.a  static/lib
106    cp *.mod    static/include
107    make -f Makefile_static clean
108    mkdir -p $install_path/static/lib
109    mkdir -p $install_path/static/include
110    cp static/lib/$prog.a $install_path/static/lib
111    cp static/include/*.mod $install_path/static/include/
112    rm -rf static
113    printf "\n      finished.\n"
114 fi
115
116# 2 static debug
117 if [[ $compile_static_debug = true ]]
118 then
119    printf "\n      Start compiling static debug library $prog... (make)\n\n"
120    mkdir -p static_trace/lib
121    mkdir -p static_trace/include
122    make -f Makefile_static F90=$compiler_name  PROG=$prog F90FLAGS="$fopts_trace"
123    cp $prog.a  static_trace/lib
124    cp *.mod    static_trace/include
125    make -f Makefile_static clean
126    mkdir -p $install_path/static_trace/lib
127    mkdir -p $install_path/static_trace/include
128    cp static_trace/lib/$prog.a $install_path/static_trace/lib
129    cp static_trace/include/*.mod $install_path/static_trace/include/
130    rm -rf static_trace
131    printf "\n      finished.\n"
132 fi
133
134# 3 shared
135 if [[ $compile_shared = true ]]
136 then
137    printf "\n      Start compiling shared (dynamic) library $prog... (make)\n\n"
138    mkdir -p shared/lib
139    mkdir -p shared/include
140    make -f Makefile F90=$compiler_name  PROG=$prog F90FLAGS="$fopts"
141    cp $prog.so shared/lib/$prog.so.$version
142    cp *.mod    shared/include/
143    make -f Makefile clean
144    mkdir -p $install_path/shared/lib
145    mkdir -p $install_path/shared/include
146    cp shared/lib/$prog.so.$version $install_path/shared/lib
147    cp shared/include/*.mod $install_path/shared/include/
148    rm $install_path/shared/lib/$prog.so.$version $install_path/shared/lib/$prog.so.1
149    ln -s $install_path/shared/lib/$prog.so.$version $install_path/shared/lib/$prog.so.1
150    ln -s $install_path/shared/lib/$prog.so.1 $install_path/shared/lib/$prog.so
151    rm -rf shared
152    printf "\n      finished.\n"
153 fi
154
155# 4 shared debug
156 if [[ $compile_static_debug = true ]]
157 then
158    printf "\n      Start compiling shared debug library $prog... (make)\n\n"
159    mkdir -p shared_trace/lib
160    mkdir -p shared_trace/include
161    make -f Makefile F90=$compiler_name  PROG=$prog F90FLAGS="$fopts_trace"
162    cp $prog.so shared_trace/lib/$prog.so.$version
163    cp *.mod    shared_trace/include/
164    make -f Makefile clean
165    mkdir -p $install_path/shared_trace/lib
166    mkdir -p $install_path/shared_trace/include
167    cp shared_trace/lib/$prog.so.$version $install_path/shared_trace/lib
168    cp shared_trace/include/*.mod $install_path/shared_trace/include/
169    rm $install_path/shared_trace/lib/$prog.so.$version $install_path/shared_trace/lib/$prog.so.1
170    ln -s $install_path/shared_trace/lib/$prog.so.$version $install_path/shared_trace/lib/$prog.so.1
171    ln -s $install_path/shared_trace/lib/$prog.so.1 $install_path/shared_trace/lib/$prog.so
172    rm -rf shared_trace
173    printf "\n      finished.\n"
174 fi
175
176 printf "\n      Libraries $prog are installed in \"$install_path\".\n\n" 
177 printf "\n\n  *** all actions complete."
178 
Note: See TracBrowser for help on using the repository browser.