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

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

nemo_v1_compil_008:RB: update fait_AA_make and fait_config to be used with offline tracers

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