# $Id: Makefile,v 3.2 1995/09/19 18:22:27 kris Exp $
#
# Un*x Makefile for Xy-pic macros, fonts, documentation, and distribution.
# Copyright (c) 1991-1995  Kristoffer H. Rose  <kris@diku.dk>
#
# This file is part of the Xy-pic macro package.
# Copyright (c) 1991-1995  Kristoffer H. Rose  <kris@diku.dk>
# See the README and INSTALL files for further information.
#
# The Xy-pic package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# The Xy-pic package is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this package; if not, write to the Free Software Foundation, Inc.,
# 675 Mass Ave, Cambridge, MA 02139, USA.

VERSION = 3.2
SHORTVERSION = 32

# CONTENTS:
#
#   Configuration section:
#	Directories.
#	Fonts.
#	Programs.
#
#   Generic targets.
#   Macros.
#   PostScript headers.
#   Fonts.
#   Formats.
#   Manual: User's guide and reference manual.
#   Reference manual.
#   TeXnical documentation.
#   Distribution tree.
#   Ftp'able distribution.
#   WWW publicity.
#   Announcements.
#   Tags.
#   RCS stuff.
#   Development targets.
#
#   Log.


#### CONFIGURATION SECTION ##################################################

# Please configure as instructed below for each of the DIRECTORIES, FONTS,
# and PROGRAMS sections by editing the definitions to fit your system.

#### DIRECTORIES.
#
# The following variables define the directories where the various parts of
# Xy-pic should be installed.
#
# You should *EITHER* set TEXMF to the root of a TDS-compliant directory tree
# (if you have a TDS [TeX Directory Structure] compliant system then that is
# in fact all you need to do):
#
USR = /usr/local
TEXMF = $(USR)/lib/texmf
#
# *OR* you should set each of the following variables right for you system:
#
TEXINPUTDIR = $(TEXMF)/tex/generic/xypic
LATEXINPUTDIR = $(TEXMF)/tex/latex/misc
TEXFONTDIR = $(TEXMF)/fonts/tfm/public/xypic
TEXDOCDIR = $(TEXMF)/doc/generic/xypic
MFINPUTDIR = $(TEXMF)/fonts/source/public/xypic
TYPE1DIR = $(TEXMF)/fonts/type1/public/xypic
PSHEADERDIR = $(TEXMF)/dvips
#
# FONTDIR is the directory where bitmap fonts are stored and is special
# (If you do not plan to install bitmap fonts because they are automatically
# generated and remember to set the MAGS variable below to `.' then you may
# ignore this step.)
#
# Since the location of individual fonts sometimes depend on properties of
# the font, you can insert
#
#	$${dpi}		for the font resolution in `Dots Per Inch' (NOT the
#   			device resolution---that should be inserted directly)
#
#	$${mode}	for the METAFONT `mode' used to generate the font
#
# ---what these get set to depends on the next section.
#
# For example, if you set FONTDIR=/usr/lib/tex/pk$${dpi} and decide in the
# next section to generate PK fonts at 300 dpi using a generic mode
# (localfont) then you get files named /usr/lib/tex/pk300/xy*.300pk.
#
# If your installation still uses the (inefficient) principle of having all
# PK files in the same directory as the TFM files then you should just set
# FONTDIR=$(TEXFONTDIR).
#
FONTDIR = $(TEXMF)/fonts/pk/$${mode}/public/xypic/dpi$${dpi}

#### FONTS.
#
# The METAFONT program needs to know the `mode' of your printer in order to
# be able to generate correct fonts for it.  On most installations the mode
# `localfont' is made synonymous with the mode required for the default
# printer; in that case you can just pick the `MODE = localfont' line.  If
# this is not the case -- or you need fonts for several output devices---then
# you will have to consult the local METAFONT guide/guru to inquire what
# modes are used at your site.  A good place to look for the modes used is in
# the MakeTeXPK script found on some sites.
#
# Select the MODE to the mode (i.e., printer) you wish to use:
#
MODE = cx
#MODE = localfont
#
# You should also decide which TeX \magsteps you wish the font to be
# generated at.
#
# The default is . (dot) which prevents installation of any bitmaps because
# most modern installations generate them automatically.
#
MAGS = .
#MAGS = 0
#MAGS = 0 0.5 1

#### PROGRAMS.
#
# You don't have to edit the following lines unless you have a non-standard
# un*x system or un*x TeX installation...
#
SHELL = /bin/sh
#
TEX = TEXFONTS=.:$(TEXFONTDIR):$$TEXFONTS tex
LATEX = TEXFONTS=.:$(TEXFONTDIR):$$TEXFONTS latex
BIBTEX = BIBINPUTS=. bibtex
MAKEINDEX = makeindex
INITEX = TEXFONTS=.:$(TEXFONTDIR):$$TEXFONTS initex
#
# Set MF to a command that will run plain METAFONT on your system.
#
MF = MFINPUTS=.:$(MFINPUTDIR):$$MFINPUTS mf
#
# Set GFTOPK to the command "false" and PK to "gf" if you use GF rather than PK
# bitmap font files.  There is no support for PXL-files [are they still used?].
#
GFTOPK = gftopk -v
PK=pk
#
#GFTOPK = false
#PK=gf
#
RM = rm -fr
#
# Set INSTALL/INSTALLW to cp if your system does not have the install command.
#
INSTALL = install -c -m 444
INSTALLW = install -c -m 644
#
MKDIR = mkdir -p
#
# DOC2TEX <file>: output efficient .tex file from inefficient .doc <file> with
# inlined documentation [my favourite hack :-].  Removes all DOCMODE lines,
# leaving only things before the first and in DOCMODE(...DOCMODE) brackets;
# also removes all blank lines and comment lines.
#
# If it breaks your sed you can just set DOC2TEX to cat although that will
# make the installed macro files three times larger and the reading of them
# somewhat slower...so in that case you are probably better of getting the
# `run' distribution where this has already been done for you!
#
DOC2TEX = sed \
	-e '/^.DOCMODE(/b Yes' \
	-e '/^.DOCMODE/b No' \
	-e 'x' \
	-e '/%%DONTCOPY%%/b Ignore' \
	-e 'x' \
	-e 's/[ 	][ 	]*/ /g' \
	-e 's/{%.*$$/{%/' -e 's/}%.*$$/}%/' -e 's/ %.*$$//'  \
	-e '/^ *%$$/d' -e '/^ *$$/d' -e '/^ *%[^%]/d' \
	-e 's/^%% \$$Id/%% $@ from $$Id/' \
	-e 'b End' \
	-e ': No' -e 's/.*/%%DONTCOPY%%/' -e 'x' -e 'd' \
	-e ': Yes' -e 's/.*//' -e 'x' -e 'd' \
	-e ': Ignore' -e 'x' -e 'd' \
	-e ': End'
#
# MF2TFM script: make .tfm file and all requested bitmap files from .mf
# file by executing METAFONT with $${mode} and $${dpi} as described above.
#
# NOTE: for use as implicit make rule; do not modify unless you are sure you
# need to!
#
MF2TFM = set -x; mode=$(MODE); \
	if [ "$(MAGS)" = "." ]; then \
	  $(MF) "\\mode=$$mode; input $<";\
	  $(RM) $*.*gf;\
	else \
	  for mag in $(MAGS); do \
	    $(MF) "\\mode=$$mode; mag=magstep($$mag); input $<"; done;\
	  for f in $*.*gf; do if test -f "$$f"; then \
	    if $(GFTOPK) ./$$f; then $(RM) $$f; fi; else :; fi; done;\
	fi

#### END OF CONFIGURATION SECTION ###########################################


# GENERIC TARGETS.
#
.DEFAULT:	all
.PHONY:		all install clean realclean sterile world
#
all:		macros fonts
#
install:	all install.macros install.fonts install.ps install.psfonts
#
clean:
	$(RM) *.aux *.toc *.lof *.blg *.log *.idx *.ilg *.fmt \
	  *.ps *.nops *.tmp *.ans *.xyc \
	  ./#* *~ core *.BAK *JNL 
#
realclean:	clean
	$(RM) MANIFEST VERSIONS CATALOG
	$(RM) xydoc.back; touch xydoc.back
	$(RM) *.bbl *.glo *.ind \
	  *.tfm *.*gf *.*pk *.tex *.dvi *.dvips *.last *.gif *.pro
	$(RM) xyguide-html index.*
#
sterile:	realclean rcsclean
	$(RM) xydoc.back make.* TAGS
	test -w Makefile || $(RM) Makefile
#
world:		realclean rcsclean
	time $(MAKE) all ftp 2>&1 |tee make.world


# MACROS.
#
TRAILERSOURCES =	TRAILER COPYING CATALOG.doc \
			MAKE README Makefile $(INSTALLSTAR)

INSTALLSTAR =		INSTALL INSTALL.OzTeX INSTALL.Textures

KERNELSOURCES = 	xy.doc xyidioms.doc xyrecat.doc

OPTIONSOURCES = 	\
	xyframe.doc xycmtip.doc xycurve.doc xyline.doc xyrotate.doc \
	xycolor.doc xycrayon.doc xytile.doc xyimport.doc \
	xytpic.doc xytp-f.doc \
	xyps.doc xyps-ps.doc xyps-pro.doc xyps-col.doc xyps-c.doc xyps-f.doc \
	xyps-l.doc xyps-r.doc xyps-s.doc xyps-t.doc \
	xypsdict.doc xypspatt.doc xydocps.doc \
	xydummy.doc xyall.doc xymatrix.doc xyarrow.doc xygraph.doc \
	xy2cell.doc xypoly.doc xyarc.doc xyknot.doc xyweb.doc \
	xydvips.doc xytextures.doc xy16textures.doc xyoztex.doc xy17oztex.doc \
	xycmactex.doc xydvitops.doc xyemtex.doc xydvidrv.doc xyxdvi.doc \
	xyv2.doc xypic.doc

FORMATSOURCES = 	xytex.ini xylatex.ini

LATEXSTYLES = 		xy.sty xypic.sty
OPTIONDATA = 		xymacpat.xyp

MACROSOURCES =		$(TRAILERSOURCES) $(KERNELSOURCES) $(LATEXSTYLES) \
			$(OPTIONSOURCES) $(OPTIONDATA) $(FORMATSOURCES)

TRAILERRUN =		TRAILER COPYING CATALOG README $(INSTALLSTAR) VERSIONS

KERNELRUN =		xy.tex xyidioms.tex xyrecat.tex

OPTIONRUN = 		\
	xyframe.tex xycmtip.tex xycurve.tex xyline.tex xyrotate.tex \
	xycolor.tex xycrayon.tex xytile.tex xyimport.tex \
	xytpic.tex xytp-f.tex \
	xyps.tex xyps-ps.tex xyps-pro.tex xyps-col.tex xyps-c.tex xyps-f.tex \
	xyps-l.tex xyps-r.tex xyps-s.tex xyps-t.tex \
	xypsdict.tex xypspatt.tex $(OPTIONDATA) \
	xydummy.tex xyall.tex xymatrix.tex xyarrow.tex xygraph.tex \
	xy2cell.tex xypoly.tex xyarc.tex xyknot.tex xyweb.tex \
	xydvips.tex xytextures.tex xy16textures.tex xyoztex.tex xy17oztex.tex \
	xycmactex.tex xydvitops.tex xyemtex.tex xydvidrv.tex xyxdvi.tex \
	xyv2.tex xypic.tex

MACRORUN =		$(KERNELRUN) $(OPTIONRUN) $(FORMATSOURCES)
LATEXRUN =		$(LATEXSTYLES)
PSRUN = 		xy$(SHORTVERSION)dict.pro
#
# Macros have .tex suffix and are generated from the .doc files.
#
.SUFFIXES:	.tex .doc
.doc.tex:;	$(DOC2TEX) $< > $@
#
.PHONY:		macros install.macros
#
macros: 	$(MACRORUN) $(LATEXRUN)
install.macros:	$(MACRORUN) $(LATEXRUN)
	-test -d $(TEXINPUTDIR) || $(MKDIR) $(TEXINPUTDIR)
	for f in $(MACRORUN); do $(INSTALL) $$f $(TEXINPUTDIR)/$$f; done
	-test -d $(LATEXINPUTDIR) || $(MKDIR) $(LATEXINPUTDIR)
	for f in $(LATEXRUN); do $(INSTALL) $$f $(LATEXINPUTDIR)/$$f; done
#
# Kernel dependencies:
#
xy.tex:				xy.doc
xyidioms.tex:			xyidioms.doc
xyrecat.tex:			xyrecat.doc
#
# Extension option dependencies:
#
xyframe.tex:			xyframe.doc
xycmtip.tex:			xycmtip.doc
xycurve.tex:			xycurve.doc
xyline.tex:			xyline.doc
xyrotate.tex:			xyrotate.doc
xycolor.tex:			xycolor.doc
xycrayon.tex:			xycrayon.doc
xyimport.tex:			xyimport.doc
xytile.tex:			xytile.doc
#
xytpic.tex:			xytpic.doc
xytp-f.tex:			xytp-f.doc
#
xyemtex.tex:			xyemtex.doc
#
xyps.tex:			xyps.doc
xyps-ps.tex:			xyps-ps.doc
xyps-pro.tex:			xyps-pro.doc
xyps-col.tex:			xyps-col.doc
xyps-c.tex:			xyps-c.doc
xyps-f.tex:			xyps-f.doc
xyps-l.tex:			xyps-l.doc
xyps-r.tex:			xyps-r.doc
xyps-s.tex:			xyps-s.doc
xyps-t.tex:			xyps-t.doc
xypsdict.tex:			xypsdict.doc
xypspatt.tex:			xypspatt.doc
#
# Feature option dependencies:
#
xydummy.tex:			xydummy.doc
xyall.tex:			xyall.doc
#
xymatrix.tex:			xymatrix.doc
xyarrow.tex:			xyarrow.doc
xygraph.tex:			xygraph.doc
xy2cell.tex:			xy2cell.doc
xypoly.tex:			xypoly.doc
xyarc.tex:			xyarc.doc
xyknot.tex:			xyknot.doc
xyweb.tex:			xyweb.doc
#
# Driver option dependencies:
#
xycmactex.tex:			xycmactex.doc
xydvips.tex:			xydvips.doc
xydvitops.tex:			xydvitops.doc
xydvidrv.tex:			xydvidrv.doc
xytextures.tex:			xytextures.doc
xy16textures.tex:		xy16textures.doc
xyoztex.tex:			xyoztex.doc
xy17oztex.tex:			xy17oztex.doc
xyxdvi.tex:			xyxdvi.doc
#
# Backwards compatibility dependencies:
#
xyv2.tex:			xyv2.doc
xypic.tex:			xypic.doc


# PostScript HEADERS:
#
.PHONY: install.ps
install.ps:		$(PSRUN)
	test -d $(PSHEADERDIR) || $(MKDIR) $(PSHEADERDIR)
	for f in $(PSRUN); do $(INSTALL) $$f $(PSHEADERDIR)/$$f; done


# FONTS.
#
.PHONY:		mfinputs texfonts $(PK)fonts fonts install.fonts \
		psfonts install.psfonts obsoletefonts install.obsoletefonts
#
METAFONTS = \
	xydash10.mf xyd.mf \
	xyatip10.mf xybtip10.mf xybsql10.mf xycmat10.mf xycmbt10.mf xyd2.mf \
	xycirc10.mf
#
TEXFONTRUN = \
	xydash10.tfm xyatip10.tfm xybtip10.tfm xybsql10.tfm xycirc10.tfm \
	xycmat10.tfm xycmbt10.tfm
#
# NOT a valid dependency:
PKFONTRUN = \
	xydash10.*$(PK) xyatip10.*$(PK) xybtip10.*$(PK) xybsql10.*$(PK) \
	xycirc10.*$(PK) \
	xycmat10.*$(PK) xycmbt10.*$(PK)
#
# Note: we only depend on the tfm-files, so you must remove them to
# regenerate the fonts at all desired magnifications.
#
.SUFFIXES:	.mf .tfm
.mf.tfm:;	$(MF2TFM)
#
mfinputs:	$(METAFONTS)
#
texfonts $(PK)fonts fonts: $(METAFONTS) $(TEXFONTRUN)
install.fonts:	fonts
	if test -n "$(MFINPUTDIR)"; then \
	  test -d $(MFINPUTDIR) || $(MKDIR) $(MFINPUTDIR); \
	  for f in $(METAFONTS);do $(INSTALL) $$f $(MFINPUTDIR)/$$f;done; fi
	-test -d $(TEXFONTDIR) || $(MKDIR) $(TEXFONTDIR)
	for f in $(TEXFONTRUN); do $(INSTALL) $$f $(TEXFONTDIR)/$$f; done
	for f in $(PKFONTRUN); do if test -f "$$f"; then \
	  dpi=`expr "$$f" : '.*\.\([0-9]*\)[a-z]*$$'`; \
	  mode=$(MODE); test -d "$(FONTDIR)" || $(MKDIR) $(FONTDIR); \
	  $(INSTALL) $$f $(FONTDIR)/$$f; else :; fi; done
#
xy*.*$(PK):	# Since it is in FONTRUN
	@echo "PK-files:" echo xy*.*pk
#
xydash10.tfm:	xydash10.mf xyd2.mf
xyatip10.tfm:	xyatip10.mf xyd.mf
xybtip10.tfm:	xybtip10.mf xyd.mf
xycmat10.tfm:	xycmat10.mf xyd.mf
xycmbt10.tfm:	xycmbt10.mf xyd.mf
xybsql10.tfm:	xybsql10.mf xyd.mf
xycirc10.tfm:	xycirc10.mf
#
# Obsolete fonts (from 2.6 and before).
#
OBSOLETEMETAFONTS = xyline10.mf xyqc10.mf xymisc10.mf
OBSOLETETEXFONTRUN = xyline10.tfm xyqc10.tfm xymisc10.tfm
OBSOLETEPKFONTRUN = xyline10.*$(PK) xyqc10.*$(PK) xymisc10.*$(PK)
#
obsoletefonts:	$(OBSOLETEMETAFONTS) $(OBSOLETETEXFONTRUN)
#
install.obsoletefonts:	obsoletefonts
	if test -n "$(MFINPUTDIR)"; then \
	  test -d $(MFINPUTDIR) || $(MKDIR) $(MFINPUTDIR); \
	  for f in $(OBSOLETEMETAFONTS);do $(INSTALL) $$f $(MFINPUTDIR)/$$f;done; fi
	-test -d $(TEXFONTDIR) || $(MKDIR) $(TEXFONTDIR)
	for f in $(OBSOLETETEXFONTRUN); do $(INSTALL) $$f $(TEXFONTDIR)/$$f; done
	for f in $(OBSOLETEPKFONTRUN); do if test -f "$$f"; then \
	  dpi=`expr "$$f" : '.*\.\([0-9]*\)[a-z]*$$'`; \
	  mode=$(MODE); test -d "$(FONTDIR)" || $(MKDIR) $(FONTDIR); \
	  $(INSTALL) $$f $(FONTDIR)/$$f; else :; fi; done
#
xyline10.tfm:   xyline10.mf
xyqc10.tfm:     xyqc10.mf
xymisc10.tfm:   xymisc10.mf
#
# PostScript fonts w/support files.
#
TYPE1FONTS = \
	xyatip10.pfa xybsql10.pfa xybtip10.pfa xycirc10.pfa xydash10.pfa \
	xycmat10.pfa xycmbt10.pfa
#
psfonts:	$(TYPE1FONTS)
#
install.psfonts: psfonts xypic.map
	test -d $(TYPE1DIR) || $(MKDIR) $(TYPE1DIR)
	for f in $(TYPE1FONTS); do $(INSTALL) $$f $(TYPE1DIR)/$$f; done
	test -d $(PSHEADERDIR) || $(MKDIR) $(PSHEADERDIR)
	$(INSTALL) xypic.map $(PSHEADERDIR)/xypic.map
#
# All together...
#
FONTSOURCES = $(METAFONTS) $(OBSOLETEMETAFONTS) $(TYPE1FONTS) xypic.map

# FORMATS:
#
# Build formats...
#
.SUFFIXES:	.ini .fmt
.ini.fmt:;	$(INITEX) $<
#
xytex.fmt:	xytex.ini macros
xylatex.fmt:	xylatex.ini macros
#xyamslatex.fmt:	xyamslatex.ini macros
#xydoc.fmt:	xydoc.ini macros


# MANUAL: USER'S GUIDE AND REFERENCE MANUAL.
#
# Note: the first generations use the DVIPS backend to run faster.
#
.PHONY:		guide manual install.manual manual.ps
#
MANUALDATA = ross.eps kris.eps import1.eps
MANUALSOURCES =		\
	xyguide.man xydoc.sty latin1.sty xydoc.bib xydoc.back \
	xyrefer.man $(KERNELSOURCES) $(LATEXSTYLES) $(OPTIONSOURCES) \
	$(OPTIONDATA) $(MANUALDATA)
#
MANUALRUN = 	xyguide.dvi xyrefer.dvi
#
dvips = dvips
#
.SUFFIXES:	.man .$(dvips) .dvi
.man.$(dvips):
	$(MAKE) macros fonts
	echo "\\xyoption{$(dvips)}\xyoption{ps}" > xydoc.back
	$(LATEX) $<
	$(BIBTEX) $*
	[ -f $*.idx ] && makeindex $* || :
	$(LATEX) $<
	[ -f $*.idx ] && makeindex $* || :
	$(LATEX) $<
	mv $*.dvi $*.$(dvips)
	touch $*.$(dvips)
#
.$(dvips).dvi:
	echo "\\relax" > xydoc.back
	$(LATEX) $*.man
	touch $*.dvi
#
guide:		xyguide.dvi 
#
manual:		$(MANUALRUN)
install.manual:	manual
	-test -d $(TEXDOCDIR) || $(MKDIR) $(TEXDOCDIR)
	for f in $(MANUALRUN); do $(INSTALL) $$f $(TEXDOCDIR)/$$f; done
#
xyguide.$(dvips):	xyguide.man xydoc.sty latin1.sty xydoc.bib
xyrefer.$(dvips):	xyrefer.man xydoc.sty latin1.sty xydoc.bib \
	$(KERNELSOURCES) $(OPTIONSOURCES) $(MANUALDATA)
#
xyguide.dvi:	xyguide.$(dvips)
xyrefer.dvi:	xyrefer.$(dvips)
#
xy$(SHORTVERSION)dict.pro: xydocps.doc
	-$(RM) xy$(SHORTVERSION)dict.pro
	sed -e 's/%%SHORTVERSION%%/$(SHORTVERSION)/' \
		< xydocps.doc > xydocps.tex
	$(TEX) xydocps.tex
#
# PostScript targets:
#
# DVIPS should be Tom Rokicki's dvips PostScript DVI driver.
DVIPS = dvips -ta4 -D300 -f
#
.SUFFIXES:	.ps
.dvips.ps:;	$(DVIPS) < $< > $@
#
xyguide.ps:	xyguide.dvips $(PSRUN)
xyrefer.ps:	xyrefer.dvips $(PSRUN)
#
manual.ps:	xyguide.ps xyrefer.ps


# TeXNICAL DOCUMENTATION.
#
.PHONY:		TeXnical
TeXnical:	xysource.ps xysource.dvi
#
TeXNICALSOURCES = xysource.man COPYING.ed xydoc.back
#
TeXNICALAUX = \
	TRAILER CATALOG README $(INSTALLSTAR) MAKE MANIFEST COPYING.tex
#
xysource.$(dvips): xysource.man macros.tmp \
		macros fonts obsoletefonts $(ALLSOURCES) $(TeXNICALAUX)
#
xysource.ps:	xysource.dvips
xysource.dvi:	xysource.$(dvips)
#
COPYING.tex: COPYING COPYING.ed
	(cat COPYING.ed; echo w COPYING.tex; echo q) | ed - COPYING
#
# Macro index...requires GNU AWK (gawk) or (in a pinch) NAWK.
#
GAWK = gawk
#
macros.tmp: $(KERNELSOURCES) $(LATEXSTYLES) $(OPTIONSOURCES) $(METAFONTS)
	-$(RM) macros.tmp
	for f in $(KERNELSOURCES) $(LATEXSTYLES) $(OPTIONSOURCES) $(METAFONTS);\
	do $(GAWK) '\
	  func err(s) { printf("%s,%d: %s\n",FILENAME,FNR,s) >>"/dev/stderr"};\
	  func prt(s,i) { \
	   printf("\\filelinedef{%s}{%d}\\index def{%s}\n",FILENAME,FNR,s) };\
	  func prtdef(i) { t = substr($$0,i);\
	   if (match(t,/[\\|][a-zA-Z@]*|\\.|[^\\|]|{([^{}]|\\{|\\})*}/) != 1) \
	    err("Weird TeX token");\
	   else prt(substr($$0,i,RLENGTH),i) };\
	  func prtcsdef(i) { t = substr($$0,i);\
	   if (match(t,/{([^{}]|\\{|\\})*}|{([^{}]|\\{|\\})*{([^{}]|\\{|\\})*}([^{}]|\\{|\\})*}/) != 1) \
	    err("Weird TeX cs name token");\
	   else prt(substr($$0,i+1,RLENGTH-2),i) };\
	  /^\\let[^A-Za-z@]/		||\
	  /^\\def[^A-Za-z@]/		{ prtdef(5); next };\
	  /^\\gdef[^A-Za-z@]/		||\
	  /^\\edef[^A-Za-z@]/		||\
	  /^\\xdef[^A-Za-z@]/		{ prtdef(6); next };\
	  /^\\newif[^A-Za-z@]/		{ prtdef(7); next };\
	  /^\\xydef@[^A-Za-z@]/		||\
	  /^\\xylet@[^A-Za-z@]/		{ prtdef(8); next };\
	  /^\\xyfont@[^A-Za-z@]/	{ prtdef(9); next };\
	  /^\\global\\let[^A-Za-z@]/	{ prtdef(12); next };\
	  /^\\xywarnifdefined[^A-Za-z@]/ { prtdef(17); next };\
	  /^\\ifx\\undefined[^A-Za-z@]/ { prtdef(15); next };\
	  /^\\xynew@{[^{}]*}/		{ prtdef(index($$0,"}")+1); next };\
	  /^\\xydefcsname@{/		{ prtcsdef(14); next };\
	  /^\\xyletcsnamecsname@{/	{ prtcsdef(20); next }' $$f;\
	done | sed -e 's,\\{,\\\\otherebgroup,' -e 's,\\},\\\\otheregroup,' \
	> macros.tmp

###printf("\\macroentry{%s}{%s}{%d}\n",s,FILENAME,FNR) };\


# DISTRIBUTION TREE.
#
PUB = $(USR)/pub
DISTDIR = $(PUB)/xy-$(VERSION)
DISTFONTDIR = $(DISTDIR)/$(PK)fonts/$${mode}$${dpi}
#
# Files:
#
SOURCES = $(MACROSOURCES) $(FONTSOURCES) $(MANUALSOURCES)
#
# Commands:
#
# TAR <files>		output tar archive with <files>
# GZIP			compression filter
# GZ			filename extension appropriate for compressed files
#
# TODO: change compression to proper GNU gzip once everyone supports it...
#
TAR = tar cvf -
GZIP = gzip -v9
GZ = .gz
#
# Targets:
#
.PHONY: dist dist-$(VERSION) distsrc distrun distps
#
dist dist-$(VERSION):
	cd $(DISTDIR);\
	  find . -type f -print | sed 's,^./,,' | sort > MANIFEST
	$(INSTALL) README $(DISTDIR)/README
#
distsrc:	$(DISTDIR)/src
#
distrun:	$(DISTDIR)/CATALOG \
		$(DISTDIR)/TRAILER \
		$(DISTDIR)/README \
		$(DISTDIR)/INSTALL \
		$(DISTDIR)/VERSIONS \
		$(DISTDIR)/texinputs \
		$(DISTDIR)/texfonts \
		$(DISTDIR)/mfinputs \
		$(DISTDIR)/$(PK)fonts \
		$(DISTDIR)/doc/xyguide.dvi \
		$(DISTDIR)/doc/xyrefer.dvi \
		$(DISTDIR)/doc/xyguide-html \
		$(DISTDIR)/ps \
		$(DISTDIR)/psfonts \
		$(DISTDIR)/COPYING
#
distps:		$(DISTDIR)/doc/xyguide.ps \
		$(DISTDIR)/doc/xyrefer.ps
#
# Explanation targets:
#
# CATALOG is automatically generated:
#
$(DISTDIR)/CATALOG: CATALOG $(DISTDIR)
	$(INSTALL) CATALOG $(DISTDIR)/CATALOG
#
CATALOG:	CATALOG.doc
	$(LATEX) CATALOG.doc
	mv -f CATALOG.out CATALOG

$(DISTDIR)/TRAILER: TRAILER $(DISTDIR)
	$(INSTALL) TRAILER $(DISTDIR)/TRAILER

$(DISTDIR)/README: README $(DISTDIR)
	$(INSTALL) README $(DISTDIR)/README
 
$(DISTDIR)/VERSIONS: VERSIONS $(DISTDIR)
	$(INSTALL) VERSIONS $(DISTDIR)/VERSIONS

$(DISTDIR)/INSTALL: $(INSTALLSTAR) $(DISTDIR)
	for f in $(INSTALLSTAR); do if test -f "$$f"; then \
	  $(INSTALL) $$f $(DISTDIR)/$$f; else :; fi; done

$(DISTDIR)/COPYING: COPYING $(DISTDIR)
	$(INSTALL) COPYING $(DISTDIR)/COPYING
#
# Directory targets:
#
$(DISTDIR):
	-test -d $(DISTDIR) || $(MKDIR) $(DISTDIR)

$(DISTDIR)/src: $(SOURCES) MANIFEST VERSIONS ChangeLog $(DISTDIR)
	-test -d $(DISTDIR)/src || $(MKDIR) $(DISTDIR)/src
	for f in $(SOURCES); do echo $$f; done | sort -fu |\
	 while read u; do $(INSTALL) $$u $(DISTDIR)/src/$$u; done
	echo "\\relax" > xydoc.back
	$(INSTALLW) xydoc.back $(DISTDIR)/src
	$(INSTALLW) MANIFEST VERSIONS ChangeLog $(DISTDIR)/src

xydoc.back:
	echo "\\relax" > xydoc.back
#
# The MANIFEST in src is just a list of the distributed source files.
#
MANIFEST:	$(SOURCES)
	ls -alg `for f in $(SOURCES); do echo $$f; done | sort -fu` >MANIFEST
#
# The VERSIONS is just a list of the RCS versions.
#
VERSIONS:	$(SOURCES)
	sed -n 's/^.*\([$$]Id:[^$$]*[$$]\).*$$/\1/p' \
	 `for f in $(SOURCES); do echo $$f; done | sort -fu` >VERSIONS

$(DISTDIR)/texinputs: macros $(DISTDIR)
	-test -d $(DISTDIR)/texinputs \
	 || $(MKDIR) $(DISTDIR)/texinputs
	for f in $(MACRORUN) $(LATEXSTYLES); \
	 do $(INSTALL) $$f $(DISTDIR)/texinputs/$$f; done

$(DISTDIR)/texfonts: texfonts obsoletefonts $(DISTDIR)
	-test -d $(DISTDIR)/texfonts \
	 || $(MKDIR) $(DISTDIR)/texfonts
	for f in $(TEXFONTRUN) $(OBSOLETETEXFONTRUN); \
	 do $(INSTALL) $$f $(DISTDIR)/texfonts/$$f; done

$(DISTDIR)/mfinputs: mfinputs $(OBSOLETEMETAFONTS) $(DISTDIR)
	-test -d $(DISTDIR)/mfinputs || $(MKDIR) $(DISTDIR)/mfinputs
	for f in $(METAFONTS) $(OBSOLETEMETAFONTS); \
	 do $(INSTALL) $$f $(DISTDIR)/mfinputs/$$f; done

$(DISTDIR)/$(PK)fonts: $(PK)fonts $(DISTDIR)
	-test -d $(DISTDIR)/$(PK)fonts || $(MKDIR) $(DISTDIR)/$(PK)fonts
	for f in $(PKFONTRUN); do if test -f "$$f"; then \
	  dpi=`expr "$$f" : '.*\.\([0-9]*\)[a-z]*$$'`; \
	  mode=$(MODE); test -d "$(DISTFONTDIR)" || $(MKDIR) $(DISTFONTDIR); \
	  $(INSTALL) $$f $(DISTFONTDIR)/$$f; else :; fi; done

$(DISTDIR)/ps: xy$(SHORTVERSION)dict.pro xypic.map $(DISTDIR)
	-test -d $(DISTDIR)/ps || $(MKDIR) $(DISTDIR)/ps
	$(INSTALL) xy$(SHORTVERSION)dict.pro $(DISTDIR)/ps
	$(INSTALL) xypic.map $(DISTDIR)/ps

$(DISTDIR)/psfonts: $(TYPE1FONTS) $(DISTDIR)
	-test -d $(DISTDIR)/psfonts || $(MKDIR) $(DISTDIR)/psfonts
	for f in $(TYPE1FONTS) ; \
	 do $(INSTALL) $$f $(DISTDIR)/psfonts/$$f; done

# Document targets:
#
$(DISTDIR)/doc/xyguide.dvi:	xyguide.dvi $(DISTDIR)/doc
	$(INSTALL) xyguide.dvi $(DISTDIR)/doc

$(DISTDIR)/doc/xyguide.ps:	xyguide.ps $(DISTDIR)/doc
	$(INSTALL) xyguide.ps $(DISTDIR)/doc

$(DISTDIR)/doc/xyguide-html:	xyguide-html $(DISTDIR)/doc
	tar cf - xyguide-html | (cd $(DISTDIR)/doc; tar xpvf -)

$(DISTDIR)/doc/xyrefer.dvi:	xyrefer.dvi $(DISTDIR)/doc
	$(INSTALL) xyrefer.dvi $(DISTDIR)/doc

$(DISTDIR)/doc/xyrefer.ps:	xyrefer.ps $(DISTDIR)/doc
	$(INSTALL) xyrefer.ps $(DISTDIR)/doc

$(DISTDIR)/doc:
	-test -d $(DISTDIR)/doc || $(MKDIR) $(DISTDIR)/doc


# FTP'ABLE DISTRIBUTION.
#
FTPDIR = $(PUB)
FTPDOCDIR = $(PUB)/xy-$(VERSION)/doc
#
.PHONY:		ftp ftp-$(VERSION) ftpsrc ftprun ftpps ftphtml ftpunpacked
#
ftp ftp-$(VERSION):	ftpsrc ftprun ftpps ftphtml ftpunpacked
	$(INSTALL) TRAILER $(FTPDIR)/xy$(SHORTVERSION).TRAILER
#
ftpsrc $(FTPDIR)/xy$(SHORTVERSION)src.tar$(GZ): distsrc
	cd $(DISTDIR)/.. ;\
	 $(TAR) xy-$(VERSION)/src \
	 | $(GZIP) > $(FTPDIR)/xy$(SHORTVERSION)src.tar$(GZ)
#
ftprun $(FTPDIR)/xy$(SHORTVERSION)run.tar$(GZ): distrun $(DISTDIR)/doc
	cd $(DISTDIR)/.. ;\
	 $(TAR) \
	  `for f in $(TRAILERRUN); do echo xy-$(VERSION)/$$f; done` \
	  xy-$(VERSION)/doc/xyguide.dvi xy-$(VERSION)/doc/xyrefer.dvi \
	  xy-$(VERSION)/texinputs xy-$(VERSION)/texfonts \
	  xy-$(VERSION)/mfinputs xy-$(VERSION)/$(PK)fonts \
	  xy-$(VERSION)/ps \
	 | $(GZIP) > $(FTPDIR)/xy$(SHORTVERSION)run.tar$(GZ)
#
ftpps: 		xyguide.dvips xyguide.ps xyrefer.dvips xyrefer.ps
	$(GZIP) < xyguide.dvips > $(FTPDIR)/xyguide.dvips$(GZ)
	$(GZIP) < xyguide.ps    > $(FTPDIR)/xyguide.ps$(GZ)
	$(GZIP) < xyrefer.dvips > $(FTPDIR)/xyrefer.dvips$(GZ)
	$(GZIP) < xyrefer.ps    > $(FTPDIR)/xyrefer.ps$(GZ)
#
ftphtml: 	xyguide-html
	$(TAR) xyguide-html | $(GZIP) > $(FTPDIR)/xyguide-html.tar.gz
#
ftpunpacked: dist
	test $(DISTDIR) = $(FTPDIR)/xy-$(VERSION) || \
	 (cd $(DISTDIR)/.. ; tar cf - xy-$(VERSION) |(cd $(FTPDIR); tar xvf -))
	cd $(FTPDIR); rm -f xy; ln -s xy-$(VERSION) xy


# WWW/HTML DOCUMENTATION & HYPE.
#
WWWDIR = /vol/www/research-groups/topps/personal/kris
TOPPSDIR = /vol/www/research-groups/topps/activities
#
WWWSOURCES = Xy-pic.html Xy-pic.xbm Xy-pic.blurb man2html.gawk
#
.PHONY: 	www guide.html
#
LATEX2HTML = 	latex2html
man2html =	$(GAWK) -f man2html.gawk
#
guide.html:	xyguide-html
xyguide-html:	xyguide.dvips man2html.gawk
	$(RM) xyguide-html index*
	echo "\\xyoption{dvips}\xyoption{ps}" > xydoc.back
	$(man2html) <xyguide.man >index.tex
	$(man2html) <xyguide.aux >index.aux
	$(man2html) <xyguide.bbl >index.bbl
	$(man2html) <xyguide.ans >index.ans
	$(LATEX2HTML) \
	 -address '<a href="COPYING/"></a> <a href="http://www.diku.dk/users/kris/">Kristoffer H&oslash;gsbro Rose</a> &lt;<a href="mailto:kris@diku.dk">kris</a>@<a href="http://www.diku.dk/">diku.dk</a>&gt; / '"`date '+%B %e, %Y'`." \
	 index.tex
	mv index xyguide-html
	#
	#mv xyguide-html/index.html index.html~
	#sed '/<[/]HEAD>/s;^;<BASE HREF="http://www.diku.dk/~kris/xyguide-html/">;'\
	# index.html~ > xyguide-html/index.html
	(cd xyguide-html; \
	 cp /vol/www/images/latex2html/foot_motif.gif .; \
	 for f in *.html; do mv $$f $$f~; \
		gawk -f ../man2html-post.gawk $$f~ >$$f; done; \
	 (cd $$HOME/W3; tar cf - COPYING) | tar xpf - )
	(cd xyguide-html; \
	 $(RM) .I* .O* *.ppm *.xyc *.ans *.aux *.idx *.bbl *.log *.tex *~)
#
www:		Xy-pic.html Xy-pic.gif Xy-pic.blurb guide.html
	$(INSTALL) Xy-pic.html Xy-pic.gif $(WWWDIR)
	#
	# SPECIAL DIKU STUFF:
	$(INSTALL) Xy-pic.blurb $(TOPPSDIR)/xypic.blurb
	ln -f $(WWWDIR)/Xy-pic.html /vol/www/users/kris/Xy-pic.html
	#
	$(RM) $(WWWDIR)/xyguide-html
	$(MKDIR) $(WWWDIR)/xyguide-html
	tar -cf - xyguide-html | (cd $(WWWDIR); tar xvpf -)
#
# Transparent GIF creation.
#
Xy-pic.gif:	Xy-pic.xbm
	xbmtopbm < Xy-pic.xbm | pgmtoppm white | ppmtogif \
	 | giftrans -t1 > Xy-pic.gif


# ANNOUNCEMENTS.
#
MAILSOURCES = TRAILER Users mail.Users
#
.PHONY:		announce
announce:	$(MAILSOURCES)
	@./mail.Users


# TAGS for Emacs.
#
TAGS:	$(SOURCES)
	-$(RM) TAGS
	for f in `for ff in $(SOURCES); do echo $$ff; done |sort -u`;\
	do\
	 $(GAWK) '\
	  func err(s) { printf("%s,%d: %s\n",FILENAME,FNR,s) >>"/dev/stderr"};\
	  func prt(s,n) { printf("%s\177%d,%d\n",s,FNR,c+n) };\
	  func prtdef(i) { t = substr($$0,i);\
	   if (match(t,/[\\|][a-zA-Z@]*|\\.|[^\\|]|{([^{}]|\\{|\\})*}/) != 1) \
	    err("Weird TeX token");\
	   else prt(substr($$0,1,i+RLENGTH),i) };\
	  func prtcsdef(i) { t = substr($$0,i);\
	   if (match(t,/{([^{}]|\\{|\\})*}|{([^{}]|\\{|\\})*{([^{}]|\\{|\\})*}([^{}]|\\{|\\})*}/) != 1) \
	    err("Weird TeX cs name token");\
	   else prt(substr($$0,1,i+RLENGTH),i) };\
	  func fin() { c += length($$0) + 1; next };\
	  BEGIN { c = 0 };\
	  /^\\let[^A-Za-z@]/		||\
	  /^\\def[^A-Za-z@]/		{ prtdef(5); fin() };\
	  /^\\gdef[^A-Za-z@]/		||\
	  /^\\edef[^A-Za-z@]/		||\
	  /^\\xdef[^A-Za-z@]/		{ prtdef(6); fin() };\
	  /^\\newif[^A-Za-z@]/		{ prtdef(7); fin() };\
	  /^\\xydef@[^A-Za-z@]/		||\
	  /^\\xylet@[^A-Za-z@]/		{ prtdef(8); fin() };\
	  /^\\xyfont@[^A-Za-z@]/	{ prtdef(9); fin() };\
	  /^\\global\\let[^A-Za-z@]/	{ prtdef(12); fin() };\
	  /^\\xywarnifdefined[^A-Za-z@]/ { prtdef(17); fin() };\
	  /^\\ifx\\undefined[^A-Za-z@]/ { prtdef(15); fin() };\
	  /^\\xynew@{[^{}]*}/		{ prtdef(index($$0,"}")+1); fin() };\
	  /^\\xydefcsname@{/		{ prtcsdef(14); fin() };\
	  /^\\xyletcsnamecsname@{/	{ prtcsdef(20); fin() };\
	  /\?\?\=\[/	{ s = $$0; i = 0;\
	   while (first = index(s, "\?\?=[")) {\
	    s = substr(s,first+4); i += first+4;\
	    if (j = index(s, "]")) prt(substr($$0,1,i+j-1),i);\
	    else printf("Unmatched []s") }; fin() };\
	  /^@[A-Za-z]*{/ { prt($$0,index($$0,"{")+1); fin() };\
	  { fin() }' $$f >TAGS.tmp ;\
	 wc -c TAGS.tmp|$(GAWK) '{printf "\f\n%s,%s\n","'"$$f"'",$$1}'>>TAGS;\
	 cat TAGS.tmp >>TAGS ;\
	done
	$(RM) TAGS.tmp


# RCS STUFF:
#
.PHONY: 	co co-$(VERSION) ci ci-$(VERSION) cici rcscheck \
		rcslist rcslockedlist rcsunlockedlist \
		rcscleanlist rcsuncleanlist rcsclean rcsdep
#
ALLSOURCES = $(TRAILERSOURCES) $(SOURCES) $(MANUALSOURCES) $(TeXNICALSOURCES) \
	$(WWWSOURCES) $(MAILSOURCES) $(OBSOLETEMETAFONTS) $(TYPE1FONTS) \
	xypic.map
#
ROSSSOURCES = INSTALL.OzTeX INSTALL.Textures import1.eps ross.eps \
	xy16textures.doc xy17oztex.doc xy2cell.doc xyarc.doc \
	xyatip10.pfa xybsql10.pfa xybtip10.pfa xycirc10.pfa xycmat10.pfa \
	xycmbt10.pfa xycolor.doc xycrayon.doc xycurve.doc xydash10.pfa \
	xydvips.doc xydvips.tex xyimport.doc xyknot.doc xyline.doc \
	xymacpat.xyp xyoztex.doc xypoly.doc xyps-c.doc xyps-col.doc \
	xyps-f.doc xyps-l.doc xyps-pro.doc xyps-ps.doc xyps-r.doc \
	xyps-s.doc xyps-t.doc xyps.doc xypsdict.doc xypspatt.doc xyrotate.doc \
	xytextures.doc xytile.doc xytpic.doc xyemtex.doc xyweb.doc \
	xydvidrv.doc xyxdvi.doc xydvitops.doc xytp-f.doc xycmactex.doc
#
co co-$(VERSION):
	($(MAKE) rcslist | while read f; do $(MAKE) $$f; done)
#
ci ci-$(VERSION): co cici Makefile
cici:		$(ALLSOURCES)
	#-rcs -l `for f in $(ALLSOURCES); do echo $$f; done | sort -u`
	-ci -u$(VERSION) -wross $(ROSSSOURCES)
	-ci -u$(VERSION) `$(MAKE) rcslockedlist`
#
rcscheck:	$(ALLSOURCES)
	@locked="`make rcslockedlist`"; \
	 unlocked="`make rcsunlockedlist`"; \
	 echo "Missing write permission on locked files:"; \
	 for f in $$locked; do [ -w "$$f" ] || echo ' '$$f; done; \
	 echo "Wrong write permission on unlocked files:"; \
	 for f in $$unlocked; do [ -w "$$f" ] && echo ' '$$f; done; \
	 echo "Wrong/missing locks on ross's files:"; \
	 for f in $(ROSSSOURCES); \
	 do lock=; \
	    for ff in $$locked; \
	    do if [ "$$f" = "$$ff" ]; then lock=' ross'; fi; done; \
	    fgrep -qs " ross Exp$$lock "'$$' $$f \
	     ||(/bin/echo ' '$$f': \c' && grep 'Id:.* Exp ' $$f || echo '?'); \
	 done; \
	 echo "Wrong/missing locks on kris's files:"; \
	 for f in `make rcslist`; \
	 do for ff in $(ROSSSOURCES); \
	    do if [ "$$f" = "$$ff" ]; then continue 2; fi; done; \
	    lock=; \
	    for ff in $$locked; \
	    do if [ "$$f" = "$$ff" ]; then lock=' kris'; fi; done; \
	     fgrep -qs " kris Exp$$lock "'$$' $$f \
	     || (/bin/echo ' '$$f' \c' && grep 'Id:.* Exp ' $$f || echo ''); \
	 done
#
rcslist:
	-@rlog -R `for f in $(ALLSOURCES); do echo $$f; done | sort -u` \
	  2>/dev/null | sed 's;RCS/\(.*\),v;\1;'
#
rcslockedlist:
	-@rlog -R -L `for f in $(ALLSOURCES); do echo $$f; done | sort -u` \
	  2>/dev/null | sed 's;RCS/\(.*\),v;\1;'
#
rcsunlockedlist:
	-@locked="`make rcslockedlist`"; \
	  make rcslist | while read f; \
	  do echo=echo; for ff in $$locked; \
	                do if [ "$$f" = "$$ff" ]; then echo=:; fi; done; \
	     $$echo $$f; done
#
rcscleanlist:
	-@$(MAKE) rcslist \
	 | while read f; do if test -w "$$f" -o "$$f" = Makefile; then :; \
	                    else echo $$f; fi; done
#
rcsuncleanlist:
	-@$(MAKE) rcslist \
	 | while read f; do if test -w "$$f" -o "$$f" = Makefile; \
	                    then echo $$f; fi; done
#
rcsclean:
	-@$(MAKE) rcscleanlist | while read f; do $(RM) $$f; done
#
# Dependencies...
#
rcsdep:
	$(MAKE) rcslist | while read f; do \
	  echo "$$f: RCS/$$f,v; test -d RCS && co $$f || :"; done

CATALOG.doc:; test -d RCS -a -f RCS/CATALOG.doc,v && co CATALOG.doc || :
COPYING.ed:; test -d RCS -a -f RCS/COPYING.ed,v && co COPYING.ed || :
COPYING:; test -d RCS -a -f RCS/COPYING,v && co COPYING || :
INSTALL.OzTeX:; test -d RCS -a -f RCS/INSTALL.OzTeX,v && co INSTALL.OzTeX || :
INSTALL.Textures:; test -d RCS -a -f RCS/INSTALL.Textures,v && co INSTALL.Textures || :
INSTALL:; test -d RCS -a -f RCS/INSTALL,v && co INSTALL || :
MAKE:; test -d RCS -a -f RCS/MAKE,v && co MAKE || :
Makefile:; test -d RCS -a -f RCS/Makefile,v && co Makefile || :
README:; test -d RCS -a -f RCS/README,v && co README || :
TRAILER:; test -d RCS -a -f RCS/TRAILER,v && co TRAILER || :
Users:; test -d RCS -a -f RCS/Users,v && co Users || :
import1.eps:; test -d RCS -a -f RCS/import1.eps,v && co import1.eps || :
kris.eps:; test -d RCS -a -f RCS/kris.eps,v && co kris.eps || :
latin1.sty:; test -d RCS -a -f RCS/latin1.sty,v && co latin1.sty || :
mail.Users:; test -d RCS -a -f RCS/mail.Users,v && co mail.Users || :
man2html.gawk:; test -d RCS -a -f RCS/man2html.gawk,v && co man2html.gawk || :
ross.eps:; test -d RCS -a -f RCS/ross.eps,v && co ross.eps || :
xy.doc:; test -d RCS -a -f RCS/xy.doc,v && co xy.doc || :
xy.sty:; test -d RCS -a -f RCS/xy.sty,v && co xy.sty || :
xy16textures.doc:; test -d RCS -a -f RCS/xy16textures.doc,v && co xy16textures.doc || :
xy17oztex.doc:; test -d RCS -a -f RCS/xy17oztex.doc,v && co xy17oztex.doc || :
xy2cell.doc:; test -d RCS -a -f RCS/xy2cell.doc,v && co xy2cell.doc || :
xyall.doc:; test -d RCS -a -f RCS/xyall.doc,v && co xyall.doc || :
xyamslatex.ini:; test -d RCS -a -f RCS/xyamslatex.ini,v && co xyamslatex.ini || :
xyarc.doc:; test -d RCS -a -f RCS/xyarc.doc,v && co xyarc.doc || :
xyarrow.doc:; test -d RCS -a -f RCS/xyarrow.doc,v && co xyarrow.doc || :
xyatip10.mf:; test -d RCS -a -f RCS/xyatip10.mf,v && co xyatip10.mf || :
xyatip10.pfa:; test -d RCS -a -f RCS/xyatip10.pfa,v && co xyatip10.pfa || :
xybsql10.mf:; test -d RCS -a -f RCS/xybsql10.mf,v && co xybsql10.mf || :
xybsql10.pfa:; test -d RCS -a -f RCS/xybsql10.pfa,v && co xybsql10.pfa || :
xybtip10.mf:; test -d RCS -a -f RCS/xybtip10.mf,v && co xybtip10.mf || :
xybtip10.pfa:; test -d RCS -a -f RCS/xybtip10.pfa,v && co xybtip10.pfa || :
xycirc10.mf:; test -d RCS -a -f RCS/xycirc10.mf,v && co xycirc10.mf || :
xycirc10.pfa:; test -d RCS -a -f RCS/xycirc10.pfa,v && co xycirc10.pfa || :
xycmactex.doc:; test -d RCS -a -f RCS/xycmactex.doc,v && co xycmactex.doc || :
xycmat10.mf:; test -d RCS -a -f RCS/xycmat10.mf,v && co xycmat10.mf || :
xycmat10.pfa:; test -d RCS -a -f RCS/xycmat10.pfa,v && co xycmat10.pfa || :
xycmbt10.mf:; test -d RCS -a -f RCS/xycmbt10.mf,v && co xycmbt10.mf || :
xycmbt10.pfa:; test -d RCS -a -f RCS/xycmbt10.pfa,v && co xycmbt10.pfa || :
xycmtip.doc:; test -d RCS -a -f RCS/xycmtip.doc,v && co xycmtip.doc || :
xycolor.doc:; test -d RCS -a -f RCS/xycolor.doc,v && co xycolor.doc || :
xycrayon.doc:; test -d RCS -a -f RCS/xycrayon.doc,v && co xycrayon.doc || :
xycurve.doc:; test -d RCS -a -f RCS/xycurve.doc,v && co xycurve.doc || :
xyd.mf:; test -d RCS -a -f RCS/xyd.mf,v && co xyd.mf || :
xyd2.mf:; test -d RCS -a -f RCS/xyd2.mf,v && co xyd2.mf || :
xydash10.mf:; test -d RCS -a -f RCS/xydash10.mf,v && co xydash10.mf || :
xydash10.pfa:; test -d RCS -a -f RCS/xydash10.pfa,v && co xydash10.pfa || :
xydoc.bib:; test -d RCS -a -f RCS/xydoc.bib,v && co xydoc.bib || :
xydoc.sty:; test -d RCS -a -f RCS/xydoc.sty,v && co xydoc.sty || :
xydocps.doc:; test -d RCS -a -f RCS/xydocps.doc,v && co xydocps.doc || :
xydriver.doc:; test -d RCS -a -f RCS/xydriver.doc,v && co xydriver.doc || :
xydummy.doc:; test -d RCS -a -f RCS/xydummy.doc,v && co xydummy.doc || :
xydvidrv.doc:; test -d RCS -a -f RCS/xydvidrv.doc,v && co xydvidrv.doc || :
xydvips.doc:; test -d RCS -a -f RCS/xydvips.doc,v && co xydvips.doc || :
xydvitops.doc:; test -d RCS -a -f RCS/xydvitops.doc,v && co xydvitops.doc || :
xyemtex.doc:; test -d RCS -a -f RCS/xyemtex.doc,v && co xyemtex.doc || :
xyframe.doc:; test -d RCS -a -f RCS/xyframe.doc,v && co xyframe.doc || :
xygraph.doc:; test -d RCS -a -f RCS/xygraph.doc,v && co xygraph.doc || :
xyguide.man:; test -d RCS -a -f RCS/xyguide.man,v && co xyguide.man || :
xyidioms.doc:; test -d RCS -a -f RCS/xyidioms.doc,v && co xyidioms.doc || :
xyimport.doc:; test -d RCS -a -f RCS/xyimport.doc,v && co xyimport.doc || :
xyknot.doc:; test -d RCS -a -f RCS/xyknot.doc,v && co xyknot.doc || :
xylatex.ini:; test -d RCS -a -f RCS/xylatex.ini,v && co xylatex.ini || :
xyline.doc:; test -d RCS -a -f RCS/xyline.doc,v && co xyline.doc || :
xyline10.mf:; test -d RCS -a -f RCS/xyline10.mf,v && co xyline10.mf || :
xymacpat.xyp:; test -d RCS -a -f RCS/xymacpat.xyp,v && co xymacpat.xyp || :
xymatrix.doc:; test -d RCS -a -f RCS/xymatrix.doc,v && co xymatrix.doc || :
xymisc10.mf:; test -d RCS -a -f RCS/xymisc10.mf,v && co xymisc10.mf || :
xyoztex.doc:; test -d RCS -a -f RCS/xyoztex.doc,v && co xyoztex.doc || :
xypic.doc:; test -d RCS -a -f RCS/xypic.doc,v && co xypic.doc || :
xypic.map:; test -d RCS -a -f RCS/xypic.map,v && co xypic.map || :
xypic.sty:; test -d RCS -a -f RCS/xypic.sty,v && co xypic.sty || :
xypoly.doc:; test -d RCS -a -f RCS/xypoly.doc,v && co xypoly.doc || :
xyps-c.doc:; test -d RCS -a -f RCS/xyps-c.doc,v && co xyps-c.doc || :
xyps-col.doc:; test -d RCS -a -f RCS/xyps-col.doc,v && co xyps-col.doc || :
xyps-dto.doc:; test -d RCS -a -f RCS/xyps-dto.doc,v && co xyps-dto.doc || :
xyps-dvi.doc:; test -d RCS -a -f RCS/xyps-dvi.doc,v && co xyps-dvi.doc || :
xyps-f.doc:; test -d RCS -a -f RCS/xyps-f.doc,v && co xyps-f.doc || :
xyps-l.doc:; test -d RCS -a -f RCS/xyps-l.doc,v && co xyps-l.doc || :
xyps-one.doc:; test -d RCS -a -f RCS/xyps-one.doc,v && co xyps-one.doc || :
xyps-oz.doc:; test -d RCS -a -f RCS/xyps-oz.doc,v && co xyps-oz.doc || :
xyps-pro.doc:; test -d RCS -a -f RCS/xyps-pro.doc,v && co xyps-pro.doc || :
xyps-ps.doc:; test -d RCS -a -f RCS/xyps-ps.doc,v && co xyps-ps.doc || :
xyps-pub.doc:; test -d RCS -a -f RCS/xyps-pub.doc,v && co xyps-pub.doc || :
xyps-r.doc:; test -d RCS -a -f RCS/xyps-r.doc,v && co xyps-r.doc || :
xyps-s.doc:; test -d RCS -a -f RCS/xyps-s.doc,v && co xyps-s.doc || :
xyps-t.doc:; test -d RCS -a -f RCS/xyps-t.doc,v && co xyps-t.doc || :
xyps-txo.doc:; test -d RCS -a -f RCS/xyps-txo.doc,v && co xyps-txo.doc || :
xyps-txt.doc:; test -d RCS -a -f RCS/xyps-txt.doc,v && co xyps-txt.doc || :
xyps-wdo.doc:; test -d RCS -a -f RCS/xyps-wdo.doc,v && co xyps-wdo.doc || :
xyps.doc:; test -d RCS -a -f RCS/xyps.doc,v && co xyps.doc || :
xypsdict.doc:; test -d RCS -a -f RCS/xypsdict.doc,v && co xypsdict.doc || :
xypspatt.doc:; test -d RCS -a -f RCS/xypspatt.doc,v && co xypspatt.doc || :
xyqc10.mf:; test -d RCS -a -f RCS/xyqc10.mf,v && co xyqc10.mf || :
xyrecat.doc:; test -d RCS -a -f RCS/xyrecat.doc,v && co xyrecat.doc || :
xyrefer.man:; test -d RCS -a -f RCS/xyrefer.man,v && co xyrefer.man || :
xyrotate.doc:; test -d RCS -a -f RCS/xyrotate.doc,v && co xyrotate.doc || :
xysource.man:; test -d RCS -a -f RCS/xysource.man,v && co xysource.man || :
xystyle.doc:; test -d RCS -a -f RCS/xystyle.doc,v && co xystyle.doc || :
xytex.ini:; test -d RCS -a -f RCS/xytex.ini,v && co xytex.ini || :
xytextures.doc:; test -d RCS -a -f RCS/xytextures.doc,v && co xytextures.doc || :
xyxdvi.doc:; test -d RCS -a -f RCS/xyxdvi.doc,v && co xyxdvi.doc || :
xytile.doc:; test -d RCS -a -f RCS/xytile.doc,v && co xytile.doc || :
xytpic.doc:; test -d RCS -a -f RCS/xytpic.doc,v && co xytpic.doc || :
xytp-f.doc:; test -d RCS -a -f RCS/xytp-f.doc,v && co xytp-f.doc || :
xyv2.doc:; test -d RCS -a -f RCS/xyv2.doc,v && co xyv2.doc || :
xyweb.doc:; test -d RCS -a -f RCS/xyweb.doc,v && co xyweb.doc || :

Xy-pic.html:; test -d RCS -a -f RCS/Xy-pic.html,v && co Xy-pic.html || :
Xy-pic.blurb:; test -d RCS -a -f RCS/Xy-pic.blurb,v && co Xy-pic.blurb || :
Xy-pic.xbm:; test -d RCS -a -f RCS/Xy-pic.xbm,v && co Xy-pic.xbm || :


# DEVELOPMENT TARGETS:
#
.PHONY:		Install Ftpsrc Ftp Ftpps World Release

Install:
	$(MAKE) USR=$$SYS TEXFONTDIR=$$SYS/lib/tex/fonts \
			     FONTDIR=$$SYS/lib/tex/fonts install

Ftpsrc:
	$(MAKE) PUB=$$HOME/pub ftpsrc

Ftp:
	$(MAKE) PUB=$$HOME/pub MAGS='0 0.5 1 2' ftp

Ftpps:
	$(MAKE) PUB=$$HOME/pub MAGS='0 0.5 1 2' ftpps

Ftphtml:	www
	$(MAKE) PUB=$$HOME/pub MAGS='0 0.5 1 2' ftphtml

World:		realclean rcsclean
	$(MAKE)	USR=$$SYS PUB=$$HOME/pub \
		TEXFONTDIR=$$SYS/lib/tex/fonts \
		FONTDIR=$$SYS/lib/tex/fonts \
		MAGS='0 0.5 1 2' \
	 world
	mv make.world make.World

RELEASEDIR = /vol/ftp/diku/users/kris/TeX

Release:	World www
	@echo "Updating ftp archive $(RELEASEDIR):";\
	 cd $$HOME/pub; \
	 diff -ur $(RELEASEDIR)/xy-$(VERSION) xy-$(VERSION) > FIX;\
	 find xy* -type f -print \
	 | while read f;\
	   do cmp -s $$f $(RELEASEDIR)/$$f\
	      || { echo $$f; $(MKDIR) `dirname $(RELEASEDIR)/$$f`;\
		   if [ -w $$f ]; then $(INSTALLW) $$f $(RELEASEDIR)/$$f;\
	           else                $(INSTALL)  $$f $(RELEASEDIR)/$$f;\
		   fi; };\
	   done


# LOG
#
# $Log: Makefile,v $
# Revision 3.2  1995/09/19  18:22:27  kris
# Bug fix release.
#
# Revision 3.1  1995/09/05  20:31:32  kris
# Releasing!
#
# Revision 3.0  1995/07/07  20:14:21  kris
# Major release w/new User's Guide!
#
# Revision 2.14  1995/07/06  02:56:02  kris
# Buglets...
#
# Revision 2.13  1995/07/04  15:10:01  kris
# Ready to release v3?
#
# Revision 2.12  1994/10/25  11:46:25  kris
# Interim release just before v3 [works with AMS-LaTeX 1.2]...
#
# Revision 2.11  1994/07/05  10:37:32  kris
# Third 3beta release [bug fixes].
# Experimental graph feature included (for ECCT-94 presentation).
#
# Revision 2.10  1994/06/15  13:35:19  kris
# Second 3beta release [bug fixes].
#
# Revision 2.9  1994/06/09  14:53:07  kris
# Release 3beta.
#
# Revision 2.8  1994/04/08  04:30:00  kris
# Second (bug fix) 3alpha release.
#
# Revision 2.7  1994/03/08  02:06:01  kris
# Release 3alpha.
#
# Revision 2.6.9.1  1994/03/07  04:22:46  kris
# Last internal 3alpha and pre-2.7 release.
#
# MAJOR REORGANISATION for version 2.7...
#
# Revision 2.6  1992/06/24  01:23:34  kris
# Ready to release v.2.6.
#
# Revision 2.5  1992/02/24  03:30:54  kris
# Default magsteps now just 0, 0.5, 1, and 2.
#
# Revision 2.3  1992/01/13  02:12:28  kris
# Fixed installation instructions and other details.
#
# Revision 2.1  1992/01/02  14:54:07  kris
# Release version.
#
# Revision 1.6  1991/12/17  04:51:16  kris
# Version distributed with `final draft' on Usenet.

# Tell Emacs that this is a Makefile and how it is formatted:
# Local Variables:
# mode:fundamental
# fill-prefix:"# "
# fill-column:77
# End:
