source: branches/NERC/dev_r5518_GO6_CO2_cmip/NEMOGCM/TOOLS/COMPILE/Fmake_WORK.sh @ 9298

Last change on this file since 9298 was 6486, checked in by davestorkey, 5 years ago

Remove SVN keywords from UKMO/dev_r5518_GO6_package branch.

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2######################################################
3# Author : Rachid Benshila for NEMO
4# Contact : rblod@locean-ipsl.upmc.fr
5#
6# Some functions called from makenemo
7# Fmake_WORK      : create links in the WORK
8######################################################
9#set -x
10set -o posix
11#set -u
12#set -e
13#+
14#
15# =============
16# Fmake_WORK.sh
17# =============
18#
19# -----------------------
20# Make the WORK directory
21# -----------------------
22#
23# SYNOPSIS
24# ========
25#
26# ::
27#
28#  $ Fmake_WORK.sh
29#
30#
31# DESCRIPTION
32# ===========
33#
34#
35# Make the WORK directory:
36#
37# - Create line in NEW_CONF/WORK
38# - Use specified sub-directories previously
39# - OPA has to be done first !!!
40#
41#
42# EXAMPLES
43# ========
44#
45# ::
46#
47#  $ ./Fmake_WORK.sh ORCA2_LIM OPA_SRC LIM_SRC_2
48#
49#
50# TODO
51# ====
52#
53# option debug
54#
55#
56# EVOLUTIONS
57# ==========
58#
59# $Id: Fmake_WORK.sh 4990 2014-12-15 16:42:49Z timgraham $
60#
61#
62#
63#   * creation
64#
65#-
66declare ZSRC=$1 ; shift
67declare ZCONF=$1 ; shift
68ZTAB=( $@ )
69declare i=0 ; declare NDIR=${#ZTAB[@]}
70
71echo "Creating ${ZCONF}/WORK = ${ZTAB[*]} for ${ZCONF}"
72
73[ ! -d ${ZCONF}/MY_SRC ] && \mkdir ${ZCONF}/MY_SRC
74[   -d ${ZCONF}/WORK   ] || \mkdir ${ZCONF}/WORK
75
76if [ "${ZSRC}" != "none" ] ; then
77  if [ -d ${ZSRC} ] ; then
78     ln -sf ${ZSRC}/*.[Ffh]90 ${ZCONF}/MY_SRC/.
79     echo "MY_SRC content is linked to ${ZSRC}" 
80  else
81     echo "External directory for MY_SRC does not exist. Using default."
82  fi
83else
84echo "MY_SRC directory is : ${ZCONF}/MY_SRC"
85fi
86
87\rm -f ../${1}/WORK/*
88
89while [ $i -lt $NDIR ]
90do
91   [ "${ZTAB[i]}" = "OPA_SRC" ] && ln -sf ${NEMO_DIR}/OPA_SRC/*.[Ffh]90 ${ZCONF}/WORK
92   [ "${ZTAB[i]}" = "OPA_SRC" ] && ln -sf ${NEMO_DIR}/OPA_SRC/*/*.[Ffh]90 ${ZCONF}/WORK && break
93   let i=$i+1
94done
95
96i=0
97while [ $i -lt $NDIR ]
98do
99   if [ "${ZTAB[i]}" != "OPA_SRC" ]; then
100      ln -sf ${NEMO_DIR}/${ZTAB[i]}/*.[Ffh]90 ${ZCONF}/WORK
101      ln -sf ${NEMO_DIR}/${ZTAB[i]}/*/*.[Ffh]90 ${ZCONF}/WORK
102      ln -sf ${NEMO_DIR}/${ZTAB[i]}/*/*/*.[Ffh]90 ${ZCONF}/WORK 2>/dev/null
103   fi
104   let i=$i+1
105done
106
107for i in `(cd ${ZCONF}/MY_SRC ; ls *.[Ffh]90 2>/dev/null ) `
108   do
109      [ -f ${ZCONF}/MY_SRC/$i ] &&  ln -sf $PWD/${ZCONF}/MY_SRC/${i} ${ZCONF}/WORK/.
110   done
111
112unset -v  ZCONF
113unset -v ZTAB
114unset -v  i
115unset -v NDIR
116
Note: See TracBrowser for help on using the repository browser.