##############################################################################
#
# The default target directorys are subdirectorys of the current directory.
# You may wish to redefine the make macros something like:
#
# where the 'man' entries go:
# L = /usr/man/man7
#
# the 'man' # (as in L above):
# M = 7
#
# where msh, termcap, wms, and wty go:
# P = /usr/public
# 
# defaults:
L			= ./man7
M			= 7
P			= ./public
#
##############################################################################
#
#
# locals only (do not change):
p			= ./public
s			= ./source
v			= 1.7a # version
#
#
all::		
			@csh -c 'if (-e $@) rm $@'
#
all::			$P/wms $L/msh.$M $L/wms.$M $L/wty.$M $P/msh $P/wty
			@csh -c 'if (-e $@) rm $@'
			@echo done
#
$P/wms:
			csh -c 'if (!(-e $@)) mkdir $@'
#
$L/msh.$M:		mant/msh.t mant/DS
			cat mant/DS mant/msh.t > $@
#
$L/wms.$M:		mant/wms.t mant/DS
			cat mant/DS mant/wms.t > $@
#
$L/wty.$M:		mant/wty.t mant/DS
			cat mant/DS mant/wty.t > $@
#
mant/DS:		makefile
			echo '.ds V' $v > $@
			echo '.ds P' $P >> $@
			echo '.ds M' $M >> $@
#
$P/msh:			$P/wms/msh.bind.o $P/wms/msh.o $P/wms/max.msh.o
			cc -O $P/wms/msh.bind.o $P/wms/msh.o $P/wms/max.msh.o \
			    -o $@
			strip $@
#
$P/wms/msh.bind.o:	$s/msh/msh.bind.c 
			cc -O -c $s/msh/msh.bind.c
			mv msh.bind.o $@
#
$P/wms/msh.o:		$s/msh/msh.c $s/util.h $P/wms/msh.h $P/wms/max.msh.h
			cc -O -c $s/msh/msh.c
			mv msh.o $@
#
$P/wms/max.msh.o:	$P/wms/max.msh.c
			cc -O -c $P/wms/max.msh.c
			mv max.msh.o $@
#
$P/wms/max.msh.c:	$p/wms/max.msh.c
			cp $p/wms/max.msh.c $@
#
$P/wms/max.msh.h:	$p/wms/max.msh.h
			cp $p/wms/max.msh.h $@
#
$P/wms/msh.h:		$p/wms/msh.h
			cp $p/wms/msh.h $@
#
$P/wty:			$P/wms/wty.bind.o $P/wms/wty.o $P/wms/max.wty.o \
			    $P/wms/msh.o
			cc -O $P/wms/wty.bind.o $P/wms/wty.o $P/wms/max.wty.o \
			    $P/wms/msh.o -ltermcap -o $@
			strip $@
#
$P/wms/wty.bind.o:	$s/wty/wty.bind.c $P/wms/max.wty.h
			cc -O -c $s/wty/wty.bind.c
			mv wty.bind.o $@
#
$P/wms/wty.o:		$s/wty/wty.c $s/util.h $s/wty/wty.h $P/wms/msh.h \
			    $P/wms/max.wty.h
			cc -O -c $s/wty/wty.c
			mv wty.o $@
#
#
$P/wms/max.wty.o:	$P/wms/max.wty.c $P/wms/max.msh.c
			cc -O -c $P/wms/max.wty.c
			mv max.wty.o $@
#
$P/wms/max.wty.c:	$p/wms/max.wty.c
			cp $p/wms/max.wty.c $@
#
$P/wms/max.wty.h:	$p/wms/max.wty.h
			cp $p/wms/max.wty.h $@
