/usr/bin/tau_compiler is in tau 2.17.3.1.dfsg-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 | #!/bin/bash
declare -i FALSE=-1
declare -i TRUE=1
declare -i groupType=0
declare -i group_f_F=1
declare -i group_c=2
declare -i group_C=3
declare -i disablePdtStep=$FALSE
declare -i hasAnOutputFile=$FALSE
declare -i fortranParserDefined=$FALSE
declare -i gfparseUsed=$FALSE
declare -i pdtUsed=$FALSE
declare -i isForCompilation=$FALSE
declare -i hasAnObjectOutputFile=$FALSE
declare -i hasMpi=$TRUE
declare -i needToCleanPdbInstFiles=$TRUE
declare -i pdbFileSpecified=$FALSE
declare -i optResetUsed=$FALSE
declare -i optDetectMemoryLeaks=$FALSE
declare -i isVerbose=$FALSE
declare -i isCXXUsedForC=$FALSE
declare -i isCurrentFileC=$FALSE
declare -i isDebug=$FALSE
#declare -i isDebug=$TRUE
#Set isDebug=$TRUE for printing debug messages.
declare -i opari=$FALSE
declare -i errorStatus=$FALSE
declare -i gotoNextStep=$TRUE
declare -i counter=0
declare -i errorStatus=0
declare -i numFiles=0
declare -i tempCounter=0
declare -i counterForOutput=-10
declare -i counterForOptions=0
declare -i temp=0
declare -i preprocess=$FALSE
declare -i revertOnError=$TRUE
declare -i revertForced=$FALSE
declare -i optShared=$FALSE
declare -i optCompInst=$FALSE
preprocessorOpts="-P -traditional-cpp"
printUsage () {
printf "Usage: tau_compiler.sh"
printf " -optVerbose\t\t\tTurn on verbose debugging message"
printf " -optDetectMemoryLeaks\t\tTrack mallocs/frees using TAU's memory wrapper"
printf " -optPdtDir=\"\"\t\t\tPDT architecture directory. Typically \$(PDTDIR)/\$(PDTARCHDIR)"
printf " -optPdtF95Opts=\"\"\t\tOptions for Fortran parser in PDT (f95parse)"
printf " -optPdtF95Reset=\"\"\t\tReset options to the Fortran parser to the given list"
printf " -optPdtCOpts=\"\"\t\tOptions for C parser in PDT (cparse). Typically \$(TAU_MPI_INCLUDE) \$(TAU_INCLUDE) \$(TAU_DEFS)"
printf " -optPdtCReset=\"\"\t\tReset options to the C parser to the given list"
printf " -optPdtCxxOpts=\"\"\t\tOptions for C++ parser in PDT (cxxparse). Typically \$(TAU_MPI_INCLUDE) \$(TAU_INCLUDE) \$(TAU_DEFS)"
printf " -optPdtCxxReset=\"\"\t\tReset options to the C++ parser to the given list"
printf " -optPdtF90Parser=\"\"\t\tSpecify a different Fortran parser. For e.g., f90parse instead of f95parse"
printf " -optPdtGnuFortranParser\tSpecify the GNU gfortran PDT parser gfparse instead of f95parse"
printf " -optPdtCleanscapeParser\tSpecify the Cleanscape Fortran parser"
printf " -optPdtUser=\"\"\t\tOptional arguments for parsing source code"
printf " -optTauInstr=\"\"\t\tSpecify location of tau_instrumentor. Typically \$(TAUROOT)/\$(CONFIG_ARCH)/bin/tau_instrumentor"
printf " -optPreProcess\t\tPreprocess the source code before parsing. Uses /usr/bin/cpp -P by default."
printf " -optCPP=\"\"\t\t\tSpecify an alternative preprocessor and pre-process the sources."
printf " -optCPPOpts=\"\"\t\tSpecify additional options to the C pre-processor."
printf " -optCPPReset=\"\"\t\tReset C preprocessor options to the specified list."
printf " -optTauSelectFile=\"\"\t\tSpecify selective instrumentation file for tau_instrumentor"
printf " -optPDBFile=\"\"\t\tSpecify PDB file for tau_instrumentor. Skips parsing stage."
printf " -optTau=\"\"\t\t\tSpecify options for tau_instrumentor"
printf " -optCompile=\"\"\t\tOptions passed to the compiler by the user."
printf " -optTauDefs=\"\"\t\tOptions passed to the compiler by TAU. Typically \$(TAU_DEFS)"
printf " -optTauIncludes=\"\"\t\tOptions passed to the compiler by TAU. Typically \$(TAU_MPI_INCLUDE) \$(TAU_INCLUDE)"
printf " -optIncludeMemory=\"\"\t\tFlags for replacement of malloc/free. Typically -I\$(TAU_DIR)/include/Memory"
printf " -optReset=\"\"\t\t\tReset options to the compiler to the given list"
printf " -optLinking=\"\"\t\tOptions passed to the linker. Typically \$(TAU_MPI_FLIBS) \$(TAU_LIBS) \$(TAU_CXXLIBS)"
printf " -optLinkReset=\"\"\t\tReset options to the linker to the given list"
printf " -optTauCC=\"<cc>\"\t\tSpecifies the C compiler used by TAU"
printf " -optTauUseCXXForC\t\tSpecifies the use of a C++ compiler for compiling C code"
printf " -optOpariTool=\"<path/opari>\"\tSpecifies the location of the Opari tool"
printf " -optOpariDir=\"<path>\"\t\tSpecifies the location of the Opari directory"
printf " -optOpariOpts=\"\"\t\tSpecifies optional arguments to the Opari tool"
printf " -optOpariReset=\"\"\t\tResets options passed to the Opari tool"
printf " -optNoMpi\t\t\tRemoves -l*mpi* libraries during linking (default)"
printf " -optMpi\t\t\tDoes not remove -l*mpi* libraries during linking"
printf " -optNoRevert\t\t\tExit on error. Does not revert to the original compilation rule on error."
printf " -optRevert\t\t\tRevert to the original compilation rule on error (default)."
printf " -optKeepFiles\t\t\tDoes not remove intermediate .pdb and .inst.* files"
printf " -optAppCC=\"<cc>\"\t\tSpecifies the fallback C compiler."
printf " -optAppCXX=\"<cxx>\"\t\tSpecifies the fallback C++ compiler."
printf " -optAppF90=\"<f90>\"\t\tSpecifies the fallback F90 compiler."
printf " -optShared\t\t\tUse shared library version of TAU."
printf " -optCompInst\t\t\tUse compiler-based instrumentation."
printf " -optPDTInst\t\t\tUse PDT-based instrumentation."
if [ $1 == 0 ]; then #Means there are no other option passed with the myscript. It is better to exit then.
exit
fi
}
# Assumption: pass only one argument. Concatenate them if there are multiple
echoIfVerbose () {
if [ $isDebug == $TRUE ] || [ $isVerbose == $TRUE ]; then
printf $1
fi
}
#Assumption: pass only one argument. Concatenate them if there are multiple
echoIfDebug () {
if [ $isDebug == $TRUE ]; then
printf $1
fi
}
printError() {
# This steps ensures that the final regular command is executed
errorStatus=$TRUE
# This steps ensures that all the intermediate steps are ignored
gotoNextStep=$FALSE
printf "Error: Command(Executable) is -- $1"
printf "Error: Full Command attempted is -- $2"
if [ $revertOnError == $TRUE ]; then
printf "Error: Reverting to a Regular Make"
fi
echo " "
}
evalWithDebugMessage() {
echoIfVerbose "\n\nDebug: $2"
echoIfVerbose "Executing> $1"
eval "$1"
# NEVER add additional statements below $1, users of this function need the return code ($?)
# echoIfVerbose "....."
}
if [ $isDebug == $TRUE ]; then
echoIfDebug "\nRunning in Debug Mode."
echoIfDebug "Set \$isDebug in the script to \$FALSE to switch off Debug Mode."
fi
# We grab the first argument and remember it as the compiler
# if the user doesn't specify a fallback compiler, we use it
foundFirstArg=0
compilerSpecified=""
#All the script options must be passed as -opt*
#including verbose option [as -optVerbose]. The reason being
#script assumes that all any tokens passed after -opt* sequenece
#constitute the regular command, with the first command (immediately)
#after the sequence, being the compiler. In this "for" loops, the
#regular command is being read.
for arg in "$@"; do
case $arg in
-opt*)
;;
*)
if [ $tempCounter == 0 ]; then
CMD=$arg
#The first command (immediately) after the -opt sequence is the compiler.
fi
# Thanks to Bernd Mohr for the following that handles quotes and spaces (see configure for explanation)
modarg=`echo "x$arg" | sed -e 's/^x//' -e 's/"/\\\"/g' -e s,\',%@%\',g -e 's/%@%/\\\/g' -e 's/ /\\\ /g' -e 's#(#\\\(#g' -e 's#)#\\\)#g'`
#modarg=`echo "x$arg" | sed -e 's/^x//' -e 's/"/\\\"/g' -e s,\',%@%\',g -e 's/%@%/\\\/g' -e 's/ /\\\ /g'`
THEARGS="$THEARGS $modarg"
if [ $foundFirstArg == 0 ]; then
foundFirstArg=1
compilerSpecified="$modarg"
else
regularCmd="$regularCmd $modarg"
fi
tempCounter=tempCounter+1
;;
esac
done
echoIfDebug "\nRegular command passed is -- $regularCmd ";
echoIfDebug "The compiler being read is $CMD \n"
####################################################################
# Initialize optOpariOpts
####################################################################
optOpariOpts="-nosrc -table opari.tab.c"
####################################################################
#Parsing all the Tokens of the Command passed
####################################################################
echoIfDebug "\nParsing all the arguments passed..."
tempCounter=0
processingIncludeOrDefine=false
processingIncludeOrDefineArg=""
for arg in "$@" ; do
tempCounter=tempCounter+1
echoIfDebug "Token No: $tempCounter) is -- $arg"
if [ $processingIncludeOrDefine = true ] ; then
# If there is a "-I /home/amorris", we now process the 2nd arg
# mod_arg=`echo "x$arg" | sed -e 's/^x//' -e 's/"/\\\"/g' -e 's/'\''/'\\\'\''/g' -e 's/ /\\\ /g'`
mod_arg=`echo "x$arg" | sed -e 's/^x//' -e 's/"/\\\"/g' -e s,\',%@%\',g -e 's/%@%/\\\/g' -e 's/ /\\\ /g' -e 's#(#\\\(#g' -e 's#)#\\\)#g'`
mod_arg="$processingIncludeOrDefineArg$mod_arg"
optPdtCFlags="$optPdtCFlags $mod_arg"
optPdtCxxFlags="$optPdtCxxFlags $mod_arg"
optPdtF95="$optPdtF95 $mod_arg"
optCompile="$optCompile $mod_arg"
optIncludeDefs="$optIncludeDefs $mod_arg"
processingIncludeOrDefine=false
else
case $arg in
--help|-h)
printUsage 0
;;
-opt*)
counterForOptions=counterForOptions+1
case $arg in
-optPreProcess)
preprocess=$TRUE
# if a preprocessor has not been specified yet, use
# the default C preprocessor
if [ "x$preprocessor" == "x" ]; then
preprocessor=/usr/bin/cpp
fi
if [ ! -x $preprocessor ]; then
preprocessor=`which cpp`
fi
if [ ! -x $preprocessor ]; then
echo "ERROR: No working cpp found in path. Please specify -optCPP=<full_path_to_cpp> and recompile"
fi
# Default options
echoIfDebug "\tPreprocessing turned on. preprocessor used is $preprocessor with options $preprocessorOpts"
;;
-optCPP=*)
preprocessor=${arg#"-optCPP="}
preprocess=$TRUE
echoIfDebug "\tPreprocessing $preprocess. preprocessor used is $preprocessor with options $preprocessorOpts"
;;
-optCPPOpts=*)
preprocessorOpts="$preprocessorOpts ${arg#"-optCPPOpts="}"
echoIfDebug "\tPreprocessing $preprocess. preprocessor used is $preprocessor with options $preprocessorOpts"
;;
-optCPPReset=*)
preprocessorOpts="${arg#"-optCPPReset="}"
echoIfDebug "\tPreprocessing $preprocess. preprocessor used is $preprocessor with options $preprocessorOpts"
;;
-optPdtF90Parser*)
#Assumption: This should be passed with complete path to the
#parser executable. However, if the path is defined in the
#enviroment, then it would work even if only the
#name of the parser executable is passed.
pdtParserF=${arg#"-optPdtF90Parser="}
echoIfDebug "\tF90Parser read is: $pdtParserF"
#if by mistake NULL is passed, or even simply
#few blank spaces are parsed (I have assumed 3), then
#it would be equivalent to not being defined
#at all. So the default f95parser would be invoked.
if [ ${#pdtParserF} -gt 4 ]; then
fortranParserDefined=$TRUE
fi
;;
-optPdtDir*)
optPdtDir=${arg#"-optPdtDir="}"/bin"
echoIfDebug "\tpdtDir read is: $optPdtDir"
if [ ! -d $optPdtDir ]; then
disablePdtStep=$TRUE
echoIfDebug "PDT is not configured."
else
pdtUsed=$TRUE
fi
;;
-optPdtGnuFortranParser*)
fortranParserDefined=$TRUE
pdtParserF="$optPdtDir""/gfparse"
gfparseUsed=$TRUE
;;
-optPdtCleanscapeParser*)
fortranParserDefined=$TRUE
pdtParserF="$optPdtDir""/f95parse"
gfparseUsed=$FALSE
;;
-optPdtF95Opts*)
#reads all the options needed for Parsing a Fortran file
#e.g ${FFLAGS}, ${FCPPFLAGS}. If one needs to pass any
#additional files for parsing, it can simply be appended before
#the flags.
#e.g. -optPdtF95Opts="${APP_DEFAULT_DIR}/{APP_LOCATION}/*.F90 ${FFLAGS}, ${FCPPFLAGS}.
#It is imperative that the additional files for parsing be kept
#before the flags.
optPdtF95="${arg#"-optPdtF95Opts="} $optPdtF95"
echoIfDebug "\tPDT Option for F90 is: $optPdtF95"
;;
-optTauInstr*)
optTauInstr=${arg#"-optTauInstr="}
echoIfDebug "\tTau Instrumentor is: $optTauInstr"
;;
-optTauCC*)
optTauCC=${arg#"-optTauCC="}
echoIfDebug "\tTau C Compiler is: $optTauCC"
;;
-optTauUseCXXForC*)
isCXXUsedForC=$TRUE
echoIfDebug "\tTau now uses a C++ compiler to compile C code isCXXUsedForC: $isCXXUsedForC"
;;
-optPdtCOpts*)
#Assumption: This reads ${CFLAGS}
optPdtCFlags="${arg#"-optPdtCOpts="} $optPdtCFlags"
echoIfDebug "\tCFLAGS is: $optPdtCFlags"
;;
-optPdtCxxOpts*)
#Assumption: This reads both ${CPPFLAGS}
optPdtCxxFlags="${arg#"-optPdtCxxOpts="} $optPdtCxxFlags"
echoIfDebug "\tCxxFLAGS is: $optPdtCxxFlags"
;;
-optPdtUser*)
#Assumption: This reads options, which would be passed
#at the parsing stage irrespective of the file type.
optPdtUser=${arg#"-optPdtUser="}
echoIfDebug "\tPDT User Option is: $optPdtUser"
;;
-optTauSelectFile*)
optTauSelectFile=${arg#"-optTauSelectFile="}
echoIfDebug "\tTauSelectFile is: "$optTauSelectFile
#Passing a blank file name with -f option would cause ERROR
#And so if it is blank, -f option should not be appended at the start.
#This is the reason, one cannot pass it as a generic optTau
#with -f selectFile. What if the selectFile is blank? An -f optoin
#without file would cause error. The reason I have kept 3 is
#becuase, it allows the users to pass 2 blank spaces and the name
#of a selectFile would (hopefully) be more than 2 characters.
if [ ${#optTauSelectFile} -lt 3 ]; then
optTauSelectFile=" "
else
optTauSelectFile=" -f "$optTauSelectFile
fi
;;
-optTau=*)
optTauInstrOpts=${arg#"-optTau="}
echoIfDebug "\tTau Options are: $optTau"
optTau="$optTauInstrOpts $optTau"
;;
-optLinking*)
optLinking="${arg#"-optLinking="} $optLinking"
echoIfDebug "\tLinking Options are: $optLinking"
;;
-optLinkReset*)
optLinking=${arg#"-optLinkReset="}
echoIfDebug "\tLinking Options are: $optLinking"
;;
-optTauDefs=*)
optTauDefs="${arg#"-optTauDefs="}"
echoIfDebug "\tCompiling Defines Options from TAU are: $optTauDefs"
echoIfDebug "\tFrom optTauDefs: $optTauDefs"
optDefs="$optDefs $optTauDefs"
;;
-optTauIncludes=*)
optTauIncludes="${arg#"-optTauIncludes="}"
echoIfDebug "\tCompiling Include Options from TAU are: $optTauIncludes"
echoIfDebug "\tFrom optTauIncludes: $optTauIncludes"
optIncludes="$optIncludes $optTauIncludes"
;;
-optIncludeMemory=*)
optIncludeMemory="${arg#"-optIncludeMemory="}"
echoIfDebug "\tCompiling Include Memory Options from TAU are: $optIncludeMemory"
echoIfDebug "\tFrom optIncludeMemory: $optIncludeMemory"
;;
-optDetectMemoryLeaks)
optDetectMemoryLeaks=$TRUE
optIncludes="$optIncludes $optIncludeMemory"
optTau="-memory $optTau"
echoIfDebug "\Including Memory directory for malloc/free replacement and calling tau_instrumentor with -memory"
echoIfDebug "\tFrom optIncludes: $optIncludes"
;;
-optCompile*)
optCompile="${arg#"-optCompile="} $optCompile"
echoIfDebug "\tCompiling Options are: $optCompile"
optIncludeDefs="${arg#"-optCompile="} $optIncludeDefs"
echoIfDebug "\tFrom optCompile: $optCompile"
;;
-optReset*)
optCompile=${arg#"-optReset="}
optIncludes=""
optDefs=""
echoIfDebug "\tCompiling Options are: $optCompile"
optResetUsed=$TRUE
;;
-optPDBFile*)
optPDBFile="${arg#"-optPDBFile="}"
pdbFileSpecified=$TRUE
echoIfDebug "\tPDB File used: $optPDBFile"
;;
-optPdtCReset*)
optPdtCFlags=${arg#"-optPdtCReset="}
echoIfDebug "\tParsing C Options are: $optPdtCFlags"
;;
-optPdtCxxReset*)
optPdtCxxFlags=${arg#"-optPdtCxxOptsReset="}
echoIfDebug "\tParsing Cxx Options are: $optPdtCxxFlags"
;;
-optPdtF95Reset*)
optPdtF95=${arg#"-optPdtF95Reset="}
echoIfDebug "\tParsing F95 Options are: $optPdtF95"
;;
-optVerbose*)
echoIfDebug "\tVerbose Option is being passed"
isVerbose=$TRUE
;;
-optQuiet)
echoIfDebug "\tQuiet Option is being passed"
isVerbose=$FALSE
;;
-optNoMpi*)
#By default this is true. When set to false, This option
#removes -l*mpi* options at the linking stage.
echoIfDebug "\tNo MPI Option is being passed"
hasMpi=$FALSE
;;
-optMpi*)
hasMpi=$TRUE
;;
-optNoRevert*)
revertOnError=$FALSE
;;
-optRevert*)
revertOnError=$TRUE
revertForced=$TRUE
;;
-optKeepFiles*)
#By default this is False.
#removes *.inst.* and *.pdb
echoIfDebug "\tOption to remove *.inst.* and *.pdb files being passed"
needToCleanPdbInstFiles=$FALSE
;;
-optOpariDir*)
optOpariDir="${arg#"-optOpariDir="}"
echoIfDebug "\tOpari Dir used: $optOpariDir"
;;
-optOpariTool*)
optOpariTool="${arg#"-optOpariTool="}"
echoIfDebug "\tOpari Tool used: $optOpariTool"
if [ "x$optOpariTool" == "x" ] ; then
opari=$FALSE
else
opari=$TRUE
fi
;;
-optOpariOpts*)
currentopt="${arg#"-optOpariOpts="}"
optOpariOpts="$currentopt $optOpariOpts"
echoIfDebug "\tOpari Opts used: $optOpariOpts"
;;
-optOpariReset*)
optOpariOpts="${arg#"-optOpariOpts="}"
echoIfDebug "\tOpari Tool used: $optOpariOpts"
;;
-optAppCC*)
optAppCC="${arg#"-optAppCC="}"
echoIfDebug "\tFallback C Compiler: $optAppCC"
;;
-optAppCXX*)
optAppCXX="${arg#"-optAppCXX="}"
echoIfDebug "\tFallback C++ Compiler: $optAppCXX"
;;
-optAppF90*)
optAppF90="${arg#"-optAppF90="}"
echoIfDebug "\tFallback Fortran Compiler: $optAppF90"
;;
-optSharedLinking*)
optSharedLinking="${arg#"-optSharedLinking="} $optSharedLinking"
echoIfDebug "\tShared Linking Options are: $optSharedLinking"
;;
-optSharedLinkReset*)
optSharedLinking=${arg#"-optSharedLinkReset="}
echoIfDebug "\tShared Linking Options are: $optSharedLinking"
;;
-optShared)
optShared=$TRUE
optLinking=$optSharedLinking
echoIfDebug "\tUsing shared library"
;;
-optCompInstOption=*)
optCompInstOption="${arg#"-optCompInstOption="}"
echoIfDebug "\tCompiler-based Instrumentation option is: $optCompInstOption"
;;
-optCompInstLinking=*)
optCompInstLinking="${arg#"-optCompInstLinking="}"
echoIfDebug "\tCompiler-based Instrumentation linking is: $optCompInstLinking"
;;
-optCompInst)
optCompInst=$TRUE
disablePdtStep=$TRUE
echoIfDebug "\tUsing Compiler-based Instrumentation"
;;
-optPDTInst)
optCompInst=$FALSE
disablePdtStep=$FALSE
echoIfDebug "\tUsing PDT-based Instrumentation"
;;
esac #end case for parsing script Options
;;
*.cc|*.CC|*.cpp|*.CPP|*.cxx|*.CXX|*.C)
fileName=$arg
arrFileName[$numFiles]=$arg
arrFileNameDirectory[$numFiles]=`dirname $arg`
numFiles=numFiles+1
pdtParserType=cxxparse
groupType=$group_C
;;
*.c)
fileName=$arg
arrFileName[$numFiles]=$arg
arrFileNameDirectory[$numFiles]=`dirname $arg`
numFiles=numFiles+1
if [ $isCXXUsedForC == $TRUE ]; then
pdtParserType=cxxparse
isCurrentFileC=$TRUE
groupType=$group_c
else
pdtParserType=cparse
groupType=$group_c
fi
;;
*.f|*.F|*.f90|*.F90|*.f77|*.F77|*.f95|*.F95)
fileName=$arg
arrFileName[$numFiles]=$arg
arrFileNameDirectory[$numFiles]=`dirname $arg`
numFiles=numFiles+1
if [ $fortranParserDefined == $FALSE ]; then
#If it is not passed EXPLICITY, use the default gfparse.
pdtParserF="$optPdtDir""/gfparse"
fi
echoIfDebug "Using Fortran Parser"
if [ $optResetUsed == $FALSE ]; then
#optCompile="`echo $optCompile | sed -e 's/ -D[^ ]*//g'`"
#echoIfDebug "Resetting optCompile (removing -D* ): $optCompile"
#optCompile="`echo $optCompile | sed -e 's/ -[^I][^ ]*//g'`"
echoIfDebug "Keeping optCompile as it is: $optCompile"
# Do not remove anything! Let TAU pass in -optCompile that we ignore
fi
groupType=$group_f_F
;;
-WF,-D*)
theDefine=${arg#"-WF,"}
theDefine=`echo "x$theDefine" | sed -e 's/^x//' -e 's/"/\\\"/g' -e 's/'\''/'\\\'\''/g' -e 's/ /\\\ /g'`
optPdtCFlags="$theDefine $optPdtCFlags"
optPdtCxxFlags="$theDefine $optPdtCxxFlags"
optPdtF95="$theDefine $optPdtF95"
mod_arg=`echo "x$arg" | sed -e 's/^x//' -e 's/"/\\\"/g' -e 's/'\''/'\\\'\''/g' -e 's/ /\\\ /g'`
optCompile="$mod_arg $optCompile"
optIncludeDefs="$theDefine $optIncludeDefs"
;;
-I|-D)
processingIncludeOrDefineArg=$arg
processingIncludeOrDefine=true
;;
-I*|-D*)
mod_arg=`echo "x$arg" | sed -e 's/^x//' -e 's/"/\\\"/g' -e s,\',%@%\',g -e 's/%@%/\\\/g' -e 's/ /\\\ /g' -e 's#(#\\\(#g' -e 's#)#\\\)#g'`
# mod_arg=`echo "x$arg" | sed -e 's/^x//' -e 's/"/\\\"/g' -e 's/'\''/'\\\'\''/g' -e 's/ /\\\ /g'`
optPdtCFlags="$optPdtCFlags $mod_arg"
optPdtCxxFlags="$optPdtCxxFlags $mod_arg"
optPdtF95="$optPdtF95 $mod_arg"
optCompile="$optCompile $mod_arg"
optIncludeDefs="$optIncludeDefs $mod_arg"
;;
-qfixed*)
optPdtF95="$optPdtF95 -R fixed"
argsRemaining="$argsRemaining $arg"
;;
-qfree*)
optPdtF95="$optPdtF95 -R free"
argsRemaining="$argsRemaining $arg"
;;
-c)
isForCompilation=$TRUE
argsRemaining="$argsRemaining $arg"
;;
-MM|-S|-E)
# We ignore -M processing step for making dependencies, -S for assembly
# and -E for preprocessing the source code. These are the options that are
# ignored by PDT. Add to this list if you need an additional option that should
# be ignored by the PDT step.
# echoIfDebug "tau_compiler.sh> Ignoring -M* compilation step for making dependencies"
disablePdtStep=$TRUE
gotoNextStep=$FALSE
errorStatus=$TRUE
;;
-o)
hasAnOutputFile=$TRUE
counterForOutput=$tempCounter
echoIfDebug "\tHas an output file"
#With compilation, a new output file is created and is written with -o
#options, so no need to append it to argsRemaining. WIth
#others it is simply added to the command.
#-o is added later
;;
-o*)
if [ "x$arg" != "x-openmp" -a "x$arg" != "x-override_limits" ]; then
hasAnOutputFile=$TRUE
passedOutputFile="${arg#"-o"}"
echoIfDebug "\tHas an output file = $passedOutputFile"
#With compilation, a new output file is created and is written with -o
#options, so no need to append it to argsRemaining. WIth
#others it is simply added to the command.
#-o is added later
else
argsRemaining="$argsRemaining ""$arg"
fi
;;
*.o)
objectOutputFile="$arg"
hasAnObjectOutputFile=$TRUE
listOfObjectFiles="$listOfObjectFiles $arg"
#List of object Files is simply passed
#at the linking stage. It is not
#processed anywhere.
temp=$counterForOutput+1
if [ $temp == $tempCounter ]; then
#Assumption: Executable/outputFile would appear immediately after -o option
passedOutputFile="$arg"
echoIfDebug "\tOutput file is $passedOutputFile"
fi
;;
$CMD)
;;
*)
temp=$counterForOutput+1
if [ $temp == $tempCounter ]; then
#Assumption: Executable/outputFile would appear immediately after -o option
passedOutputFile="$arg"
echoIfDebug "\tOutput file is $passedOutputFile"
else
argsRemaining="$argsRemaining ""$arg"
fi
;;
esac
fi
done
echoIfDebug "Number of files: $numFiles; File Group is $groupType"
if [ $counterForOptions == 0 ]; then
printUsage $tempCounter
fi
if [ $opari == $TRUE ]; then
echoIfDebug "Opari is on!"
optPdtCxxFlags="$optPdtCxxFlags -D_OPENMP"
optPdtCFlags="$optPdtCFlags -D_OPENMP"
else
echoIfDebug "Opari is off!"
fi
tempCounter=0
while [ $tempCounter -lt $numFiles ]; do
# Here arrays holding sourcefiles, .inst. and .pdb files
# are created based on the baseName of the source file.
echoIfDebug "FileName: ${arrFileName[$tempCounter]}"
base=`echo ${arrFileName[$tempCounter]} | sed -e 's/\.[^\.]*$//' -e's/.*\///'`
# this transforms /this/file\ name/has/spaces/ver1.0.2/foo.pp.F90 to foo.pp for base
suf=`echo ${arrFileName[$tempCounter]} | sed -e 's/.*\./\./' `
# suf gets .F90 in the example above.
#echoIfDebug "suffix here is -- $suf"
# If we need to pre-process the source code, we should do so here!
if [ $preprocess = $TRUE -a $groupType == $group_f_F ]; then
base=${base}.pp
cmdToExecute="${preprocessor} $preprocessorOpts $optTauIncludes $optIncludeDefs ${arrFileName[$tempCounter]} $base$suf"
evalWithDebugMessage "$cmdToExecute" "Preprocessing"
if [ ! -f $base$suf ]; then
echoIfVerbose "ERROR: Did not generate .pp file"
printError "$preprocessor" "$cmdToExecute"
fi
arrFileName[$tempCounter]=$base$suf
echoIfDebug "Completed Preprocessing\n"
fi
# Before we pass it to Opari for OpenMP instrumentation
# we should use tau_ompcheck to verify that OpenMP constructs are
# used correctly.
if [ $opari == $TRUE -a $pdtUsed == $TRUE ]; then
case $groupType in
$group_f_F)
pdtParserCmd="$pdtParserF ${arrFileName[$tempCounter]} $optPdtUser ${optPdtF95} $optIncludes"
;;
$group_c)
pdtParserCmd="$optPdtDir/$pdtParserType ${arrFileName[$tempCounter]} $optPdtCFlags $optPdtUser $optDefines $optIncludes"
;;
$group_C)
pdtParserCmd="$optPdtDir/$pdtParserType ${arrFileName[$tempCounter]} $optPdtCxxFlags $optPdtUser $optDefines $optIncludes"
;;
esac
evalWithDebugMessage "$pdtParserCmd" "Parsing with PDT for OpenMP directives verification:"
pdbcommentCmd="$optPdtDir/pdbcomment -o ${base}.comment.pdb ${base}.pdb"
evalWithDebugMessage "$pdbcommentCmd" "Using pdbcomment:"
ompcheck=`echo $optTauInstr | sed -e 's@tau_instrumentor@tau_ompcheck@'`
ompcheckCmd="$ompcheck ${base}.comment.pdb ${arrFileName[$tempCounter]} -o ${base}.chk${suf}"
arrFileName[$tempCounter]=$base.chk$suf
base=${base}.chk
evalWithDebugMessage "$ompcheckCmd" "Using tau_ompcheck:"
fi
# And then pass it on to opari for OpenMP programs.
if [ $opari = $TRUE ]; then
base=${base}.pomp
cmdToExecute="${optOpariTool} $optOpariOpts ${arrFileName[$tempCounter]} $base$suf"
evalWithDebugMessage "$cmdToExecute" "Parsing with Opari"
if [ ! -f $base$suf ]; then
echoIfVerbose "ERROR: Did not generate .pomp file"
printError "$optOpariTool" "$cmdToExecute"
fi
arrFileName[$tempCounter]=$base$suf
fi
if [ $optCompInst == $FALSE ] ; then
newFile=${base}.inst${suf}
else
newFile=${base}${suf}
fi
arrTau[$tempCounter]="${OUTPUTARGSFORTAU}${newFile}"
arrPdbForTau[$tempCounter]="${PDBARGSFORTAU}${newFile}"
if [ $pdbFileSpecified == $FALSE ]; then
newFile=${base}.pdb
if [ $isCXXUsedForC == $TRUE -a $isCurrentFileC == $TRUE ]; then
#newFile=${base}.c.pdb
newFile=${arrFileName[$tempCounter]}.pdb
isCurrentFileC=$FALSE
fi
else
newFile=$optPDBFile;
fi
arrPdb[$tempCounter]="${PDBARGSFORTAU}${newFile}"
tempCounter=tempCounter+1
done
echoIfDebug "Completed Parsing\n"
if [ $optCompInst == $TRUE ]; then
echoIfVerbose "Debug: Using compiler-based instrumentation"
if [ "x$optCompInstOption" = x ] ; then
echo "Error: Compiler instrumentation with this compiler not supported, remove -optCompInst"
exit 1
fi
argsRemaining="$argsRemaining $optCompInstOption"
# optLinking="$optLinking $optCompInstLinking"
fi
####################################################################
# Linking if there are no Source Files passed.
####################################################################
if [ $numFiles == 0 ]; then
echoIfDebug "The number of source files is zero"
#The reason why regularCmd is modified is because sometimes, we have cases
#like linking of instrumented object files, which require
#TAU_LIBS. Now, since object files have no files of types
#*.c, *.cpp or *.F or *.F90 [basically source files]. Hence
#the script understands that there is nothing to compile so
#it simply carries out the current linking. Compilation steps are
#avoided by assinging a status of $FALSE to the $gotoNextStep.
if [ $hasMpi == $FALSE ]; then
echoIfDebug "Before filtering -l*mpi* options command is: $regularCmd"
regularCmd=`echo "$regularCmd" | sed -e 's/-l[a-zA-Z0-9]*mpi[a-zA-Z.0-9+_]*//g'`
echoIfDebug "After filtering -l*mpi* options command is: $regularCmd"
fi
if [ $hasAnOutputFile == $FALSE ]; then
passedOutputFile="a.out"
linkCmd="$compilerSpecified $regularCmd $optLinking -o $passedOutputFile"
else
linkCmd="$compilerSpecified $regularCmd $optLinking"
#Do not add -o, since the regular command has it already.
fi
if [ $opari == $TRUE ]; then
evalWithDebugMessage "/bin/rm -f opari.rc" "Removing opari.rc"
cmdCompileOpariTab="${optTauCC} -c ${optIncludeDefs} ${optIncludes} ${optDefs} opari.tab.c"
evalWithDebugMessage "$cmdCompileOpariTab" "Compiling opari.tab.c"
linkCmd="$linkCmd opari.tab.o"
fi
evalWithDebugMessage "$linkCmd" "Linking with TAU Options"
echoIfDebug "Looking for file: $passedOutputFile"
if [ ! -e $passedOutputFile ]; then
echoIfVerbose "Error: Tried looking for file: $passedOutputFile"
echoIfVerbose "Error: Failed to link with TAU options"
if [ $revertForced == $TRUE ] ; then
printError "$CMD" "$linkCmd"
else
revertOnError=false
printError "$CMD" "$linkCmd"
printf ""
exit $errorStatus
fi
fi
gotoNextStep=$FALSE
if [ $opari == $TRUE -a $needToCleanPdbInstFiles == $TRUE ]; then
evalWithDebugMessage "/bin/rm -f opari.tab.c opari.tab.o *.opari.inc" "Removing opari.tab.c opari.tab.o *.opari.inc"
if [ $pdtUsed == $TRUE ]; then
evalWithDebugMessage "/bin/rm -f *.comment.pdb *.chk.* *.pomp.* *.pp.pdb *.comment.pdb" "Removing *.chk *.pomp.* *.comment.pdb *.pp.pdb"
fi
fi
fi
####################################################################
# Parsing the Code
####################################################################
if [ $gotoNextStep == $TRUE ]; then
tempCounter=0
while [ $tempCounter -lt $numFiles ]; do
#Now all the types of all the flags, cFlags, fFlags.
#optPdtF95 is a generic opt for all fortran files
#and hence is appended for .f, .F, .F90 and .F95
case $groupType in
$group_f_F)
pdtCmd="$pdtParserF"
pdtCmd="$pdtCmd ${arrFileName[$tempCounter]}"
pdtCmd="$pdtCmd $optPdtUser"
pdtCmd="$pdtCmd ${optPdtF95} $optIncludes"
optCompile="$optCompile $optIncludes"
;;
$group_c)
pdtCmd="$optPdtDir""/$pdtParserType"
pdtCmd="$pdtCmd ${arrFileName[$tempCounter]} "
pdtCmd="$pdtCmd $optPdtCFlags $optPdtUser "
optCompile="$optCompile $optDefs $optIncludes"
;;
$group_C)
pdtCmd="$optPdtDir""/$pdtParserType"
pdtCmd="$pdtCmd ${arrFileName[$tempCounter]} "
pdtCmd="$pdtCmd $optPdtCxxFlags $optPdtUser "
optCompile="$optCompile $optDefs $optIncludes"
;;
esac
if [ $optCompInst == $FALSE ]; then
if [ $disablePdtStep == $FALSE ]; then
if [ $pdbFileSpecified == $FALSE ]; then
evalWithDebugMessage "$pdtCmd" "Parsing with PDT Parser"
fi
else
echo "tau_compiler.sh> WARNING: Disabling instrumentation of source code. TAU was not configured with -pdt=<dir> option."
gotoNextStep=$FALSE
errorStatus=$TRUE
fi
fi
#Assumption: The pdb file would be formed in the current directory, so need
#to strip the fileName from the directory. Since sometime,
#you can be creating a pdb in the current directory using
#a source file located in another directory.
saveTempFile=${arrPdb[$tempCounter]}
tempFileName=${arrPdb[$tempCounter]##*/}
if [ $isCXXUsedForC == $TRUE ]; then
tempFileName=${saveTempFile}
fi
echoIfDebug "Looking for pdb file $tempFileName "
if [ ! -e $tempFileName -a $disablePdtStep == $FALSE ]; then
printError "$PDTPARSER" "$pdtCmd"
break
fi
tempCounter=tempCounter+1
done
fi
####################################################################
# Instrumenting the Code
####################################################################
if [ $gotoNextStep == $TRUE -a $optCompInst == $FALSE ]; then
tempCounter=0
while [ $tempCounter -lt $numFiles ]; do
tempPdbFileName=${arrPdb[$tempCounter]##*/}
if [ $isCXXUsedForC == $TRUE ]; then
tempPdbFileName=${saveTempFile}
fi
tempInstFileName=${arrTau[$tempCounter]##*/}
tauCmd="$optTauInstr $tempPdbFileName ${arrFileName[$tempCounter]} -o $tempInstFileName "
tauCmd="$tauCmd $optTau $optTauSelectFile"
if [ $disablePdtStep == $FALSE ]; then
evalWithDebugMessage "$tauCmd" "Instrumenting with TAU"
else
echoIfDebug "Not instrumenting source code. PDT not available."
fi
if [ $? -ne 0 ]; then
echoIfVerbose "Error: tau_instrumentor failed"
printError "$optTauInstr" "$tauCmd"
break
fi
echoIfDebug "Looking for tau file $tempInstFileName"
if [ ! -e $tempInstFileName ]; then
echoIfVerbose "Error: Tried Looking for file: $tempInstFileName"
printError "$optTauInstr" "$tauCmd"
break
fi
tempCounter=tempCounter+1
done
fi
####################################################################
#Compiling the Instrumented Source Code
####################################################################
if [ $gotoNextStep == $TRUE ]; then
#optCompile= $TAU_DEFS + $TAU_INCLUDE + $TAU_MPI_INCLUDE
#Assumption: If -o option is not specified for compilation, then simply produce
#an output -o with filebaseName.o as the output for EACH file. This is because, in the
#common.mk file, even though there was no output generated by the regular command
#description, the compilation of the scripted code created one with -o option.
#The output is often needed for compilation of the instrumented phase.
#e.g. see compliation of mpi.c. So do not attempt to modify it simply
#by placing the output to "a.out".
if [ $isForCompilation == $TRUE ]; then
# The number of files could be more than one. Check for creation of each .o file.
tempCounter=0
while [ $tempCounter -lt $numFiles ]; do
base=`echo ${arrFileName[$tempCounter]} | sed -e 's/\.[^\.]*$//' -e's/.*\///'`
suf=`echo ${arrFileName[$tempCounter]} | sed -e 's/.*\./\./' `
outputFile=${base##*/}.o # strip off the directory
# remove the .pp from the name of the output file
if [ $preprocess == $TRUE ]; then
outputFile=`echo $outputFile | sed -e 's/\.pp//'`
fi
# remove the .pomp from the name of the output file
if [ $opari == $TRUE -a $pdtUsed == $TRUE ]; then
outputFile=`echo $outputFile | sed -e 's/\.chk\.pomp//'`
fi
#echoIfDebug "\n\nThe output file passed is $passedOutputFile"
#echoIfDebug "The output file generated locally is $outputFile"
tempTauFileName=${arrTau[$tempCounter]##*/}
instrumentedFileForCompilation="$tempTauFileName"
#newCmd="$CMD $argsRemaining $instrumentedFileForCompilation $OUTPUTARGSFORTAU $optCompile"
newCmd="$CMD -I${arrFileNameDirectory[$tempCounter]} $argsRemaining $instrumentedFileForCompilation $OUTPUTARGSFORTAU $optCompile"
#echoIfDebug "cmd before appending the .o file is $newCmd"
if [ $hasAnOutputFile == $TRUE ]; then
newCmd="$newCmd -o $passedOutputFile"
else
newCmd="$newCmd -o $outputFile"
fi
echoIfDebug "PassedOutFile: $passedOutputFile outputFile: $outputFile"
#echoIfDebug "cmd after appending the .o file is $newCmd"
evalWithDebugMessage "$newCmd" "Compiling with Instrumented Code"
echoIfVerbose "Looking for file: $outputFile "
if [ $hasAnOutputFile == $TRUE ]; then
if [ ! -e $passedOutputFile ]; then
echoIfVerbose "Error: Tried Looking for file: $passedOutputFile"
printError "$CMD" "$newCmd"
break
fi
else
if [ ! -e $outputFile ]; then
echoIfVerbose "Error: Tried Looking for file: $outputFile"
printError "$CMD" "$newCmd"
break
fi
fi
tempCounter=tempCounter+1
done
else #if [ $isForCompilation == $FALSE ]; compile each of the source file
#with a -c option individually and with a .o file. In end link them together.
tempCounter=0
while [ $tempCounter -lt $numFiles ]; do
base=`echo ${arrFileName[$tempCounter]} | sed -e 's/\.[^\.]*$//' -e's/.*\///'`
suf=`echo ${arrFileName[$tempCounter]} | sed -e 's/.*\./\./' `
outputFile=${base##*/}.o #strip it off the directory
objectFilesForLinking="$objectFilesForLinking ${base##*/}.o"
tempTauFileName=${arrTau[$tempCounter]##*/}
instrumentedFileForCompilation=" $tempTauFileName"
# newCmd="$CMD $argsRemaining -c $instrumentedFileForCompilation $OUTPUTARGSFORTAU $optCompile -o $outputFile"
newCmd="$CMD $argsRemaining -I${arrFileNameDirectory[$tempCounter]} -c $instrumentedFileForCompilation $OUTPUTARGSFORTAU $optCompile -o $outputFile"
evalWithDebugMessage "$newCmd" "Compiling (Individually) with Instrumented Code"
if [ ! -e $outputFile ]; then
echoIfVerbose "Error: Tried Looking for file: $outputFile"
printError "$CMD" "$newCmd"
break
fi
tempCounter=tempCounter+1
done
if [ $hasAnOutputFile == $FALSE ]; then
passedOutputFile="a.out"
fi
if [ $opari == $TRUE ]; then
evalWithDebugMessage "/bin/rm -f opari.rc" "Removing opari.rc"
cmdCompileOpariTab="${optTauCC} -c ${optIncludeDefs} ${optIncludes} ${optDefs} opari.tab.c"
evalWithDebugMessage "$cmdCompileOpariTab" "Compiling opari.tab.c"
objectFilesForLinking="$objectFilesForLinking opari.tab.o"
fi
newCmd="$CMD $listOfObjectFiles $objectFilesForLinking $argsRemaining $OUTPUTARGSFORTAU $optLinking -o $passedOutputFile"
evalWithDebugMessage "$newCmd" "Linking (Together) object files"
if [ ! -e $passedOutputFile ] ; then
echoIfVerbose "Error: Tried Looking for file: $passedOutputFile"
printError "$CMD" "$newCmd"
fi
if [ $opari == $TRUE -a $needToCleanPdbInstFiles == $TRUE ]; then
evalWithDebugMessage "/bin/rm -f opari.tab.c opari.tab.o *.opari.inc" "Removing opari.tab.c opari.tab.o *.opari.inc"
fi
fi
fi
if [ $needToCleanPdbInstFiles == $TRUE ]; then
tempCounter=0
while [ $tempCounter -lt $numFiles -a $disablePdtStep == $FALSE ]; do
evalWithDebugMessage "/bin/rm -f ${arrTau[$tempCounter]##*/}" "cleaning inst file"
if [ $preprocess == $TRUE -a $groupType == $group_f_F ]; then
if [ $opari == $TRUE ]; then
secondSource=`echo ${arrTau[$tempCounter]##*/} | sed -e 's/\.chk\.pomp\.inst//'`
else
secondSource=`echo ${arrTau[$tempCounter]##*/} | sed -e 's/\.inst//'`
fi
evalWithDebugMessage "/bin/rm -f $secondSource" "cleaning pp file"
fi
if [ $pdbFileSpecified == $FALSE ]; then
evalWithDebugMessage "/bin/rm -f ${arrPdb[$tempCounter]##*/}" "cleaning PDB file"
if [ $preprocess == $TRUE -o $opari == $TRUE ]; then
secondPDB=`echo $outputFile | sed -e 's/\.o/\.pdb/'`
evalWithDebugMessage "/bin/rm -f $secondPDB" "cleaning PDB file"
fi
fi
if [ $opari == $TRUE ]; then
evalWithDebugMessage "/bin/rm -f ${arrFileName[$tempCounter]}" "cleaning opari file"
fi
tempCounter=tempCounter+1
done
fi
####################################################################
# Regular Command: In case of an Intermediate Error.
####################################################################
if [ $errorStatus == $TRUE ] ; then
if [ $revertOnError == $FALSE ]; then
echo "Reverting to uninstrumented command disabled. To enable reverting pass -optRevert to tau_compiler.sh."
exit 1
fi
if [ $groupType == $group_f_F ]; then
if [ "x$optAppF90" == "x" ]; then
regularCmd="$compilerSpecified $regularCmd"
else
regularCmd="$optAppF90 $regularCmd"
fi
elif [ $groupType == $group_c ]; then
if [ "x$optAppCC" == "x" ]; then
regularCmd="$compilerSpecified $regularCmd"
else
regularCmd="$optAppCC $regularCmd"
fi
elif [ $groupType == $group_C ]; then
if [ "x$optAppCXX" == "x" ]; then
regularCmd="$compilerSpecified $regularCmd"
else
regularCmd="$optAppCXX $regularCmd"
fi
else
regularCmd="$compilerSpecified $regularCmd"
fi
evalWithDebugMessage "$regularCmd" "Compiling with Non-Instrumented Regular Code"
fi
printf ""
exit $errorStatus
|