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.
fait_config in trunk/UTIL – NEMO

source: trunk/UTIL/fait_config @ 511

Last change on this file since 511 was 429, checked in by opalod, 18 years ago

nemo_v1_compil_014:RB: add dependency to agrif library

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
RevLine 
[210]1#!/bin/ksh
2######################################################
3# Author : Rachid benshila for ESOPA
4# Contact : opatlod@lodyc.jussieu.fr
5#
[346]6# This script aims to create the OPA/WORK directory
7# with links to target directories for the sources
[210]8# and to link in the WORK the BB_make and BB_make.ldef
9# associated  to a chosen configuration
10#
11######################################################
12
[212]13###################################
14#                                 #
15# Beginning of user modifications #
16#                                 #
17###################################
[210]18#- Config name ---
[212]19# To add a new configuration called NAME you have to change this script
20# 1. Add your configuration in LIST
21# 2. Add the directories needed for this config : set -A DIR_NAME DIR1 DIR2 ...
22# 3. Run fait_config NAME
23# If there is no directory config/NAME/scripts, and in this no BB_make.ldef,
[240]24# the config/ORCA2_LIM directory is copied under NAME
[212]25#
[346]26# Example 1 : in order to create a GYRE_TRC configuration :
[240]27# 1. In this script, change LIST to LIST="ORCA2_LIM \nGYRE \nGYRE_TRC"
[346]28# 2. In this script, add set -A DIR_GYRE_TRC OPA_SRC LIM_SRC TOP_SRC C1D_SRC, take care of the syntax
[212]29# 3. Run fait_config GYRE_TRC
[346]30# Example 2 : in order to create an OFFLINE_TRC configuration :
31# 1. In this script, change LIST to LIST="ORCA2_LIM \nGYRE \nOFFLINE_TRC"
32# 2. In this script, add set -A DIR_OFFLINE_TRC OFF_SRC TOP_SRC, take care of the syntax
33# 3. Run fait_config OFFLINE_TRC
[212]34
[240]35LIST="ORCA2_LIM \nGYRE"
[394]36set -A DIR_ORCA2_LIM OPA_SRC LIM_SRC C1D_SRC NST_SRC
37set -A DIR_GYRE OPA_SRC LIM_SRC C1D_SRC
[210]38
[212]39###################################
40#                                 #
41#    End of user modifications    #
42#                                 #
43###################################
44
45
[210]46#- Some tests ---
47d_n=$(dirname $0); b_n=$(basename $0);
48
49if   [ ${#} -gt 1 ]; then
[212]50    echo 'Only one configuration can be specified in:' 1>&2;
51    echo $LIST 1>&2;
52    exit 3;
[210]53elif [ ${#} -eq 1 ]; then
[212]54     m_n="${1}"
[210]55elif [ ${#} -eq 0 ]; then
[212]56    echo 'You must specify one configuration in :' 1>&2;
57    echo $LIST 1>&2;
58    echo 'You can also complete fait_config to add a new one'
59    exit 3;
[210]60fi
61
[212]62#- Create the WORK --
[242]63d_m=`find ${d_n}/.. -name NEMO`  ;
[210]64[ -d ${d_m}/WORK ] || mkdir ${d_m}/WORK;
65cd ${d_m}/WORK
[212]66
67#- Clean links and librairies
[210]68[ -f Makefile ] && gmake clean
[394]69[ -n "`\ls`" ] && \rm -rf *
[210]70
[212]71#- Find the number of directories ---
72eval NDIR=\${#DIR_${m_n}[*]}
[210]73
[212]74#- Build a working array TAB containing the directories ---
75i=0
76while [ i -lt $NDIR ]
77do
78    eval  TAB[i]=\${DIR_${m_n}[i]}
79    let i=i+1
80done
[210]81
[240]82#- Creating the good links, at first on OPA_SRC ---
[212]83if [ ${#TAB[*]} -ne 0 ] ; then
[240]84    echo " Creating NEMO/WORK = ${TAB[*]} for ${m_n}"
[210]85
[212]86    i=0
87    while [ i -lt $NDIR ]
88    do
[240]89   [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../OPA_SRC/*.[Ffh]90 .
90   [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../OPA_SRC/*/*.[Ffh]90 . && break
[212]91   let i=$i+1
92    done
93
94    i=0
95    while [ i -lt $NDIR ]
96    do
[240]97      if [ "${TAB[i]}" = "LIM_SRC" ]; then
98     ln -sf ../LIM_SRC/*.[Ffh]90 . 
[214]99     
[272]100      elif [ "${TAB[i]}" = "C1D_SRC" ]; then
[271]101     ln -sf ../C1D_SRC/*.[Ffh]90 . 
102     
[240]103      elif [ "${TAB[i]}" = "TOP_SRC" ]; then
[346]104     [ -f  trcstp.F90 ] && \rm trcstp.F90                   
105     [ -f  sms.F90 ] && \rm sms.F90                   
106     [ -f  initrc.F90 ] && \rm initrc.F90                   
[240]107     ln -sf ../TOP_SRC/*.[Ffh]90 .       
108     ln -sf ../TOP_SRC/SMS/*.[Ffh] .       
109     ln -sf ../TOP_SRC/SMS/*.[Ffh]90 . 
110     ln -sf ../TOP_SRC/TRP/*.[Ffh]90 .
[214]111     
[394]112      elif [ "${TAB[i]}" = "NST_SRC" ]; then
113     [ -f  agrif_opa_interp.F90 ] && \rm agrif_opa_interp.F90                   
114     [ -f  agrif_opa_sponge.F90 ] && \rm agrif_opa_sponge.F90                   
115     [ -f  agrif_opa_update.F90 ] && \rm agrif_opa_update.F90                   
116     ln -sf ../NST_SRC/*.[Ffh]90 .
117     
[346]118      elif [ "${TAB[i]}" = "OFF_SRC" ]; then 
119     ln -sf ../OFF_SRC/*.[Ffh]90 .
120     ln -sf ../OFF_SRC/*/*.[Ffh]90 .
[214]121      fi
122      let i=$i+1
[212]123    done
124
[240]125    [ ! -d ../../../config/${m_n} ] && \cp -R ../../../config/ORCA2_LIM ../../../config/${m_n} 
[210]126    ln -sf ../../../*/${m_n}/scripts/BB_make AA_make ;
127    ln -sf ../../../*/${m_n}/scripts/BB_make.ldef AA_make.ldef ;
128
[212]129else
130
131    echo "Configuration "${m_n}" not supported" 1>&2
132    echo 'Make your choice in :' 1>&2
133    echo $LIST 1>&2
134    echo 'You can also complete fait_config to add a new one'
135    exit 1
136
137fi 
138
139#- Building the standard list of source files ---
140cat >.patron <<"EOF" 
[210]141CVS
142SRC_PARAM
143SRC_FILE_LIST
144tmplist
145AA_make
146KEY_CPP
147Makefile
148*?.o
149 i.?*
150*?.L
151.patron
152bloc.com
153para.com
154defcst.f
155fontbc.f
156icdyna.f
157thersf.f
[394]158OPAFILES
[210]159EOF
[212]160ls -1 | fgrep -v -f .patron  >SRC_FILE_LIST ; cp SRC_FILE_LIST SRC_FILE_LIST.temp ;
[210]161
[212]162#- Writing KEY_CPP file ---
[394]163sed -e /^P_P/\!d -e "s/P_P = //" AA_make.ldef > KEY_CPP;   
[212]164
165#- Save new configuration an d directories names ---
166print ${m_n} ${TAB[*]} >.config
167
[210]168exit 0;
Note: See TracBrowser for help on using the repository browser.