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

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

update the fait_AA_make and fait_config scripts to take into account the new TOP initiaization phase, see ticket 173

  • 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_3 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 \nGYRE_LOBSTER \nORCA2_LIM_PISCES \nORCA2_OFF_PISCES"
36set -A DIR_ORCA2_LIM OPA_SRC LIM_SRC_2 C1D_SRC NST_SRC
37set -A DIR_GYRE OPA_SRC LIM_SRC_2 C1D_SRC
38set -A DIR_GYRE_LOBSTER OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
39set -A DIR_ORCA2_LIM_PISCES OPA_SRC LIM_SRC_2 C1D_SRC TOP_SRC
40set -A DIR_ORCA2_OFF_PISCES OFF_SRC TOP_SRC
41
42###################################
43#                                 #
44#    End of user modifications    #
45#                                 #
46###################################
47
48
49#- Some tests ---
50d_n=$(dirname $0); b_n=$(basename $0);
51
52if   [ ${#} -gt 1 ]; then
53    echo 'Only one configuration can be specified in:' 1>&2;
54    echo $LIST 1>&2;
55    exit 3;
56elif [ ${#} -eq 1 ]; then
57     m_n="${1}"
58elif [ ${#} -eq 0 ]; then
59    echo 'You must specify one configuration in :' 1>&2;
60    echo $LIST 1>&2;
61    echo 'You can also complete fait_config to add a new one'
62    exit 3;
63fi
64
65#- Create the WORK --
66d_m=`find ${d_n}/.. -name NEMO`  ;
67[ -d ${d_m}/WORK ] || mkdir ${d_m}/WORK;
68cd ${d_m}/WORK
69
70#- Clean links and librairies
71[ -f Makefile ] && gmake clean
72[ -n "`\ls`" ] && \rm -rf *
73
74#- Find the number of directories ---
75eval NDIR=\${#DIR_${m_n}[*]}
76
77#- Build a working array TAB containing the directories ---
78i=0
79while [ i -lt $NDIR ]
80do
81    eval  TAB[i]=\${DIR_${m_n}[i]}
82    let i=i+1
83done
84
85#- Creating the good links, at first on OPA_SRC ---
86if [ ${#TAB[*]} -ne 0 ] ; then
87    echo " Creating NEMO/WORK = ${TAB[*]} for ${m_n}"
88
89    i=0
90    while [ i -lt $NDIR ]
91    do
92   [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../OPA_SRC/*.[Ffh]90 .
93   [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../OPA_SRC/*/*.[Ffh]90 . && break
94   let i=$i+1
95    done
96
97    i=0
98    while [ i -lt $NDIR ]
99    do
100      if [ "${TAB[i]}" = "LIM_SRC_3" ]; then
101     ln -sf ../LIM_SRC_3/*.[Ffh]90 . 
102     
103      elif [ "${TAB[i]}" = "LIM_SRC_2" ]; then
104     ln -sf ../LIM_SRC_2/*.[Ffh]90 . 
105     
106      elif [ "${TAB[i]}" = "C1D_SRC" ]; then
107     ln -sf ../C1D_SRC/*.[Ffh]90 . 
108     
109      elif [ "${TAB[i]}" = "TOP_SRC" ]; then
110     [ -f  trcstp.F90 ] && \rm trcstp.F90                   
111     [ -f  sms.F90 ] && \rm sms.F90                   
112     [ -f  trcini.F90 ] && \rm trcini.F90                   
113     ln -sf ../TOP_SRC/*.[Ffh]90 .       
114     ln -sf ../TOP_SRC/*/*.[Ffh]90 .
115     
116      elif [ "${TAB[i]}" = "NST_SRC" ]; then
117     [ -f  agrif_opa_interp.F90 ] && \rm agrif_opa_interp.F90                   
118     [ -f  agrif_opa_sponge.F90 ] && \rm agrif_opa_sponge.F90                   
119     [ -f  agrif_opa_update.F90 ] && \rm agrif_opa_update.F90                   
120     ln -sf ../NST_SRC/*.[Ffh]90 .
121     
122      elif [ "${TAB[i]}" = "OFF_SRC" ]; then 
123     ln -sf ../OFF_SRC/*.[Ffh]90 .
124     ln -sf ../OFF_SRC/*/*.[Ffh]90 .
125      fi
126      let i=$i+1
127    done
128
129    [ ! -d ../../../config/${m_n} ] && \cp -R ../../../config/ORCA2_LIM ../../../config/${m_n} 
130    ln -sf ../../../*/${m_n}/scripts/BB_make AA_make ;
131    ln -sf ../../../*/${m_n}/scripts/BB_make.ldef AA_make.ldef ;
132
133else
134
135    echo "Configuration "${m_n}" not supported" 1>&2
136    echo 'Make your choice in :' 1>&2
137    echo $LIST 1>&2
138    echo 'You can also complete fait_config to add a new one'
139    exit 1
140
141fi 
142
143#- Building the standard list of source files ---
144cat >.patron <<"EOF" 
145CVS
146SRC_PARAM
147SRC_FILE_LIST
148tmplist
149AA_make
150KEY_CPP
151Makefile
152*?.o
153 i.?*
154*?.L
155.patron
156bloc.com
157para.com
158defcst.f
159fontbc.f
160icdyna.f
161thersf.f
162OPAFILES
163EOF
164ls -1 | fgrep -v -f .patron  >SRC_FILE_LIST ; cp SRC_FILE_LIST SRC_FILE_LIST.temp ;
165
166#- Writing KEY_CPP file ---
167sed -e /^P_P/\!d -e "s/P_P = //" AA_make.ldef > KEY_CPP;   
168
169#- Save new configuration an d directories names ---
170print ${m_n} ${TAB[*]} >.config
171
172exit 0;
Note: See TracBrowser for help on using the repository browser.