For the records, I'm using the following script.  It results in a
correct compilation with Automake, Icc, and Distcc.

#! /bin/sh

icc=/home/lrde/lrde/usr/bin/icc

# ICC needs to be taught that *.ii is C++.
# The wonderful news is that:
#
# % /home/lrde/lrde/usr/bin/icc I-dont-exist
# ld: cannot open I-dont-exist: No such file or directory
# % /home/lrde/lrde/usr/bin/icc -c I-dont-exist
#
# icc per se does not complain about missing files...  That's
# why understanding the problems takes so long....
case "$@" in
  *.cc*|*.cpp*) set -- -Kc++ "$@" ;;
esac

# ICC is not able to honor both -E and -M, but Automake wants -M,
# and -E will be added by distcc.
case "$@" in
  *-M*)
  # Push a token among the arguments that will be used to notice when we
  # ended options/arguments parsing.
  arg_sep="$$--$$"
  set -- "$@" "$arg_sep"
  
  # 
  # Parse command line arguments.
  while test x"$1" != x"$arg_sep"; do
    case "$1" in
      -MF) shift
           minus_M_args="$minus_M_args -MF$1" ;;               
      -M*) minus_M_args="$minus_M_args $1" ;;
      -E)  minus_E=-E;;
      *) set -- "$@" "$1";;
     esac
     shift
  done
  # Pop the token
  shift
  ;;
esac
if test "x$minus_E" != x; then
  echo "$0: don't know what to do with -E" >&2
fi

if test "x$minus_M_args" != x; then
  $icc $minus_M_args "$@"
fi
exec /usr/bin/distcc $icc "$@"
But the speedup is really miserable: none AFAICS (on several runs).  I
must say that my src hierarchy is poor for -j, as it heavily uses
Automake and many small modules compiled sequentially.  Here are the
figure I get:

make -j4 CC=icc CXX=icc  250,09s user 17,22s system 46% cpu 9:38,68 total

make -j4 CC=dicc CXX=dicc  257,89s user 22,69s system 55% cpu 8:22,51 total

Reply via email to