#! /bin/csh -f
	/bin/cat << END1A >! Makesep
#
# Site-specific definitions are confined to makefiles and include files.
# For makefiles the file machdepsep contains all machine-dependent parameters.
# MakeMakesep itself is machine independent!
#
END1A
/bin/cat < machdepsep >> Makesep
	/bin/cat << END1B >> Makesep
#
#
END1B

	set hosttype = `cat hosttype`
	echo $hosttype
	set ALL=()
	foreach dir (*lib)
		echo Doing $dir
		switch ($dir)
			case loclib:
			case genlib:
			case utillib:
				breaksw
			case imaglib:
				set ALL=($ALL Ipen)
				breaksw
			case rteklib:
				set ALL=($ALL Rpen)
				breaksw
			case spenlib:
				set ALL=($ALL Spen)
				breaksw
			case xpenlib:
				set ALL=($ALL Xpen)
				breaksw
			default:
				set thispen = `echo $dir | sed -e 's/lib/pen/'`
				set thispenf = `echo $thispen | sed -e 's/^\(.\)\(.*\)$/\1/' | tr a-z A-Z`
				set thispenb = `echo $thispen | sed -e 's/^\(.\)\(.*\)$/\2/'`
				set ALL = ($ALL $thispenf$thispenb)
				breaksw
		endsw
	end
	echo "all: $ALL" >> Makesep
	echo "" >> Makesep
	echo "install: all" >> Makesep

	if (-e machdep_restrict) then
	    set machdepres = machdep_restrict
	else
	    set machdepres = /dev/null
	endif

	foreach file ($ALL)
	    if (`grep -c $file $machdepres` > 0) then
		set group = `grep $file $machdepres | sed -e 's/^[^ 	]*[ 	]*//'`
		echo -n '	install -c -s -o $(OWNER) -g '$group' -m 0770 ' >> Makesep
	    else
		echo -n '	install -c -s -o $(OWNER) -g $(GROUP) -m 0775 ' >> Makesep
	    endif

	    echo $file '$(BIN)'$file >> Makesep
	end

	/bin/cat << 'END2' >> Makesep

.c.o:; cc -c $(CFLAGS) $*.c

$(TSEPLIB): loclib/*.c
	cd loclib; make "CFLAGS=${CFLAGS}" tseplib.a

$(GENLIB): genlib/*.c
	cd genlib; make "CFLAGS=${CFLAGS}"

$(UTILLIB): utilities/*.c
	cd utilities; make "CFLAGS=${CFLAGS}"

Main_vplot.o: main_vplot.c
	cp main_vplot.c Main_vplot.c
	cc -c $(CFLAGS) Main_vplot.c
	rm Main_vplot.c

Init_vplot.o: init_vplot.c
	cp init_vplot.c Init_vplot.c
	cc -c $(CFLAGS) Init_vplot.c
	rm Init_vplot.c

clean:
'END2'
echo "	rm -f *.o $ALL" >> Makesep
echo " " >> Makesep

	foreach dir (*lib)
		switch ($dir)
			case utillib:
			case loclib:
			case genlib:
				breaksw
			default:
				cat $dir/*Makef >> Makesep
				breaksw
		endsw
	end
