| 1 | #! /bin/sh |
| 2 | |
| 3 | # make-j script from Alexandre Oliva <[email protected]> for use with distcc |
| 4 | |
| 5 | # Tests which machines are up, and runs Make with concurrency set |
| 6 | # appropriately. |
| 7 | |
| 8 | hostlist=$DISTCC_HOSTS |
| 9 | distcc_port=4200 |
| 10 | DISTCC_HOSTS= |
| 11 | count=0 |
| 12 | for h in $hostlist; do |
| 13 | echo trying $h... >&2 |
| 14 | if test "x$h" = xlocalhost || nc -z $h $distcc_port; then |
| 15 | echo added $h... >&2 |
| 16 | DISTCC_HOSTS=`echo $DISTCC_HOSTS $h` # remove leading blank |
| 17 | count=`expr $count + 1` |
| 18 | fi |
| 19 | done |
| 20 | export DISTCC_HOSTS |
| 21 | exec make -j $count ${1+"$@"} |