#	Document Preparation sub-system make file  9/25/85 ell
#	@(#)docmain:Makefile	1.14

include $(MAKEINC)/Makepre.h

# roff must build before macros

UNITS = \
	UNITcheckmm=checkmm \
	UNITcmd=doccmd \
	UNITeqn=eqn \
	UNITroff=roff \
	UNITmacros=macros \
	UNITneqn=neqn \
	UNITshells=shells \
	UNITspell=spell \
	UNITtbl=tbl

SUBDIRS = checkmm \
	cmd \
	eqn \
	roff \
	macros \
	neqn \
	shells \
	spell \
	tbl

ROOT_PRODUCTS = \
	DOC

all: inst_tree comall
	cd $(SRC)/LIB/tabset; $(MAKE)

inst_tree:
	( \
	if [ -d $(INST_TREE) -a "`uname -n`" != "zeus" ]; \
	then \
		echo "Assuming latest mstr.proto is installed on build machine";\
		cd $(INST_TREE); \
		rm -rf $(ROOT_PRODUCTS); \
		$(MAKE) -i SETS="$(ROOT_PRODUCTS)" all; \
	fi; \
	)

clean: comclean 
	cd $(SRC)/LIB/tabset; $(MAKE) clean

clobber: comclobber
	cd $(SRC)/LIB/tabset; $(MAKE) clobber

includes:	comincludes
	cd $(SRC)/LIB/tabset; $(MAKE) includes

populate: $(SUBDIRS)
	for D in $(SUBDIRS); \
	do (cd $$D; echo "** $$D **:"; getunit); \
	done
	cd roff; $(MAKE) populate
	echo "Don't forget to populate $(SRC)/LIB/tabset!!!!\n"

$(SUBDIRS):
	@$(UNITS) ;echo "Making Directory for $@"; mkdir $@; echo $$UNIT$@ > $@/.unit
install:  cominstall
	$(INSTALL) -i$(EXITFLAG) Install%/usr/install/DOC $(INSDIR) $(PROTOFILE)
	$(INSTALL) -i$(EXITFLAG) Name%/usr/install/DOC $(INSDIR) $(PROTOFILE)
	$(INSTALL) -i$(EXITFLAG) Remove%/usr/install/DOC $(INSDIR) $(PROTOFILE)
	cd $(SRC)/LIB/tabset; $(MAKE) install

include $(MAKEINC)/Makepost.h
