#!/bin/csh -f
#
# kmake - OLH document generator using Makefiles
#         Written by Kevin Cunningham, kcunning@ATHENA.MIT.EDU, 11 Oct 90


set make = Make
set root = /mit/logos/lib/Make.root
set tmp = /tmp/Makefile.$$


# Test for local Make
test -s $make
if ($status != 0) then
    echo "Local file $make does not exist.  Exiting."
    exit
endif

# Test for system Make
test -s $root
if ($status != 0) then
    echo "System file $root does not exist.  Exiting."
    exit
endif


# Create temporary Makefile from separate pieces, and test for file
cat $make $root > $tmp

onintr cleanup				# handle interrupts reasonably

test -s $tmp
if ($status != 0) then
    echo "Cannot make temporary Makefile $tmp.  Exiting."
    exit
endif


# Run make as usual
/usr/ccs/bin/make -f $tmp $*


# cleanup: remove the temporary file
cleanup:
onintr
/usr/bin/rm $tmp
exit 0
