#!/bin/csh -f #----------------------------------------------------------------------# # - FLINK - # # This script is the universal link script for all NA44 programs. It # # is based on an earlier VMS script, and lived for a long time in # # LANL HP flavor only. # # Substantially rewritten Feb 96 to accomodate the Cern HP and IBM # # mixed cluster, and the Nevis SGI. 12 Feb 96 HvH # # Updated for the new directory structure 27 Mar 96 HvH # #----------------------------------------------------------------------# if ($1 == 'help') then echo " " echo " The flink command takes as input a copmiled source (*.o), usually " echo " produced by CMZ. " echo " There are 1 mandatory and 4 optional arguments. The arguments have" echo " fixed places; if you want to skip one, use 2 double quotes or " echo " a period . in its place. +------------------------------+" echo " | version of 27 Mar 96 - HvH |" echo " The arguments are: +------------------------------+" echo " 1) the name of the user task (without extension) " echo " example: flink myjob " echo " 2) debug or nodebug " echo " No debug if this argument is missing or skipped " echo " example: flink myjob debug " echo " 3) cleanup or nocleanup " echo " Clean up intermediate files. Works same ad the debug switch. " echo " example: flink myjob . nocleanup " echo " 4) Private library. If this argument is given, a library with " echo " with the given name is linked " echo " example: flink myjob . . mylib " echo " 5) Main program. This argument tells the linker which main program" echo " to get from the NA44 library. It defaults to HFMAIN. If you " echo " have a main program in your CMZ file, the argument should " echo " be 'none'. Examples: " echo " flink myjob Get main HFMAIN from library " echo " flink myjob . . . dbtools Get main DBTOOLS from library " echo " flink myjob . . . none main program is in CMZ file. " echo " " exit endif #======================================================================# # *** general header *** echo " +---------------------------------------------------+ " echo " | LINK CMZ TASKS | " if ($BINTYPE == 'AIX' || $BINTYPE == 'SGI') then echo " | IN THE NA44 $NA44VSN $BINTYPE ENVIRONMENT |" else if ( $BINTYPE == 'HPUX' ) then echo " | IN THE NA44 $NA44VSN $BINTYPE ENVIRONMENT |" else if ( $BINTYPE == 'HP-UX' ) then echo " | IN THE NA44 $NA44VSN $BINTYPE ENVIRONMENT |" else echo " | system type unknown: $BINTYPE |" echo " +---------------------------------------------------+ " exit endif echo " | version of 27 Mar 96 10:29 | " echo " +---------------------------------------------------+ " echo " 1>> User task : "$1.o #======================================================================# # *** general switching: *** if ($BINTYPE == 'AIX') then set link='f77' set x11path='/usr/lib' else if ($BINTYPE == 'HP-UX') then set link='fort77' set x11path='/usr/lib/X11R5' else if ($BINTYPE == 'HPUX' ) then set link='fort77' set x11path='/usr/lib/X11R5' else if ($BINTYPE == 'SGI') then set link='f77' set x11path='/usr/lib' endif #======================================================================# # *** debug switching: *** if ($2 == '' || $2 == '.') then # no debug echo " 2>> Debug : off " set debug='' if ($BINTYPE == 'AIX') then set flags1=' -o' else if ($BINTYPE == 'HPUX' || $BINTYPE == 'HP-UX') then set flags1=' -lU77 -lcl -lc -o' else if ($BINTYPE == 'SGI') then set flags1=' -lU77 -lI77 -lF77 -lc -lm -ignore_unresolved -o' endif set crt='crt0' set debflag='_nodeb' set libloc="$FLIB/" else # debug echo " 2>> Debug : on " set debug='d' if ($BINTYPE == 'AIX') then set flags1='-o' else if ($BINTYPE == 'HPUX' || $BINTYPE == 'HP-UX') then set flags1=' /usr/lib/end.o -lU77 -lcl -lc -o' else if ($BINTYPE == 'SGI') then set flags1=' -lU77 -lI77 -lF77 -lc -lm -ignore_unresolved -o' else echo ' debug flags unknow -> abort. BINTYPE= ' $BINTYPE endif set crt='gcrt0' set debflag='_debug' set libloc="$FLIBD/" endif # nodebug/debug #======================================================================# # *** cleanup switching: *** echo " 3>> Cleanup : off " #======================================================================# # *** private lib switching: *** if ($4 == '' || $4 == '.' || $4 == 'none') then set privlib = ' ' echo " 4>> No private library will be linked " else set privlib = $4 echo " 4>> Private library will be linked: "$4 endif #======================================================================# # *** Compose the na44 lib name, appending the path, machine name # and the debug/nodebug flag setenv NA44LIB "$libloc"lib"$NA44VSN"_"$FMACHINE"$debflag.a #======================================================================# # *** 'main program' switching: *** if ($5 == '' || $5 == '.') then ar x $NA44LIB hfmain.o set main='hfmain.o' echo " 5>> Main program: "$main else if ( $5 == 'none') then set main=' ' echo " 5>> Main program assumed to be in user task " else set main=$5.o ar x $NA44LIB $main echo " 5>> Main program: "$main endif #======================================================================# # *** finally, link the whole mess: *** $link $main $1.o $privlib \ $NA44LIB \ -L $CERN_ROOT/lib/ \ -lpawlib -lgraflib -lgrafX11 -lpacklib -lkernlib -lmathlib \ -L $x11path -lX11 \ $libloc\libbufio_$FMACHINE.a \ $flags1 $1 #======================================================================# if ($3 != 'noclean') then # clean up intermediate files... endif chmod +x $1 echo " ... $1 is done." echo " "