#!/bin/csh -f
set pathname = $1
shift
set file = $1 
shift
set fileroot = $file:r

if (! -r $file) then
    echo "$file is not here"
    exit (2)
endif

rmlink $file
#
# remove the .o file
#
set nonomatch
rm -f {DEBUG,OPTIMIZE}*/$fileroot.o
unset nonomatch

cat > makeed$$ << theend
s;\./\${HOW}/$fileroot;$pathname/\${HOW}/$fileroot;
s;\./$file;$pathname/$file;
s;\./$fileroot ;$pathname/$fileroot ;
theend
cp -p Makefile Makefile.bak
sed -f makeed$$ < Makefile > newMakefile
mv newMakefile Makefile
rm -f makeed$$
