source: issm/trunk-jpl/externalpackages/semic/install.sh@ 27804

Last change on this file since 27804 was 27804, checked in by jdquinn, 21 months ago

CHG: Updated install scripts to handle new Mac architectures

  • Property svn:executable set to *
File size: 1.4 KB
Line 
1#!/bin/bash
2set -eu
3
4
5## Constants
6#
7PREFIX="${ISSM_DIR}/externalpackages/semic/install" # Set to location where external package should be installed
8
9# Cleanup
10rm -rf ${PREFIX} src
11mkdir -p ${PREFIX}/lib
12
13# Download source
14git clone https://github.com/mkrapp/semic.git src
15
16if which ifort >/dev/null; then
17 FC="ifort"
18 FFLAGS="-traceback -check all" # -O2 is default
19else
20 FC="gfortran"
21 if [ `uname` == "Darwin" ]; then
22 FFLAGS="-fcheck=all -arch $(uname -m)"
23 else
24 FFLAGS=""
25 fi
26fi
27
28# Compile and install semic module utils.f90
29cd src/
30(
31cat << EOF
32LIB_EXT=a
33FC=$FC
34FFLAGS=$FFLAGS
35install: libutils.\$(LIB_EXT)
36 cp libutils.\$(LIB_EXT) ${PREFIX}/lib
37 cp utils.mod ${PREFIX}
38OBJECTS= utils.o
39libutils.\$(LIB_EXT): \$(OBJECTS)
40 ar -r libutils.\$(LIB_EXT) \$(OBJECTS)
41 ranlib libutils.\$(LIB_EXT)
42%.o: %.f90
43 \$(FC) \$(FFLAGS) -fPIC -c $< -o \$@
44clean:
45 rm -rf *.o *.\$(LIB_EXT)
46EOF
47) > Makefile
48make
49
50# Apply patch surface_physics
51patch surface_physics.f90 < ../configs/surface_physics.f90.patch
52
53# Compile semic module surface_physics.f90
54(
55cat << EOF
56LIB_EXT=a
57FC=$FC
58FFLAGS=$FFLAGS
59install: libsurface_physics.\$(LIB_EXT)
60 cp libsurface_physics.\$(LIB_EXT) ${PREFIX}/lib
61 cp surface_physics.mod ${PREFIX}
62OBJECTS= surface_physics.o
63libsurface_physics.\$(LIB_EXT): \$(OBJECTS)
64 ar -r libsurface_physics.\$(LIB_EXT) \$(OBJECTS)
65 ranlib libsurface_physics.\$(LIB_EXT)
66%.o: %.f90
67 \$(FC) \$(FFLAGS) -fPIC -c $< -o \$@
68clean:
69 rm -rf *.o *.\$(LIB_EXT)
70EOF
71) > Makefile
72make
Note: See TracBrowser for help on using the repository browser.