#!/bin/csh -f
# modify makefiles by replacing the given module by contents of given file
# usage: $0 <module> <modulefile> filelist

if( $#argv < 2 ) then
    echo "usage: $0 <module> <modulefile> filelist"
    exit( 1 )
endif
set module = $1
shift
set modulefile = $1
shift
set start = "#++ make module ${module} start, do NOT touch this line. ++"
set end = "#++ make module ${module} end, do NOT touch this line. ++"
foreach mkf ($*)
echo ${mkf}
ed ${mkf} <<endofscript
/$start/,/$end/d
.-1a
$start
.
.r ${modulefile}
.a
$end
.
w
Q
endofscript
end
