#!/bin/ksh # -------------------------------------------------------------------- # buildmain: # patchy step to extract main and user code for the batch version # # -------------------------------------------------------------------- cmd=`basename $0` usage="usage: $cmd [-indgh] CarFile " debug=0 version='pro' interactive=0 graphics=0 allopt=$@ while getopts inhgd xopt ; do case $xopt in n) version='dev' ;; i) interactive=1 ;; d) debug=1 ;; g) graphics=1 ;; h) # help message: echo $cmd script makes the main program fortran file from the echo ".car" file given as argument according to the patchy echo cradle which is contained within the script. echo echo 'The cradle specifies the FLAGS and PATCHES for ypatchy.' echo 'It is possible to force the loading of the DEV version ' echo 'explicitely by specifying the "n" option switch. ' echo echo 'The fortran file and its object file are written in the' echo '"exe" directory.' echo 'The "CarFile" argument should be the file name only, ' echo 'excluding the directory path.' echo echo 'Switches -optional:' echo '-h prints this help message' echo '-n use the "dev" path for CAR file search (default: pro)' echo '-d turns ON the debug compiler option' echo '-g turns ON the graphics DISPLAY patchy flag' echo '-i selects the interactive main program (default is batch)' echo --------------------------------------------------------------- echo $usage exit 9;; \?) echo unknown option $xopt; echo $usage; exit 9;; esac done shift `expr $OPTIND - 1 ` if [ $# -le 0 ]; then echo file argument missing echo $usage exit 9 fi OPSYS=${OPSYS:=`uname`} # carfile=`basename $1 .car` # # set defaults to hpux objdir='hpux' patchyflag='hpux' f77_opt="+es -c -O -K +ppu +e +T " if [ $debug = 1 ] ; then f77_opt="+es -c -O -K +ppu +e +T -g " ; fi if [ ${OPSYS} = 'AIX' ] ; then f77_opt="-c -qextname -w " if [ $debug = 1 ] ; then f77_opt="-c -qextname -w -g " ; fi patchyflag='aix' objdir='aix' fi if [ ${OPSYS} = 'Linux' ] ; then f77_opt="-c " if [ $debug = 1 ] ; then f77_opt="-c -g " ; fi patchyflag='PClinux' objdir='PClinux' fi if [ ${OPSYS} = 'OSF1' ] ; then f77_opt="-c " if [ $debug = 1 ] ; then f77_opt="-c -g " ; fi patchyflag='Alpha' objdir='Alpha' fi USER=${USER:=`whoami`} log=`date`" $USER $cmd $allopt" echo $log echo " operating system: " $OPSYS # mainflag='batch' mainprog='diracb' debugflag='nodebug' graphicsflag='nodisplay' grafdummies='DUMMIES' if [ $debug = 1 ] ; then debugflag='debug' ; fi if [ $interactive = 1 ] ; then mainflag='interactive' mainprog='diraci' if [ $graphics = 1 ] ; then graphicsflag='DISPLAY' grafdummies='nodummies' fi fi echo "patchyflag= " $patchyflag $debugflag $graphicsflag $grafdummies echo "compiler options: " $f77_opt echo "program version : " $version echo "main orogram name: " $mainprog $mainflag # wdir="/afs/cern.ch/user/d/diracww/public/offline/ariane/${version}" cd ${wdir} echo "working directory: " $wdir exedir=${wdir}/exe exeobjdir=${wdir}/exe/${objdir} if [ -d ${exeobjdir} ]; then echo "EXE-OBJ=DIR: ${exeobjdir} Exists " else echo "EXE-OBJ=DIR: ${exeobjdir} will be created" mkdir ${exeobjdir}; fi cd ${exedir}/${objdir} if [ -f ${mainprog}.f.bak ]; then rm ${mainprog}.f.bak ; fi if [ -f ${mainprog}.f ]; then mv ${mainprog}.f ${mainprog}.f.bak ; fi # cd ${wdir}/car nypatchy <<! - ${exedir}/${objdir}/${mainprog}.f tty tty - - - - .go +exe. +use,cdes. +use,cdedatabase. +use,trcdes. +use,type. +use,$patchyflag. +use,unix. +use,p=Header. +use,$mainflag. +use,$debugflag. +use,$graphicsflag. +use,p=$grafdummies,t=exe. +use, p=DiracMain,t=exe. +use, p=USERCODE,d=UserAction,t=exe. +pam,12,t=attach,t=cards. $carfile +quit ! # cd ${exedir}/${objdir} f77 $f77_opt ${mainprog}.f