#!/bin/ksh # -------------------------------------------------------------------- # buildexe: link objects and libraries and build executable module # -------------------------------------------------------------------- cmd=`basename $0` usage="usage: $cmd [-nigph] Libname" version='pro' main='diracb' graphics=0 pool=0 graf=' ' glibs=' ' mode=0 exten='exe' allopt=$@ while getopts nigph xopt ; do case $xopt in n) version='dev';; i) mode=1 ;; g) graphics=1 ;; p) pool=1 ;; h) # help message: echo $cmd script makes an executable module with the echo library ".a" file whose base name is given as argument echo and the main program ".o" file. echo echo 'The DEV version can be chosen by specifying ' echo 'the "n" option switch (default is PRO). ' echo echo 'The executable module is written in the "exe" directory ' echo 'with basename set to the Libname and ".exe" extension. ' echo echo 'The "Libname" argument should be the file name only,' echo 'excluding the directory path and extensions.' echo echo 'Switches -optional:' echo '-h prints this help message' echo '-n use the "dev" path for file search (default pro)' echo '-i use the interactive main program (default is batch)' echo '-g links with the graphics library' echo '-p links the special "daq pool" interface' echo ------------------------------------------------------------------------ echo $usage exit 9;; \?) echo unknown option $xopt; echo $usage; exit 9;; esac done shift `expr $OPTIND - 1 ` if [ $# -le 0 ]; then echo lib name argument missing echo $usage exit 9 fi OPSYS=${OPSYS:=`uname`} # libfile=`basename $1 .a` # # set defaults to hpux objdir='hpux' link='fort77' if [ ${OPSYS} = 'AIX' ] ; then objdir='aix' link='xlf' fi if [ ${OPSYS} = 'Linux' ] ; then objdir='PClinux' link='g77' fi if [ ${OPSYS} = 'OSF1' ] ; then objdir='Alpha' link='f77' fi echo " operating system: " $OPSYS echo "program version : " $version wdir="/afs/cern.ch/user/d/diracww/public/offline/ariane/${version}" exedir=${wdir}/exe/${objdir} libdir=${wdir}/lib/${objdir} libs="${libdir}/${libfile}.a" echo directories echo " working directory : " ${wdir} echo " exe directory : " ${exedir} echo " lib directory : " ${libdir} if [ $mode = 1 ] ; then exten='exeI' main='diraci' fi if [ $graphics = 1 ] ; then glibs="${libdir}/graf.a" graf='graflib' exten='exeGI' main='diraci' fi echo " libs = " $libs echo "glibs = " $glibs # work in the exe dir cd $exedir mainprog="${main}.o" echo "mainprog" $mainprog if [ ${OPSYS} = 'AIX' ] ; then $link -o ${libfile}.${exten} \ ${mainprog} $glibs \ $libs \ `cernlib $graf` fi if [ ${OPSYS} = 'HP-UX' ] ; then $link -o ${libfile}.${exten} \ ${mainprog} $glibs \ $libs \ `cernlib $graf` fi if [ ${OPSYS} = 'Linux' ] ; then if [ $pool = 1 ] ; then mainprog="${main}.o ${libdir}/pool.o /home/daq/lib/daqlog.o /home/daq/lib/filepool.o /home/daq/lib/libupool.a" echo "mainprog" $mainprog fi $link -o $libfile.${exten} \ ${mainprog} $glibs \ ${libs} \ `cernlib $graf ` fi if [ ${OPSYS} = 'OSF1' ] ; then $link -o $libfile.${exten} \ ${mainprog} $glibs \ $LIB321 -lm \ $libdir/${libfile}.a \ `cernlib` fi chmod +x $libfile.${exten}