New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Fmake_WORK.sh in utils/build/mk – NEMO

source: utils/build/mk/Fmake_WORK.sh

Last change on this file was 15223, checked in by gsamson, 3 years ago

correct issue introduced at r15186

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.7 KB
RevLine 
[1972]1#!/bin/bash
2######################################################
3# Author : Rachid Benshila for NEMO
4# Contact : rblod@locean-ipsl.upmc.fr
5#
[2359]6# Some functions called from makenemo
[1972]7# Fmake_WORK      : create links in the WORK
8######################################################
[9598]9#set -vx
[1972]10set -o posix
11#set -u
12#set -e
13#+
14#
15# =============
16# Fmake_WORK.sh
17# =============
18#
[2520]19# -----------------------
[1972]20# Make the WORK directory
[2520]21# -----------------------
[1972]22#
23# SYNOPSIS
24# ========
25#
26# ::
27#
28#  $ Fmake_WORK.sh
29#
30#
31# DESCRIPTION
32# ===========
33#
34#
35# Make the WORK directory:
36#
[4990]37# - Create line in NEW_CONF/WORK
[1972]38# - Use specified sub-directories previously
[14228]39# - OCE has to be done first !!!
[1972]40#
[2520]41#
[1972]42# EXAMPLES
43# ========
44#
45# ::
46#
[9598]47#  $ ./Fmake_WORK.sh ORCA2_LIM OCE ICE
[1972]48#
49#
50# TODO
51# ====
52#
53# option debug
54#
55#
56# EVOLUTIONS
57# ==========
58#
59# $Id$
60#
61#
62#
63#   * creation
64#
65#-
[14947]66declare ZSRC=${@}
67ZCONF=${NEW_CONF}
68ZTAB=${NEM_SUBDIR[@]}
[15186]69declare NDIR=${#ZTAB[@]}
[1972]70
[9651]71echo 'Creating '${ZCONF}'/WORK = '${ZTAB[*]}' for '${ZCONF}
[1972]72
73[ ! -d ${ZCONF}/MY_SRC ] && \mkdir ${ZCONF}/MY_SRC
74[   -d ${ZCONF}/WORK   ] || \mkdir ${ZCONF}/WORK
75
[9651]76for comp in ${ZTAB[*]}; do
77   find ${NEMO_DIR}/$comp -name *.[Ffh]90 -exec ln -sf {} ${ZCONF}/WORK \;
[1972]78done
79
[15223]80cd ${ZCONF}
[14947]81for ZDIR in ${ZSRC[@]}; do
82    if [ -d ${ZDIR} ] ; then
[15186]83        d=${ZDIR}
[14947]84    else
[15223]85        d='MY_SRC'
[15186]86        echo 'External directory for MY_SRC unspecified or does not exist. Using default.'
[14947]87    fi
[15186]88
89    for ff in `(find ${d} -name *.[Ffh]90 2>/dev/null)`
90    do
[15223]91        if [ "$ff" != "${ff#/}" ]; then
92          ln -sf $ff WORK/.
93        else
94          ln -sf ../$ff WORK/.
95        fi
[15186]96    done
97    echo ${d}' content is linked to '${ZCONF}/WORK
[1972]98done
[15223]99cd -
[1972]100
[15186]101unset -v ZCONF ZTAB NDIR
Note: See TracBrowser for help on using the repository browser.