MAN7=groff_ms.n me.n msafer.n

NORMALFILES=tmac.andoc tmac.pic tmac.ps tmac.psnew tmac.psold tmac.pspic \
      tmac.psatk tmac.dvi tmac.tty tmac.tty-char tmac.X tmac.Xps tmac.latin1 \
      tmac.lj4 eqnrc troffrc tmac.safer
SPECIALFILES=tmac.an tmac.s
STRIPFILES=tmac.e tmac.doc tmac.doc.old
MDOCFILES=doc-common doc-ditroff doc-nroff doc-syms
mdocdir=$(tmacdir)/mdoc
CLEANADD=stamp-strip stamp-wrap tmac.e-s tmac.doc-s tmac.doc.old-s \
 doc-common-s doc-ditroff-s doc-nroff-s doc-syms-s *-wrap
tmac_s_prefix=
tmac_an_prefix=
tmac_wrap=
sys_tmac_prefix=

# all: stamp-strip stamp-wrap

install_data: $(NORMALFILES) $(SPECIALFILES) stamp-wrap stamp-strip man.local
	-test -d $(tmacdir) || mkdir $(tmacdir)
	if test -n "$(tmac_wrap)"; then \
	  for m in $(tmac_wrap); do \
	    $(INSTALL_DATA) $$m-wrap $(tmacdir)/tmac.$$m; \
	  done; \
	fi
	for f in $(NORMALFILES); do \
	  rm -f $(tmacdir)/$$f; \
	  $(INSTALL_DATA) $(srcdir)/$$f $(tmacdir)/$$f; \
	done
	-rm -f $(tmacdir)/tmac.$(tmac_s_prefix)s
	$(INSTALL_DATA) $(srcdir)/tmac.s $(tmacdir)/tmac.$(tmac_s_prefix)s
	-rm -f $(tmacdir)/tmac.$(tmac_an_prefix)an
	$(INSTALL_DATA) $(srcdir)/tmac.an $(tmacdir)/tmac.$(tmac_an_prefix)an
	for f in $(STRIPFILES); do \
	  rm -f $(tmacdir)/$$f; \
	  $(INSTALL_DATA) $$f-s $(tmacdir)/$$f; \
	done
	-test -d $(mdocdir) || mkdir $(mdocdir)
	for f in $(MDOCFILES); do \
	  rm -f $(mdocdir)/$$f; \
	  $(INSTALL_DATA) $$f-s $(mdocdir)/$$f; \
	done
	-test -f $(tmacdir)/man.local || \
	  $(INSTALL_DATA) $(srcdir)/man.local $(tmacdir)/man.local
	-rm -f temp

stamp-strip: $(STRIPFILES) $(MDOCFILES)
	for f in $(STRIPFILES) $(MDOCFILES); do \
	  rm -f $$f-s; \
	  sed -f $(srcdir)/strip.sed $(srcdir)/$$f >$$f-s; \
	done
	touch $@

stamp-wrap:
	if test -n "$(tmac_wrap)"; then \
	  for m in $(tmac_wrap); do \
	    rm -f $$m-wrap; \
	    echo .cp 1 >$$m-wrap; \
	    echo .so $(sys_tmac_prefix)$$m >>$$m-wrap; \
	  done; \
	fi
	touch $@

uninstall_sub:
	-if test -n "$(tmac_wrap)"; then \
	  for m in $(tmac_wrap); do rm -f $(tmacdir)/tmac.$$m; done; \
	fi
	-for f in $(NORMALFILES) $(STRIPFILES); do rm -f $(tmacdir)/$$f; done
	-rm -f $(tmacdir)/tmac.$(tmac_s_prefix)s
	-rm -f $(tmacdir)/tmac.$(tmac_an_prefix)an
	-if cmp -s $(tmacdir)/man.local $(srcdir)/man.local; then \
	  rm -f $(tmacdir)/man.local; \
	fi
	-for f in $(MDOCFILES); do rm -f $(mdocdir)/$$f; done
	-rmdir $(mdocdir)
