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 @ 13528

Last change on this file since 13528 was 13528, checked in by gsamson, 4 years ago

add the possibility to store MY_SRC files into subdirectories (for exemple: MY_SRC/ticket#XXXX/*.F90 and MY_SRC/ticket#YYYY/*.F90) by using 'find' instead of 'ls' to search files in MY_SRC

  • 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
39# - OPA has to be done first !!!
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#-
[3294]66declare ZSRC=$1 ; shift
67declare ZCONF=$1 ; shift
[1972]68ZTAB=( $@ )
69declare i=0 ; declare NDIR=${#ZTAB[@]}
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]76if [ "${ZSRC}" != 'none' ] ; then
77
78   if [ -d ${ZSRC} ] ; then
79      ln -sf ${ZSRC}/*.[Ffh]90 ${ZCONF}/MY_SRC/.
80      echo 'MY_SRC content is linked to '${ZSRC}
81   else
82      echo 'External directory for MY_SRC does not exist. Using default.'
83   fi
84
[3294]85else
[9651]86   echo 'MY_SRC directory is : '${ZCONF}'/MY_SRC'
[3294]87fi
88
[9651]89#\rm -f ../${1}/WORK/*
[1972]90
[9651]91for comp in ${ZTAB[*]}; do
92   find ${NEMO_DIR}/$comp -name *.[Ffh]90 -exec ln -sf {} ${ZCONF}/WORK \;
[1972]93done
94
[13528]95for i in `(find ${ZCONF}/MY_SRC -name *.[Ffh]90 2>/dev/null ) `; do
96   [ -f $i ] &&  ln -sf $PWD/${i} ${ZCONF}/WORK/.
[1972]97done
98
[9651]99unset -v ZCONF ZTAB i NDIR
Note: See TracBrowser for help on using the repository browser.