/[MITgcm]/MITgcm/tools/OAD_support/cb2mUseModules.bash
ViewVC logotype

Annotation of /MITgcm/tools/OAD_support/cb2mUseModules.bash

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Thu Apr 3 13:57:36 2014 UTC (9 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64w, checkpoint64v, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint65, HEAD
Changes since 1.1: +1 -0 lines
remove temp file "cb2mUseMPI.awk" before leaving

1 heimbach 1.1 #!/bin/bash
2     file=$1
3     wantMPI=$2
4     needMpi=false
5     cp ${file} ${file}.tmp
6     for includeFile in `egrep "\# *include *\"" ${file} | sed 's/# *include *\"\(.*\)\"/\1/' | sort | uniq`
7     do
8     modFileName=${includeFile%.h}_mod.h
9     if [ -f ${modFileName} ]
10     then
11     echo "s/\# *include *\(\"${includeFile}\"\)/\#include \"${modFileName}\"/" > temp.sed
12     # add in the mpi include here since we filtered it from the module
13     if [ "$modFileName" == "EESUPPORT_mod.h" ]
14     then
15     needMpi=true
16     fi
17     cat ${file}.tmp | sed -f temp.sed | sed 's/IMPLICIT NONE//' | sed 's/implicit none//' > ${file}.tmp.1
18     mv ${file}.tmp.1 ${file}.tmp
19     fi
20     done
21     if [ "$needMpi" == "true" -a -n "$wantMPI" ]
22     then
23     cat > cb2mUseMPI.awk <<EOF
24     BEGIN { useSeq = 0; inSR=0}
25     /^ *SUBROUTINE/ { inSR=1 }
26     /^#include / { if (inSR == 1) { useSeq = 1 ; print } }
27     /^#ifdef/ || /^#endif/ { if (useSeq == 1) print }
28     !/^#include / && !/^#ifdef/ && !/^#endif/ { if (useSeq == 1) { printf("#include \"mpif.h\"\n"); useSeq=0; inSR=0 } }
29     {if (useSeq == 0) print }
30     END {}
31     EOF
32     awk -f cb2mUseMPI.awk ${file}.tmp > ${file}.tmp.1
33     mv ${file}.tmp.1 ${file}.tmp
34 jmc 1.2 rm -f cb2mUseMPI.awk
35 heimbach 1.1 fi
36     mv ${file}.tmp ${file%.F}_cb2m.FF90

  ViewVC Help
Powered by ViewVC 1.1.22