File: build_library

package info (click to toggle)
emoslib 000380%2Bdfsg-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 47,712 kB
  • ctags: 11,551
  • sloc: fortran: 89,643; ansic: 24,200; makefile: 370; sh: 355
file content (237 lines) | stat: -rwxr-xr-x 5,377 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
#! /bin/sh

set -e

umask 0

#  make sure all directories exists.
for subdirs in gribex gribtables pbio bufrdc bufrtables crexdc crextables interpolation land_sea_mask examples config options
do
   if test ! -d $subdirs ; then
       echo
       echo "Tarfile is incomplete ;  $subdirs does not exist."
       echo "         Incorrect tarfile downloaded?"
       quit
   fi
done


# is the uname available ?

type uname > /dev/null 2>&1
if test $? -ne 0 ; then
    echo "install: uname not found"
    echo "You should try compilation without install script"
    quit
fi
target=`uname -s | tr '[A-Z]' '[a-z]'`

gnu=

echo

case $target in 

linux )
    target=linux
    gnu=yes
	platform=`uname -m`
	case $platform in
	x86_64 )
	    A64=A64
		;;
	ia64 )
        gnu=
	    A64=
		target=itanium
		;;
    * )
	    A64=
		;;
    esac
	    echo "Default compilers are Portland: pgf90 and pgcc."
    ;;
darwin* )
    target=darwin
    platform=`machine`
    case $platform in
    ppc970 )
        target=ppc
        A64=_G5
        ;;
    ppc* )
        target=ppc
        A64=
        ;;
    i486 )
        target=darwin
        A64=_i486
        ;;
    *64 )
        target=darwin
        A64=A64
        ;;
    * )
        target=darwin
        A64=
        ;;
    esac

       echo "Default compilers are : gfortran and gcc."
    ;;
sunos )
    target=sun4
#	platform=`uname -m`
#    if test "$platform" = "i86pc" ; then
#      target=i86pc
#    fi

    ;;
irix* )
    target=sgimips
    ;;
aix )
    target=rs6000
    ;;
osf1 )
    target=decalpha
    ;;
hp-ux )
    target=hppa
    platform=`uname -m`
    if test "$platform" = "ia64" ; then
      target=hpia64
    fi
    ;;
fujitsu* )
    target=FUJITSU
    ;;

 * )
        echo
        echo "install: products can only be installed on Linux, Solaris, Sgi"
        echo "Alpha, HP, IBM operating systems."
        echo "You should try compilation without install script"
        quit
	;;
esac

CNAME=
if test "$gnu" = "yes" ; then
       echo "Do you want to work with GNU gfortran/gcc (answer y), ifort (answer i) ? [n]"
       read ans
       echo
       if test -n "$ans" ; then
          if test "$ans" = "y" -o "$ans" = "yes" ; then
              CNAME=_gfortran
          fi
          if test "$ans" = "i" -o "$ans" = "intel" ; then
              CNAME=_intel
          fi
       fi
fi

if test "$target" = "rs6000" ; then
       echo "Do you want to force 64 bit addressing mode? (answer y) [n]"
       read ans
       echo
       if test -n "$ans" ; then
          if test "$ans" = "y" -o "$ans" = "yes" ; then
              A64=A64
          fi
       fi
fi


R64=
     echo "Default is  32 bit reals."
     echo "Do you want 64 bit reals ? [y,n]"
     read ans
     echo
if test -n "$ans" ; then
  if test "$ans" = "y" -o "$ans" = "yes" ; then
       R64=R64
  fi
fi

echo $R64 > .r64

cat Makefile.in | sed s:reals:$R64: > Makefile

for subdirs in gribex pbio bufrdc bufrtables crexdc interpolation fft
do
cat $subdirs/Makefile.in | sed s:reals:$R64: | sed s:arch:$target: | sed s:plat:$A64: | sed s:depl:emos: | sed s:comp:$CNAME: > $subdirs/Makefile
done

for subdirs in examples/gribex examples/bufr examples/crex examples/interpolation examples/fft
do
cat $subdirs/Makefile.in | sed s:reals:$R64: | sed s:arch:$target: | sed s:plat:$A64: | sed s:comp:$CNAME: > $subdirs/Makefile
done


INSTALL_DIR=/usr/local/lib

echo
echo "   The default directory for gribtables, bufrtables, crextables,"
echo "land_sea_mask, gribtemplates and libemos$R64.a will be $INSTALL_DIR,"
echo " but you may put them anywhere you wish assuming"
echo "you have permission to do so."
echo
echo "   You can specify the directory path for GRIB, BUFR, CREX tables"
echo "local definition templates, land-sea mask, and libemos$R64.a library"
echo "or just press RETURN if you want default directory."
echo
echo "Tables, templates, land-sea mask and libemos$R64.a directory [$INSTALL_DIR]: "
read ans

if test -n "$ans" ; then
    INSTALL_DIR=$ans
fi

echo $INSTALL_DIR > .emos

cat config/config.$target$CNAME$R64$A64.in | sed s:emos:$INSTALL_DIR: > config/config.$target$CNAME$R64$A64

make

chmod a-xw libemos$R64.a

ls bufrtables/*000* > .list/bufrtables

echo "*******************************************************************"
echo
echo "Compilation is completed !"
echo
echo "*******************************************************************"
echo
echo "  You can put other options for compilation in"
echo "config/config.$target$R64 like level of optimisation etc."
echo "and make compilation again. "
echo
echo "When you finish your changes run"
echo
echo "make clean"
echo
echo "make"
echo
echo "in order to produce library "
echo
echo "*******************************************************************"
echo
echo "   Now, if you want to install libemos$R64.a and gribtables, bufrtables, crextables,"
echo "land_sea_mask it is recomended to do that runing ./install script."
echo "You must have root permission runinig ./install , if you want"
echo "to put them on /usr/local/lib "
echo "Also you can choose your directories."
echo
echo "*******************************************************************"
echo
echo "Any comments on the document or the software would be appreciated"
echo
echo "e-mail software.services@ecmwf.int"
echo
echo "*******************************************************************"

exit 0