Commit 3a864537 authored by Philip Carns's avatar Philip Carns

complete version of darshan-gen-cc.pl, needs testing


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@56 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 09571fbb
...@@ -10,6 +10,11 @@ ...@@ -10,6 +10,11 @@
use Getopt::Long; use Getopt::Long;
use English; use English;
$CP_WRAPPERS="@CP_WRAPPERS@";
$DARSHAN_LIB_PATH="@darshan_lib_path@";
$DARSHAN_BIN_PATH="@darshan_bin_path@";
$CP_ZLIB_LINK_FLAGS="@__CP_ZLIB_LINK_FLAGS@";
my $input_file = ""; my $input_file = "";
my $output_file = ""; my $output_file = "";
...@@ -43,12 +48,11 @@ chomp($link_cmd); ...@@ -43,12 +48,11 @@ chomp($link_cmd);
open (OUTPUT, ">$output_file") || die("Error opening output file: $!"); open (OUTPUT, ">$output_file") || die("Error opening output file: $!");
# substitute arguments and darshan options into commands # substitute arguments and darshan options into commands
$compile_cmd =~ s/-c foo.c/"\$\{allargs\[\@\]\}"/g; $base_link_cmd = $link_cmd;
$link_cmd =~ s/foo.o -o foo/"\$\{allargs\[\@\]\}" -L$DARSHAN_LIB_PATH $CP_ZLIB_LINK_FLAG -ldarshan-mpi-io -lz/g; $base_link_cmd =~ s/foo.o -o foo/"\$\{allargs\[\@\]\}"/g;
$link_cmd =~ s/foo.o -o foo/"\$\{allargs\[\@\]\}" -L$DARSHAN_LIB_PATH $CP_ZLIB_LINK_FLAGS -ldarshan-mpi-io -lz $CP_WRAPPERS/g;
$link_cmd =~ s/$/ -L$DARSHAN_LIB_PATH -ldarshan-posix/g; $link_cmd =~ s/$/ -L$DARSHAN_LIB_PATH -ldarshan-posix/g;
$compile_cmd =~ s/-c foo.c/"\$\{allargs\[\@\]\}"/g;
print "compile: $compile_cmd\n";
print "link: $link_cmd\n";
print OUTPUT <<'EOF'; print OUTPUT <<'EOF';
#!/bin/sh #!/bin/sh
...@@ -90,14 +94,23 @@ if [ "$linking" = yes ] ; then ...@@ -90,14 +94,23 @@ if [ "$linking" = yes ] ; then
# prepend the path for the shared libraries to the library list # prepend the path for the shared libraries to the library list
mpilibs="$C_LINKPATH_SHL$libdir $mpilibs" mpilibs="$C_LINKPATH_SHL$libdir $mpilibs"
fi fi
$Show $CC "${allargs[@]}" -I$includedir $CFLAGS $LDFLAGS -L$libdir $mpilibs $MPI_OTHERLIBS # check to see if the command line refers to any profilers that might
rc=$? # use PMPI.
EOF
print OUTPUT <<EOF;
profiler_check=`echo "\$\{allargs\[\@\]\}" | $DARSHAN_BIN_PATH/darshan-pmpi-filter.sh`
if [ "\$profiler_check" = "" ] ; then
\$Show $link_cmd
else
\$Show $base_link_cmd
fi
rc=\$?
else else
$Show $CC "${allargs[@]}" -I$includedir $CFLAGS \$Show $compile_cmd
rc=$? rc=\$?
fi fi
exit $rc exit \$rc
EOF EOF
close(OUTPUT); close(OUTPUT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment