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 branches/2010_and_older/dev_001_GM/UTIL – NEMO

source: branches/2010_and_older/dev_001_GM/UTIL/fait_config @ 5600

Last change on this file since 5600 was 861, checked in by cetlod, 16 years ago

update the fait_AA_make and fait_config scripts to take into account the new TOP architecture , see ticket:93

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