/usr/bin/eztrace_cc is in eztrace 1.1-2-1ubuntu2.
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 | #!/bin/sh
# Copyright (C) CNRS, INRIA, Université Bordeaux 1, Télécom SudParis
# See COPYING in top-level directory.
# usage: eztrace_cc gcc -o foo foo.c -I/usr/include/bar -L/lib/bar -lbar
cc_cmd=$*
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
bindir=${exec_prefix}/bin
OPARI=${bindir}/opari2
CFLAGS=-I${includedir}
LDFLAGS="-lpomp -L${libdir} -Wl,-rpath=${libdir}"
tmpdir=`mktemp -d`
instrumentFile()
{
param=$1
new_file_name=$2
# copy the file to tmpdir and instrument it
param_base=`basename $param`
param_dir=`dirname $param`
cp $param $tmpdir
${OPARI} --nosrc --untied=keep --untied=no-warn ${tmpdir}/${param_base} $new_file_name
res_grep=`echo "$cc_cmd" |grep -- "-c" `
if [ "x$res_grep" != "x" ]; then
res_grep=`echo "$cc_cmd" |grep -- "-o" `
if [ "x$res_grep" = "x" ]; then
# there is no -o in the compilation line
# we need to add -o param.o
# otherwise the generated file would be tmp.xxxx.o instead of param.o
doto_file=`echo "$param_base" |sed 's/\.[c|f|F]$/\.o/' |sed 's/\.f90$/\.o/'`
cc_cmd="$cc_cmd -o $doto_file"
fi
fi
cc_cmd=`echo $cc_cmd -I$param_dir | sed "s@$param\s@$new_file_name @"`
}
cleanup_cmd="rm -rf opari.rc $tmpdir"
for x in $(seq $#) ;
do
param=$(eval echo \$"$x")
case $param in
*.c )
new_file_name=`mktemp --suffix=.c --tmpdir=$tmpdir`
instrumentFile $param $new_file_name
;;
*.f )
new_file_name=`mktemp --suffix=.f --tmpdir=$tmpdir`
instrumentFile $param $new_file_name
;;
*.F )
new_file_name=`mktemp --suffix=.F --tmpdir=$tmpdir`
instrumentFile $param $new_file_name
;;
*.f90 )
new_file_name=`mktemp --suffix=.f90 --tmpdir=$PWD`
instrumentFile $param $new_file_name
;;
esac
done
cc_cmd="$cc_cmd $CFLAGS $LDFLAGS"
$cc_cmd
$cleanup_cmd
|