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_tam in branches/TAM_V3_0/UTIL – NEMO

source: branches/TAM_V3_0/UTIL/fait_config_tam @ 1947

Last change on this file since 1947 was 1947, checked in by rblod, 14 years ago

adjustement for TAM branch

  • Property svn:executable set to *
File size: 3.8 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 NEMOTAM/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_TAM directory is copied under NAME
25#
26LIST="ORCA2_TAM"
27set -A DIR_ORCA2_TAM OPATAM_SRC OPA_SRC C1D_SRC
28###################################
29#                                 #
30#    End of user modifications    #
31#                                 #
32###################################
33
34
35#- Some tests ---
36d_n=$(dirname $0); b_n=$(basename $0);
37
38if   [ ${#} -gt 1 ]; then
39    echo 'Only one configuration can be specified in:' 1>&2;
40    echo $LIST 1>&2;
41    exit 3;
42elif [ ${#} -eq 1 ]; then
43     m_n="${1}"
44elif [ ${#} -eq 0 ]; then
45    echo 'You must specify one configuration in :' 1>&2;
46    echo $LIST 1>&2;
47    echo 'You can also complete fait_config to add a new one'
48    exit 3;
49fi
50
51#- Create the WORK --
52d_m=`find ${d_n}/.. -name NEMOTAM`  ;
53[ -d ${d_m}/WORK ] || mkdir ${d_m}/WORK;
54cd ${d_m}/WORK
55
56#- Clean links and librairies
57[ -f Makefile ] && gmake clean
58[ -n "`\ls`" ] && \rm -rf *
59
60#- Find the number of directories ---
61eval NDIR=\${#DIR_${m_n}[*]}
62
63#- Build a working array TAB containing the directories ---
64i=0
65while [ i -lt $NDIR ]
66do
67    eval  TAB[i]=\${DIR_${m_n}[i]}
68    let i=i+1
69done
70
71#- Creating the good links, at first on OPATAM_SRC ---
72if [ ${#TAB[*]} -ne 0 ] ; then
73    echo " Creating NEMOTAM/WORK = ${TAB[*]} for ${m_n}"
74
75    i=0
76    while [ i -lt $NDIR ]
77    do
78   [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPATAM_SRC" ] && ln -sf ../OPATAM_SRC/*.[Ffh]90 .
79   [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPATAM_SRC" ] && ln -sf ../OPATAM_SRC/*/*.[Ffh]90 . && break
80   let i=$i+1
81    done
82    i=0
83    while [ i -lt $NDIR ]
84    do
85        [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../../NEMO/OPA_SRC/*.[Ffh]90 .
86        [ ${#TAB[i]} -ne 0 ] && [ "${TAB[i]}" = "OPA_SRC" ] && ln -sf ../../NEMO/OPA_SRC/*/*.[Ffh]90 . && break
87        let i=$i+1
88    done
89    i=0
90    while [ i -lt $NDIR ]
91    do
92      if [ "${TAB[i]}" = "C1D_SRC" ]; then
93          ln -sf ../../NEMO/C1D_SRC/*.[Ffh]90 .
94      elif [ "${TAB[i]}" = "LIM_SRC_2" ]; then
95          ln -sf ../../NEMOLIM_SRC_2/*.[Ffh]90 .
96      fi
97      let i=$i+1
98    done       
99
100    [ ! -d ../../../config/${m_n} ] && \cp -R ../../../config/ORCA2_LIM_TAM ../../../config/${m_n} 
101    ln -sf ../../../*/${m_n}/scripts/BB_make AA_make ;
102    ln -sf ../../../*/${m_n}/scripts/BB_make.ldef AA_make.ldef ;
103
104else
105
106    echo "Configuration "${m_n}" not supported" 1>&2
107    echo 'Make your choice in :' 1>&2
108    echo $LIST 1>&2
109    echo 'You can also complete fait_config to add a new one'
110    exit 1
111
112fi 
113
114#- Building the standard list of source files ---
115cat >.patron <<"EOF" 
116CVS
117SRC_PARAM
118SRC_FILE_LIST
119tmplist
120AA_make
121KEY_CPP
122Makefile
123*?.o
124 i.?*
125*?.L
126.patron
127bloc.com
128para.com
129defcst.f
130fontbc.f
131icdyna.f
132thersf.f
133OPAFILES
134EOF
135ls -1 | fgrep -v -f .patron  >SRC_FILE_LIST ; cp SRC_FILE_LIST SRC_FILE_LIST.temp ;
136
137#- Writing KEY_CPP file ---
138sed -e /^P_P/\!d -e "s/P_P = //" AA_make.ldef > KEY_CPP;   
139
140#- Save new configuration an d directories names ---
141print ${m_n} ${TAB[*]} >.config
142
143exit 0;
Note: See TracBrowser for help on using the repository browser.