#!/bin/ksh # mbuild - Programmuebersetzungsscript # $Id: mbuild 54 2007-03-08 00:00:02Z raasch $ # Prozedur zur Uebersetzung von Programmteilen mittels make-Mechanismus # auf einem Remote-Rechner, ausgehend von Quellcode auf einem lokalen # Rechner # Folgende Probleme existieren unter Linux, wenn keine AT&T-Korn-Shell # verwendet wird: # Wertzuweisungen an Variablen innerhalb von DO-Schleifen werden nicht # nach aussen weitergegeben. "while read line" funktioniert nicht # innerhalb einer Pipe. # letzte Aenderung: # 06/05/02 - Siggi - Beginn der Entwicklung # 12/06/02 - Siggi - Abschluss der Entwicklungsarbeiten # 23/06/02 - Siggi - voerst kein make-clean, Abbruch bei batch-mode # 24/07/02 - Siggi - Keine Verwendung der temporaeren Datei tmp_mbuild # unter linux mehr noetig, da nun AT&T-Korn-Shell # benutzt wird # 12/09/02 - Siggi - ibmh (hanni.hlrn.de) validiert # 19/12/02 - Siggi - ibmb validiert # 05/02/03 - Siggi - hostname nobela included # 04/03/03 - Siggi - host nech included # 06/03/03 - Siggi - make_call_string is echoed without '' to # file LAST_MAKE_CALL (otherwise error on NEC, because # '' are part of compiler options # 16/03/03 - Siggi - Two underscores are placed in front of every define # string, in case that palm.f90 version contains # such strings # 16/04/03 - Siggi - First extensions for linux machines # 24/06/03 - Siggi - host orkan included # 17/07/03 - Siggi - IP adress set to new "cross" machine at DKRZ # 24/07/03 - Siggi - host maestro admitted # 06/08/03 - Siggi - host gregale admitted # 05/11/03 - Siggi - hosts irifi and quanero are now belonging to lcmuk # 19/11/03 - Heiko - on lcmuk, mbuild does not tar the *.i files # 08/01/04 - Siggi - additional preprocessor directive for ibm included # (-D$OMP=OMP) in order to avoid problems with # OMP_NUM_THREADS # 09/01/04 - Siggi - action above cancelled # 28/01/04 - Siggi - action above re-cancelled # 08/03/04 - Siggi - host scirocco admitted # 26/03/04 - Siggi - .o and .mod files are also deleted in depository, if # the respective .f90 file is not listed in the makefile # and deletion is demanded by the user # 12/04/04 - Siggi - scp2 instead of scp used for transfer from decalpha # due to error in ssh installation (otherwise a prompt # for the password appears) # 23/07/04 - Siggi - changes due to the new berni configuration # (federation switch) # 08/09/04 - Siggi - hanni IP address changed to 130.75.4.10 # 23/09/04 - Joerg - correction of IP-Address for 'cross' (DKRZ) # 09/03/05 - Siggi - on nech, mbuild does not tar the *.i files # 31/03/05 - Siggi - mbuild does not tar *.i files any more # 24/04/05 - Siggi - netcdf support on lcmuk # 25/04/05 - Siggi - netcdf support on gfdl3 (decalpha) # 12/05/05 - Siggi - netcdf support on ibm # set OBJECT_MODE=64 for compiling on ibmb, ibmh # 18/05/05 - Siggi - netcdf support on nec # 19/05/05 - Siggi - IP addres 134.75.155.74 changed to 165.132.26.56 # 23/05/05 - Siggi - netcdf support on ibms # 01/06/05 - Siggi - reset of cpp_options to "" on lcmuk # 30/06/05 - Siggi - netcdf support on bora # 20/10/05 - Siggi - update of netcdf-version on decalpha (gfdl3) # 04/11/05 - Siggi - netcdf 3.6.0-p1 on ibmh/ibmb # 30/12/05 - Siggi - change of IP adresses in subnet 130.75.105 # host gfdl5 (ibmy) admitted # 10/01/06 - Siggi - cpp directive for NetCDF 64bit support # 20/01/06 - Siggi - cpp directive for ibmy # 09/02/06 - Marcus- compile only once on lcmuk (as on ibmh/ibmb) # 10/02/06 - Siggi - modifications for scp on decalpha # 13/04/06 - Siggi - ostria admitted # 19/04/06 - Siggi - preprocessor directive -D$OMP=OMP for ibm removed # 23/05/05 - Siggi - lctit (SUN Fire X4600) admitted # 29/05/05 - Siggi - atmos (lcide) admitted # 23/08/06 - Siggi - netcdf support for scirocco (notebook) # 24/11/06 - Siggi - breva and levanto admitted # 07/02/07 - Siggi - adapted for RIAM (neck) # 10/02/07 - Siggi - all hpmuk-related code removed # 02/03/07 - Siggi - compilation of utility programs and transfer of # scripts to remote hosts added (option -u) # 14/03/07 - Siggi - fimm admitted, revision number added to terminal # output # 16/03/07 - Siggi - adjustments (netcdf) for lctit # adjustments for running under pdksh, local ip-addres # is not determined any more # 30/03/07 - Siggi - cpp-directives/options + netcdf-options are read # from configuration file # host identifier (local_host) is read from config file # 10/10/07 - Siggi - bugfix: handling of comment lines # VARIABLENVEREINBARUNGEN + DEFAULTWERTE compile_utility_programs=false config_file=.mrun.config fimm=false host=all host_found=false ibm_hb_done=false lcmuk_done=false locat=normal makefile="" remote_mode=interactive scirocco=false silent=false suf=f90 update=false working_directory=`pwd` typeset -i ih ihost=0 typeset -R30 calltime typeset -L20 column1 typeset -L50 column2 typeset -L70 column3 typeset -L40 version="MBUILD 2.0 Rev$Rev: 116 $" # FEHLERBEHANDLUNG # BEI EXIT: trap 'rm -rf $working_directory/tmp_mbuild if [[ $locat != normal ]] then printf "\n\n +++ mbuild killed \n\n" else printf "\n\n *** mbuild finished \n\n" fi' exit # BEI TERMINAL-BREAK: trap 'rm -rf $working_directory/tmp_mbuild printf "\n\n +++ mbuild killed by \"^C\" \n\n" exit ' 2 # SHELLSCRIPT-OPTIONEN EINLESEN while getopts :c:h:m:rs:u option do case $option in (c) config_file=$OPTARG;; (h) host=$OPTARG;; (m) makefile=$OPTARG;; (r) remote_mode=batch;; (s) suf=$OPTARG;; (u) compile_utility_programs=true;; (\?) printf "\n +++ unknown option $OPTARG \n"; locat=parameter; exit;; esac done # BATCH-MODE IST ZUR ZEIT NICHT FUNKTIONSFAEHIG if [[ $remote_mode = batch ]] then printf "\n +++ sorry, batch mode does not work! \n" locat=parameter; exit fi # PRUEFEN, OB KONFIGURATIONS-DATEI VORHANDEN if [[ ! -f $config_file ]] then printf "\n +++ configuration file: " printf "\n $config_file" printf "\n does not exist" locat=configuration; exit fi # LOKALEN RECHNER ERMITTELN local_host_real_name=$(hostname) # local_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}') # HOST-IDENTIFIER (local_host) AUS KONFIGURATIONSDATEI BESTIMMEN line="" grep "%host_identifier" $config_file > tmp_mbuild while read line do if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then HOSTNAME=`echo $line | cut -d" " -s -f2` host_identifier=`echo $line | cut -d" " -s -f3` if [[ $local_host_real_name = $HOSTNAME ]] then local_host=$host_identifier break fi fi done < tmp_mbuild if [[ "$local_host" = "" ]] then printf "\n +++ no host identifier found in configuration file \"$config_file\"" printf "\n for local host \"$local_host_real_name\"." printf "\n Please add line" printf "\n \"\%host_identifier $local_host_real_name \"" printf "\n to the configuration file." locat=local_host; exit fi [[ $local_host_real_name = scirocco ]] && scirocco=true [[ $local_host_real_name = fimm.bccs.uib.no ]] && fimm=true if [[ $local_host != ibms ]] then config_file=$PWD/$config_file else config_file=`pwd`/$config_file fi # BENUTZERNAMEN AUF LOKALEM RECHNER AUS KONFIGURATIONSDATEI ERMITTELN line="" grep " $local_host" $config_file | grep "%remote_username" > tmp_mbuild while read line do if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then local_username=`echo $line | cut -d" " -s -f2` fi done < tmp_mbuild if [[ "$local_username" = "" ]] then printf "\n +++ no user name found in configuration file" printf "\n for local host \"$local_host\" " locat=config_file; exit fi # LOKALEN QUELLTEXTPFAD ERMITTELN. # ZUERST PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD FUER ALLE RECHNER # VEREINBART WURDE. # DAZU ZUNAECHST ALLE IN DER KONFIGURATIONSDATEI VEREINBARTEN GLOBALEN # VARIABLEN SETZEN, WEIL DIESE EVTL. IN PFADNAMEN VERWENDET WERDEN line="" grep "%" $config_file > tmp_mbuild while read line do if [[ "$line" != "" && "$(echo $line | cut -d" " -s -f3)" = "" && $(echo $line | cut -c1) != "#" ]] then var=`echo $line | cut -d" " -s -f1 | cut -c2-` value=`echo $line | cut -d" " -s -f2` eval export $var=\$value # eval echo \" $var=\$$var \" # AUSGABE ZU TESTZWECKEN fi done < tmp_mbuild # NUN PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD VEREINBART WURDE line="" grep "%source_path" $config_file > tmp_mbuild while read line do if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] then global_source_path=`echo $line | cut -d" " -s -f2` fi fi done < tmp_mbuild line="" grep " $local_host" $config_file | grep "%source_path" > tmp_mbuild while read line do if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then local_source_path=`echo $line | cut -d" " -s -f2` fi done < tmp_mbuild if [[ "$local_source_path" = "" ]] then if [[ "$global_source_path" != "" ]] then local_source_path=$global_source_path else printf "\n +++ no source path found in configuration file" printf "\n for local host \"$local_host\" " printf "\n please set \"\%source_path\" in configuration file" locat=config_file; exit fi fi eval local_source_path=$local_source_path eval local_source_path=$local_source_path # EBENSO PFAD FUER DAS MAKE-DEPOSITORY ERMITTELN line="" grep "%depository_path" $config_file > tmp_mbuild while read line do if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] then global_depository_path=`echo $line | cut -d" " -s -f2` fi fi done < tmp_mbuild line="" grep " $local_host" $config_file | grep "%depository_path" > tmp_mbuild while read line do if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then local_depository_path=`echo $line | cut -d" " -s -f2` fi done < tmp_mbuild if [[ "$local_depository_path" = "" ]] then if [[ "$global_depository_path" != "" ]] then local_depository_path=$global_depository_path else printf "\n +++ no depository path found in configuration file" printf "\n for local host \"$local_host\" " printf "\n please set \"\%depository_path\" in configuration file" locat=config_file; exit fi fi eval local_depository_path=$local_depository_path eval local_depository_path=$local_depository_path # PRUEFEN, OB IN KONFIGURATIONSDATEI EIN HAUPTPROGRAMM # VEREINBART WURDE if [[ $(grep -c "%mainprog" $config_file) != 1 ]] then printf "\n +++ no main program or more than one main program defined" printf "\n in configuration file" locat=configuration; exit else line=`grep "%mainprog" $config_file` if [[ "$line" = "" || $(echo $line | cut -c1) = "#" ]] then printf "\n +++ no main program defined in configuration file" locat=configuration; exit fi mainprog=`echo $line | cut -d" " -s -f2 | cut -d"." -f1` fi # MAKEFILE vorhanden [[ "$makefile" = "" ]] && makefile=$local_source_path/Makefile if [[ ! -f $makefile ]] then printf "\n +++ makefile: " printf "\n $makefile" printf "\n does not exist" locat=makefile; exit fi # HEADER-AUSGABE (TEIL1: MELDUNGEN UEBER LOKALEN RECHNER) calltime=$(date) printf "\n" printf "#------------------------------------------------------------------------# \n" printf "| $version$calltime | \n" printf "| | \n" column1="called on:"; column2=$local_host_real_name printf "| $column1$column2 | \n" column1="local username:"; column2=$local_username printf "| $column1$column2 | \n" column1="local IP-addres:"; column2=$local_addres printf "| $column1$column2 | \n" column1="config file:"; column2=$config_file printf "| $column1$column2 | \n" column1="makefile:"; column2=$makefile printf "| $column1$column2 | \n" column1="local source path:"; column2=$local_source_path printf "| $column1$column2 | \n" column1="make depository:"; column2=$local_depository_path printf "| $column1$column2 | \n" printf "#------------------------------------------------------------------------# \n" # printf "| | \n" if [[ $compile_utility_programs = false ]] then cd $local_source_path # LISTE DER ZU PRUEFENDEN QUELLTEXTDATEIEN ERSTELLEN source_code_files=`ls -1 *.$suf` # VERZEICHNIS FUER DAS MAKE-DEPOSITORY ERZEUGEN, # FALLS NOCH NICHT VORHANDEN. ANSONSTEN ALLE DATEIEN # NEUEREN DATUMS IN DIESES VERZEICHNIS KOPIEREN if [[ ! -d $local_depository_path ]] then if mkdir $local_depository_path then printf "\n\n *** directory for make depository:" printf "\n $local_depository_path" printf "\n was created\n" # MAKEFILE UND QUELLTEXTDATEIEN UNTER BEIBEHALTUNG # IHRES DATUMS INS VERZEICHNIS KOPIEREN printf "\n *** makefile and source code files are copied to" printf "\n $local_depository_path\n" printf "\n copying makefile \"$makefile\" ..." cp -p $makefile $local_depository_path/Makefile # QUELLTEXTDATEIEN MUESSEN IM MAKEFILE AUFGEFUEHRT # SEIN for filename in $source_code_files do if [[ $(grep -c $filename $makefile) = 0 ]] then printf "\n +++ source code file:" printf "\n $filename" printf "\n is not listed in makefile" locat=makefile; exit else printf "\n copying source code file \"$filename\" ..." cp -p $filename $local_depository_path fi done printf "\n" else printf "\n +++ directory for make depository:" printf "\n $local_depository_path" printf "\n cannot be created" locat=local_depository_path; exit fi else printf "\n *** checking file status ..." # MAKEFILE KOPIEREN, FALLS NEUEREN DATUMS if [[ $makefile -nt $local_depository_path/Makefile ]] then printf "\n *** update of \"$makefile\" " cp -f -p $makefile $local_depository_path/Makefile update=true # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY AUCH IM NEUEN MAKEFILE # VERZEICHNET SIND UND GEGEBENENFALLS DATEIEN LOESCHEN cd $local_depository_path source_code_files_in_depository=`ls -1 *.$suf` for filename in $source_code_files_in_depository do if [[ $(grep -c $filename Makefile) = 0 ]] then printf "\n *** source code file in \"$local_depository_path\":" printf "\n $filename" printf "\n is not listed in makefile" if [[ $silent = false ]] then answer=dummy printf "\n\n" while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] do printf " >>> delete \"$filename\" in \"$local_depository_path\" (y/n) ? " read answer done if [[ $answer = y || $answer = Y ]] then base=`echo $filename | cut -d. -f2` rm -f $filename rm -f ${base}.o ${base}.mod printf "\n *** \"$filename\" deleted in \"$local_depository_path\" " else printf "\n *** \"$filename\" not deleted in \"$local_depository_path\" " fi fi fi done cd - > /dev/null 2>&1 elif [[ $local_depository_path/Makefile -nt $makefile ]] then printf "\n *** makefile in depository is newer than" printf "\n \"$makefile\" " if [[ $silent = false ]] then answer=dummy printf "\n\n" while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] do printf " >>> update \"$makefile\" (y/n) ? " read answer done if [[ $answer = y || $answer = Y ]] then cp -f -p $local_depository_path/Makefile $makefile printf "\n *** \"$makefile\" updated" else printf "\n *** \"$makefile\" not updated" fi fi fi # QUELLTEXTDATEIEN KOPIEREN, FALLS NEUEREN DATUMS # SIE MUESSEN IM MAKEFILE AUFGEFUEHRT SEIN for filename in $source_code_files do if [[ $(grep -c $filename $makefile) = 0 ]] then printf "\n +++ source code file:" printf "\n $filename" printf "\n is not listed in makefile" locat=makefile; exit else if [[ ! -f $local_depository_path/$filename ]] then cp -p $filename $local_depository_path printf "\n *** source code file \"$filename\" created in \"$local_depository_path\" " fi if [[ $filename -nt $local_depository_path/$filename ]] then printf "\n *** update of source code file \"$filename\" " cp -f -p $filename $local_depository_path update=true fi fi done # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY IM AKTUELLEN ARBEITSVERZEICHNIS VORHANDEN # ODER EVTL. NEUEREN DATUMS SIND cd $local_depository_path source_code_files_in_depository=`ls -1 *.$suf` cd - > /dev/null 2>&1 for filename in $source_code_files_in_depository do if [[ ! -f $filename ]] then printf "\n *** source code file \"$filename\" does not exist in current directory" if [[ $silent = false ]] then answer=dummy printf "\n\n" while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] do printf " >>> create \"$filename\" in current directory (y/n) ? " read answer done if [[ $answer = y || $answer = Y ]] then cp -p $local_depository_path/$filename $filename printf "\n *** source code file \"$filename\" created in current directory" else printf "\n *** source code file \"$filename\" not created in current directory" fi fi elif [[ $local_depository_path/$filename -nt $filename ]] then ls -al $local_depository_path/$filename ls -al $filename printf "\n *** source code file \"$filename\" in depository is newer than in current directory" if [[ $silent = false ]] then answer=dummy printf "\n\n" while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] do printf " >>> update \"$filename\" in current directory (y/n) ? " read answer done if [[ $answer = y || $answer = Y ]] then cp -f -p $local_depository_path/$filename $filename printf "\n *** source code file \"$filename\" updated in current directory" else printf "\n *** source code file \"$filename\" not updated in current directory" fi fi fi done if [[ $update = false ]] then printf "\n *** no updates necessary in \"$local_depository_path\" " if [[ $silent = false ]] then answer=dummy printf "\n\n" while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] do printf " >>> continue with updates on remote hosts (y/n) ? " read answer done if [[ $answer = n || $answer = N ]] then locat=user_abort; exit fi fi fi fi # QUELLTEXTDATEIEN UND MAKEFILE MIT TAR ZUSAMMENBINDEN # IN JEDEM FALL ALLEN DATEIEN WRITE-PERMIT GEBEN, DAMIT ES AUF # DEN REMOTE-RECHNERN NICHT EVTL. ZU PROBLEMEN BEIM UEBERSCHREIBEN KOMMT printf "\n\n *** tar of makefile and source files in depository ..." cd $local_depository_path chmod u+w Makefile *.$suf tar -cf ${mainprog}_sources.tar Makefile *.$suf printf "\n" fi # BESTAETIGUNG ZUM WEITERMACHEN EINHOLEN if [[ $host = all ]] then printf "\n *** updates will be made for ALL hosts found in" printf "\n the configuration file" else printf "\n *** update will be made for host \"$host\" " fi if [[ $silent = false ]] then answer=dummy printf "\n\n" while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] do printf " >>> continue (y/n) ? " read answer done if [[ $answer = n || $answer = N ]] then locat=user_abort; exit fi fi # GENERIERUNG DER AKTUELLEN MODELLVERSION FUER ALLE RECHNER-/UEBERSETZUNGS- # VERSIONEN, DIE IN DER KONFIGURATIONSDATEI GEFUNDEN WERDEN printf "\n *** scanning configuration file for host(s) ..." grep %fopts $config_file > tmp_mbuild while read line do # KOMMENTARZEILEN UEBERSPRINGEN [[ $(echo $line | cut -c1) = "#" ]] && continue (( ihost = ihost + 1 )) hostline[$ihost]="$line" done < tmp_mbuild while (( ih < ihost )) do (( ih = ih + 1 )) # REMOTE-RECHNER UND UEBERSETZUNGS-VERSION FESTSTELLEN # NUR WEITERMACHEN, WENN ENTSPRECHENDER REMOTE-RECHNER MITTELS # SHELLSCRIPT-OPTION AUCH AUSGEWAEHLT WURDE remote_host_string=`echo ${hostline[$ih]} | cut -d" " -s -f3-` remote_host=`echo $remote_host_string | cut -d" " -f1` if [[ $host != all ]] then [[ $remote_host != $host ]] && continue fi host_found=true condition1=`echo $remote_host_string | cut -d" " -s -f2` if [[ $condition1 = $remote_host ]] then condition1="" else condition2=`echo $remote_host_string | cut -d" " -s -f3` fi netcdf_inc="" netcdf_lib="" # AUF HLRN-RECHNER NUR EINMAL UEBERSETZEN if [[ $remote_host = ibmb || $remote_host = ibmh ]] then if [[ $ibm_hb_done = true ]] then printf "\n *** remote host \"$remote_host\" skipped since compilation has already" printf "\n been carried out on one of the HLRN machines\n" continue fi fi # AUF LCMUK-RECHNER NUR EINMAL UEBERSETZEN if [[ $remote_host = lcmuk ]] then if [[ $lcmuk_done = true ]] then printf "\n *** local host \"$remote_host\" skipped since compilation has already" printf "\n been carried out on this host\n" continue fi fi # IP-ADRESSE DES REMOTE-RECHNERS BESTIMMEN case $remote_host in (lcmuk) remote_addres=130.75.105.2;; (lctit) remote_addres=172.17.75.161;; (decalpha) remote_addres=165.132.26.56;; (ibmb) remote_addres=130.73.230.10;; (ibmh) remote_addres=130.75.4.10;; (ibms) remote_addres=150.183.5.101;; (ibmy) remote_addres=165.132.26.58;; (nech) remote_addres=136.172.44.192;; (neck) remote_addres=133.5.178.11;; (ground.yonsei.ac.kr) remote_addres=134.75.155.33;; (*) if [[ $local_host != $remote_host ]] then printf "\n +++ remote host \"$remote_host\" unknown"; printf "\n please inform S. Raasch!" fi;; esac # REMOTE-USERNAMEN ERMITTELN line="" found=false grep "$remote_host_string" $config_file | grep "%remote_username" > tmp_mbuild while read line1 do if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] then line="$line1" fi if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then remote_username=`echo $line | cut -d" " -s -f2` found=true fi done < tmp_mbuild if [[ $found = false ]] then printf "\n +++ no remote username found in configuration file" printf "\n for \"$remote_host_string\" " locat=config_file; exit fi # REMOTE-QUELLTEXTPFAD ERMITTELN line="" remote_source_path="" grep "$remote_host_string" $config_file | grep "%source_path" > tmp_mbuild while read line1 do if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] then line="$line1" fi if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then remote_source_path=`echo $line | cut -d" " -s -f2` fi done < tmp_mbuild if [[ "$remote_source_path" = "" ]] then if [[ "$global_source_path" != "" ]] then remote_source_path=$global_source_path else printf "\n +++ no source path found in configuration file" printf "\n for \"$remote_host_string\" " locat=config_file; exit fi fi remote_ud=${remote_source_path}/../UTIL remote_ud=$(eval echo $remote_ud) # REMOTE-PFAD FUER MAKE-DEPOSITORY ERMITTELN remote_md="" line="" grep "$remote_host_string" $config_file | grep "%depository_path" > tmp_mbuild while read line1 do if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] then line="$line1" fi if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then remote_md=`echo $line | cut -d" " -s -f2` fi done < tmp_mbuild if [[ "$remote_md" = "" ]] then if [[ "$global_depository_path" != "" ]] then remote_md=$global_depository_path else printf "\n +++ no depository path found in configuration file" printf "\n for \"$remote_host_string\" " printf "\n please set \"\%depository_path\" in configuration file" locat=config_file; exit fi fi remote_md=$(eval echo $remote_md) # COMPILERNAMEN ERMITTELN line="" found=false grep "$remote_host_string" $config_file | grep "%compiler_name " > tmp_mbuild while read line1 do if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] then line="$line1" fi if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then compiler_name=`echo $line | cut -d" " -s -f2` found=true fi done < tmp_mbuild if [[ $found = false ]] then printf "\n +++ no compiler name found in configuration file" printf "\n for \"$remote_host_string\" " locat=config_file; exit fi # BEI BENUTZUNG EINES PARALLELEN COMPILERS MUSS AUCH EIN # SERIELLER COMPILERNAME ERMITTELT WERDEN if [[ $(echo $remote_host_string | grep -c parallel) = 1 ]] then line="" found=false grep "$remote_host_string" $config_file | grep "%compiler_name_ser" > tmp_mbuild while read line1 do if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] then line="$line1" fi if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then compiler_name_ser=`echo $line | cut -d" " -s -f2` found=true fi done < tmp_mbuild if [[ $found = false ]] then printf "\n +++ no serial compiler name found in configuration file" printf "\n for \"$remote_host_string\" " locat=config_file; exit fi else compiler_name_ser=$compiler_name fi # PRAEPROZESSOR-OPTIONEN/DIREKTIVEN ERMITTELN line="" found=false grep "$remote_host_string" $config_file | grep "%cpp_options" > tmp_mbuild while read line1 do if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] then line="$line1" fi if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN cpp_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` found=true fi done < tmp_mbuild if [[ $found = false ]] then printf "\n +++ no preprocessor options found in configuration file" printf "\n for \"$remote_host_string\" " locat=config_file; exit fi # RECHNERSPEZIFISCHE CPP-DIREKTIVEN HINZUFUEGEN for string in $remote_host_string do if [[ $(echo $remote_host | cut -c1-2) = lc && $(echo $string | cut -c1-2) = lc ]] then cpp_options="$cpp_options -D__lc " elif [[ $(echo $remote_host | cut -c1-3) = ibm && $(echo $string | cut -c1-3) = ibm ]] then cpp_options="${cpp_options},-D__ibm" elif [[ $(echo $remote_host | cut -c1-3) = nec && $(echo $string | cut -c1-3) = nec ]] then cpp_options="${cpp_options} -D__nec" else if [[ $(echo $remote_host | cut -c1-3) = ibm ]] then cpp_options="${cpp_options},-D__$string" else cpp_options="$cpp_options -D__$string " fi fi done # NETCDF-OPTIONEN ERMITTELN line="" grep "$remote_host_string" $config_file | grep "%netcdf_inc" > tmp_mbuild while read line1 do if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] then line="$line1" fi if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN netcdf_inc=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` fi done < tmp_mbuild line="" grep "$remote_host_string" $config_file | grep "%netcdf_lib" > tmp_mbuild while read line1 do if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] then line="$line1" fi if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN netcdf_lib=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` fi done < tmp_mbuild # COMPILEROPTIONEN ERMITTELN line="" found=false grep "$remote_host_string" $config_file | grep "%fopts" > tmp_mbuild while read line1 do if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] then line="$line1" fi if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN compiler_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` found=true # NETCDF-INCLUDEVERZEICHNIS HINZUFUEGEN compiler_options="$compiler_options $netcdf_inc" fi done < tmp_mbuild if [[ $found = false ]] then printf "\n +++ no compiler options found in configuration file" printf "\n for \"$remote_host_string\" " locat=config_file; exit fi # LADER-OPTIONEN ERMITTELN line="" found=false grep "$remote_host_string" $config_file | grep "%lopts" > tmp_mbuild while read line1 do if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] then line="$line1" fi if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] then # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN loader_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` found=true # NETCDF-LIBRARY HINZUFUEGEN loader_options="$loader_options $netcdf_lib" fi done < tmp_mbuild if [[ $found = false ]] then printf "\n +++ no loader options found in configuration file" printf "\n for \"$remote_host_string\" " locat=config_file; exit fi printf "\n\n#------------------------------------------------------------------------# \n" if [[ $remote_host = $local_host ]] then column1="remote_host:"; column2="$remote_host (= local host!)" else column1="remote_host:"; column2=$remote_host fi printf "| $column1$column2 | \n" printf "| | \n" column1="conditions:"; column2="$condition1 $condition2" printf "| $column1$column2 | \n" column1="make depository:"; column2=$remote_md printf "| $column1$column2 | \n" if [[ $compile_utility_programs = true ]] then column1="utility directory:"; column2=$remote_ud printf "| $column1$column2 | \n" fi column1="username:"; column2=$remote_username printf "| $column1$column2 | \n" column1="addres:"; column2=$remote_addres printf "| $column1$column2 | \n" column1="compiler:"; column2=$compiler_name printf "| $column1$column2 | \n" if [[ $compile_utility_programs = true ]] then column1="serial compiler:"; column2=$compiler_name_ser printf "| $column1$column2 | \n" fi column1="cpp options:"; column2=$cpp_options printf "| $column1$column2 | \n" line=$(echo "$cpp_options" | cut -c51-) while [[ "$line" != "" ]] do column1="" column2=$line printf "| $column1$column2 | \n" line=$(echo "$line" | cut -c51-) done column1="compiler options:"; column2=$compiler_options printf "| $column1$column2 | \n" line=$(echo "$compiler_options" | cut -c51-) while [[ "$line" != "" ]] do column1="" column2=$line printf "| $column1$column2 | \n" line=$(echo "$line" | cut -c51-) done column1="loader options:"; column2=$loader_options printf "| $column1$column2 | \n" line=$(echo "$loader_options" | cut -c51-) while [[ "$line" != "" ]] do column1="" column2=$line printf "| $column1$column2 | \n" line=$(echo "$line" | cut -c51-) done printf "#------------------------------------------------------------------------# \n" if [[ $silent = false ]] then answer=dummy printf "\n\n" while [[ "$answer" != y && "$answer" != Y && "$answer" != c && "$answer" != C && "$answer" != s && "$answer" != S && "$answer" != a && "$answer" != A ]] do printf " >>> continue (y(es)/c(ontinue)/a(bort)/s(skip)) ? " read answer done if [[ $answer = a || $answer = A ]] then locat=user_abort; exit fi if [[ $answer = c || $answer = C ]] then silent=false fi if [[ $answer = s || $answer = S ]] then continue fi fi if [[ $remote_mode = batch ]] then # BATCH-JOB PARAMETER SETZEN case $remote_host in (t3eb) queue=berte; memory=60; cputime=1000; xoption="-X 0";; (t3eh) queue=comp_t3e; memory=60; cputime=360;; (t3ej2) queue=normal; memory=60; cputime=1000; xoption="-X 0";; (t3ej5|ground.yonsei.ac.kr) printf "\n --- remote host \"$remote_host\" does not allow batch jobs"; continue;; esac # BATCH-JOB ZUSAMMENSTELLEN printf "\n *** creating batch-job for remote host" echo " " > mbuild_job # AUF CRAY-RECHNERN IN JUELICH WIRD KEIN BENUTZER-PROFILE AUSGEFUEHRT # DIES WIRD HIER GETAN, UM PFADE USW. ZU SETZEN if [[ $remote_host = t3ej2 ]] then echo "set +vx" >> mbuild_job echo ". .profile" >> mbuild_job echo "set -x" >> mbuild_job fi # AUF CRAY-RECHNERN GELADENE MODULE AUFLISTEN if [[ $host = t3eb || $host = t3eh || $host = t3ej2 ]] then echo "module list" >> mbuild_job fi # WECHSEL IN TEMPORAERES VERZEICHNIS echo "cd ${remote_md}" >> mbuild_job # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN echo "scp ${local_username}@${local_addres}:~/modell/code_3dp/palm_current_version/${mainprog}_sources.tar ${mainprog}_sources.tar" >> mbuild_job # echo "[[ \$? != 0 ]] && (echo "+++ scp failed"; exit)" >> mbuild_job # FALLS VORHANDEN, LETZTE VERSION AUF DEM REMOTE-RECHNER AUSPACKEN echo "[[ -f ${mainprog}_current_version.tar ]] && tar -xvf ${mainprog}_current_version.tar" >> mbuild_job # AKTUELLE QUELLTEXTVERSION AUF REMOTE-RECHNER AUSPACKEN echo "tar -xvf ${mainprog}_sources.tar" >> mbuild_job # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN echo "make PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " >> mbuild_job echo "chmod u+w *" >> mbuild_job # NEUE VERSION AUF REMOTE-RECHNER ZUSAMMENPACKEN echo "tar -cvf ${mainprog}_current_version.tar *.f90 *.o" >> mbuild_job # AKTUELLES VERSIONSVERZEICHNIS AUF REMOTE-RECHNER BEREINIGEN echo "make clean" >> mbuild_job echo "rm ${mainprog}_sources.tar" >> mbuild_job echo "rm *.f90 Makefile" >> mbuild_job # JOB MITTELS SUBJOB STARTEN printf "\n *** sending batch job to remote host" # subjob $xoption -h $remote_host -q $queue -m $memory -t $cputime -v mbuild_job # JOBFILE LOESCHEN # rm aljob else if [[ $remote_host != $local_host ]] then if [[ $compile_utility_programs = false ]] then # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN # FALLS DIESES NOCH NICHT EXISTIERT, WIRD ES ERZEUGT echo " *** copying \"${mainprog}_sources.tar\" to \"${remote_addres}:${remote_md}/\" " if [[ $remote_host != lctit ]] then ssh ${remote_username}@${remote_addres} "[[ ! -d ${remote_md} ]] && (echo \" *** ${remote_md} will be created\"; mkdir -p ${remote_md})" else # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS # MIT SSH, DESHALB AUFRUF PER PIPE print "[[ ! -d ${remote_md} ]] && (echo \" *** ${remote_md} will be created\"; mkdir -p ${remote_md})" | ssh ${remote_username}@${remote_addres} 2>&1 fi if [[ $local_host = decalpha ]] then # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTÄNDIGEN PFADES # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN remote_md=`echo $remote_md | sed 's/\$HOME\///'` /bin/scp ${mainprog}_sources.tar ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar else scp ${mainprog}_sources.tar ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar fi # FALLS VORHANDEN, LETZTE VERSION AUF DEM REMOTE-RECHNER AUSPACKEN echo " *** untar previous update on remote host, if existing" if [[ $remote_host != lctit ]] then ssh ${remote_username}@${remote_addres} "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]] && tar -xf ${mainprog}_current_version.tar" else # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS # MIT SSH, DESHALB AUFRUF PER PIPE print "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]] && tar -xf ${mainprog}_current_version.tar" | ssh ${remote_username}@${remote_addres} 2>&1 fi # AKTUELLE QUELLTEXTVERSION AUF REMOTE-RECHNER AUSPACKEN echo " *** untar actual sources on remote host" if [[ $remote_host != lctit ]] then ssh ${remote_username}@${remote_addres} "cd ${remote_md}; tar -xf ${mainprog}_sources.tar" else # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS # MIT SSH, DESHALB AUFRUF PER PIPE print "cd ${remote_md}; tar -xf ${mainprog}_sources.tar" | ssh ${remote_username}@${remote_addres} 2>&1 fi # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN # KOMMANDOUEBERGABE AN SSH PER PIPE, DA SO DIE SYSTEM- UND # BENUTZERPROFILE VOLLSTAENDIG AUSGEFUEHRT WERDEN (SONST FEHLEN MAKE # Z.B. DIE PFADE ZUM COMPILER) echo " *** execute \"make\" on remote host" if [[ $remote_host = nech ]] then make_call_string="sxmake PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " else make_call_string="make PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " fi if [[ $remote_host = t3eh ]] then print "xterm\nexit\n cd ${remote_md}; make PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll elif [[ $remote_host = t3ej2 || $remote_host = ibms || $remote_host = ibmy ]] then ssh ${remote_username}@${remote_addres} "cd ${remote_md}; echo '$make_call_string' > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" 2>&1 | tee ${remote_host}_last_make_protokoll elif [[ $remote_host = ibmb || $remote_host = ibmh ]] then print "export OBJECT_MODE=64; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll elif [[ $remote_host = lctit ]] then echo " " > ${remote_host}_last_make_protokoll while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]] do print "cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll done else print "cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll fi if [[ $(grep -c MAKE_ERROR ${remote_host}_last_make_protokoll) != 0 ]] then printf "\a\n +++ error(s) occurred during compiling or linking on host \"$remote_host\" " if [[ $silent = false ]] then answer=dummy printf "\n" while [[ "$answer" != c && "$answer" != k ]] do printf " >>> continue / list errors / kill mbuild (c/l/k) ? " read answer if [[ "$answer" = l ]] then more ${remote_host}_last_make_protokoll fi done if [[ $answer = k ]] then locat=user_abort; exit fi fi fi # NEUE VERSION AUF REMOTE-RECHNER ZUSAMMENPACKEN printf "\n *** tar update on remote host ..." if [[ $remote_host != lctit ]] then ssh ${remote_username}@${remote_addres} "cd ${remote_md}; chmod u+w *; tar -cf ${mainprog}_current_version.tar *.f90 *.o *.mod" else # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS # MIT SSH, DESHALB AUFRUF PER PIPE print "cd ${remote_md}; chmod u+w *; tar -cf ${mainprog}_current_version.tar *.f90 *.o *.mod" | ssh ${remote_username}@${remote_addres} 2>&1 fi # AKTUELLES VERSIONSVERZEICHNIS AUF REMOTE-RECHNER BEREINIGEN # printf "\n *** \"make clean\" on remote host ..." # ssh ${remote_username}@${remote_addres} "cd ${remote_md}; make clean; rm ${mainprog}_sources.tar; rm *.f90 Makefile" # printf "\n" # GLEICHE AKTIONEN FUER DIE UTILITY-PROGRAMME DURCHFUEHREN # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN # FALLS DIESES NOCH NICHT EXISTIERT, WIRD ES ERZEUGT elif [[ $compile_utility_programs = true ]] then printf "\n\n" echo " *** copying scripts and utility programs to \"${remote_addres}:${remote_ud}/\" " cd ${local_source_path}/../SCRIPTS if [[ $remote_host != lctit ]] then ssh ${remote_username}@${remote_addres} "[[ ! -d ${remote_ud} ]] && (echo \" *** ${remote_ud} will be created\"; mkdir -p ${remote_ud}); [[ ! -d ${remote_ud}/../SCRIPTS ]] && (echo \" *** ${remote_ud}/../SCRIPTS will be created\"; mkdir -p ${remote_ud}/../SCRIPTS)" else # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS # MIT SSH, DESHALB AUFRUF PER PIPE print "[[ ! -d ${remote_ud} ]] && (echo \" *** ${remote_ud} will be created\"; mkdir -p ${remote_ud}); [[ ! -d ${remote_ud}/../SCRIPTS ]] && (echo \" *** ${remote_ud}/../SCRIPTS will be created\"; mkdir -p ${remote_ud}/../SCRIPTS)" | ssh ${remote_username}@${remote_addres} 2>&1 fi # KOPIEREN DER SCRIPTE if [[ $local_host = decalpha ]] then # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTÄNDIGEN PFADES # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN remote_ud=`echo $remote_ud | sed 's/\$HOME\///'` /bin/scp batch_scp mbuild mrun subjob ${remote_username}@${remote_addres}:${remote_ud}/../SCRIPTS > /dev/null else scp batch_scp mbuild mrun subjob ${remote_username}@${remote_addres}:${remote_ud}/../SCRIPTS > /dev/null fi cd - > /dev/null cd ${local_source_path}/../UTIL # KOPIEREN DER UTILITY-PROGRAMME if [[ $local_host = decalpha ]] then # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTÄNDIGEN PFADES # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN remote_ud=`echo $remote_ud | sed 's/\$HOME\///'` /bin/scp Makefile *.f90 ${remote_username}@${remote_addres}:${remote_ud} > /dev/null else scp Makefile *.f90 ${remote_username}@${remote_addres}:${remote_ud} > /dev/null fi # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN # KOMMANDOUEBERGABE AN SSH PER PIPE, DA SO DIE SYSTEM- UND # BENUTZERPROFILE VOLLSTAENDIG AUSGEFUEHRT WERDEN (SONST FEHLEN MAKE # Z.B. DIE PFADE ZUM COMPILER) echo " *** execute \"make\" on remote host" if [[ $remote_host = nech ]] then make_call_string="sxmake F90=$compiler_name F90_SER=$compiler_name_ser COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " else make_call_string="make F90=$compiler_name F90_SER=$compiler_name_ser COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " fi if [[ $remote_host = ibms || $remote_host = ibmy ]] then ssh ${remote_username}@${remote_addres} "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" elif [[ $remote_host = ibmb || $remote_host = ibmh ]] then print "export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} elif [[ $remote_host = lctit ]] then echo " " > ${remote_host}_last_make_protokoll while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]] do print "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll done else print "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll fi fi # ENDE UEBERSETZUNG DER UTILITY-PROGRAMME rm -rf ${remote_host}_last_make_protokoll # NUR AUF EINEM HLRN-RECHNER UEBERSETZEN [[ $remote_host = ibmb || $remote_host = ibmh ]] && ibm_hb_done=true else if [[ $compile_utility_programs = false ]] then # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF LOKALEM RECHNER AUSFUEHREN echo " " echo " *** execute \"make\" on local host" make PROG=$mainprog F90=$compiler_name COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$loader_options" 2>&1 | tee ${remote_host}_last_make_protokoll if [[ $? != 0 ]] then printf "\a\n +++ error(s) occurred during compiling or linking on host \"$remote_host\" " if [[ $silent = false ]] then answer=dummy printf "\n" while [[ "$answer" != c && "$answer" != k ]] do printf " >>> continue / list errors / kill mbuild (c/l/k) ? " read answer if [[ "$answer" = l ]] then more ${remote_host}_last_make_protokoll fi done if [[ $answer = k ]] then locat=user_abort; exit fi fi fi # NEUE VERSION AUF LOKALEM RECHNER ZUSAMMENPACKEN printf "\n *** tar update on local host ..." tar -cf ${mainprog}_current_version.tar *.$suf *.o *.mod # COMPILE THE UTILITY PROGRAMS elif [[ $compile_utility_programs = true ]] then printf "\n\n" echo " *** compiling the utility programs ..." cd ${local_source_path}/../UTIL make F90=$compiler_name F90_SER=$compiler_name_ser COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$loader_options" cd - > /dev/null fi # NUR EINMAL AUF LCMUK UEBERSETZEN [[ $remote_host = lcmuk ]] && lcmuk_done=true fi fi done if [[ $host_found = false ]] then if [[ $host = all ]] then printf "\n +++ no hosts found in configuration file" else printf "\n +++ host \"$host\" not found in configuration file" fi locat=config_file; exit fi # ABSCHLIESSENDE ARBEITEN rm -f hosts_found_in_config_file