#!/bin/sh # # $Id$ # # run make, but in a subdirectory, specified in @top_srcdir@/current.conf # dir=`pwd` system=`uname` host= builddir() { awk '/^'$system':[ \t]/ { dir=$2; dirset=1; } NF>=1 { if (substr($1,length($1),1)!=":" && dirset != 1) dir=$1; } END {print dir;}' $conf } objext() { awk '/^'$system':[ \t]/ { obj=$3; objset=1; exit; } NF>=1 { if (substr($1,length($1),1)!=":" && objset != 1) obj=$2; } END {print obj;}' $conf } if test "$1" = "-h" then host=$2 shift 2 if test "$host" = "" then echo "No host for -h specified." exit 1 fi system=$host fi if [ -f current.conf ] then conf=current.conf dir=$dir/`head -1 current.conf` elif [ -f ../current.conf ] then conf=../current.conf dir=`echo $dir | sed 's%/[^/]*$%%'`/`builddir`/`echo $dir | sed 's%.*/%%g'` elif [ -f ../../current.conf ] then conf=../../current.conf dir=`echo $dir | sed 's%/[^/]*/[^/]*$%%'`/`builddir`/`echo $dir | sed 's%^.*/\([^/]*/[^/]*\)$%\1%'` elif [ -f ../../../current.conf ] then conf=../../../current.conf dir=`echo $dir | sed 's%/[^/]*/[^/]*/[^/]*$%%'`/`builddir`/`echo $dir | sed 's%^.*/\([^/]*/[^/]*/[^/]*\)$%\1%'` fi # transform object file suffix, if given in current.conf test "$conf" != "" && obj=`objext` if test "$obj" != "" then arg=`echo $* | sed -e 's/\.o /\.'$obj' /g' -e 's/\.o$/\.'$obj'/'` else arg=$* fi if test "$host" = "" then cd $dir echo 'gw-make: Entering directory `'$dir"'" make $arg echo 'gw-make: Leaving directory `'$dir"'" else echo 'gw-make: Entering directory `'$dir"'" ssh $host "cd $dir; make $arg" echo 'gw-make: Leaving directory `'$dir"'" fi