#
#   Makefile for TeX82 distribution, subdirectory `=TeXware'
#
#   This file makes TANGLE, WEAVE, TFtoPL, PLtoTF, DVItype, PATGEN,
#   and pooltype from their WEB sources.
#
# modified for MS-DOS by Steve_Tinney@um.cc.umich.edu
 
# Note that `all' in this makefile means all except patgen
 
BINDIR=c:\util
 
ERR= >> err
 
CFLAGS=-AL -W3 -DOUT_BIN -Dlink=link_array -I../
# flags for weave---OUT_BIN stays undefined
WCFLAGS=-AL -W3 -Dlink=link_array -I../
DFLAGS=#-Zi -Zd # codeview debuggery, comment out for production version
LDFLAGS=
CC=cl
 
.SUFFIXES:
.SUFFIXES: .obj .c .p .ch
 
.p.c:
        convert $*
 
.ch.p:
        tangle $*.web $*.ch
 
.c.obj:
        $(CC) $(CFLAGS) $(DFLAGS) -c $*.c $(ERR)
 
default:        tangle
 
all:    tangle weave tftopl pltotf dvitype pooltype # patgen
 
install: all
        mv tangle.exe weave.exe tftopl.exe pltotf.exe dvitype.exe $(BINDIR) # patgen.exe
 
# Weave
weave.obj: weave.c web2c.h
        $(CC) $(WCFLAGS) $(DFLAGS) -c $*.c $(ERR)
weave: weave.obj weavext.obj
        $(CC) $(LDFLAGS) $(CFLAGS) $(DFLAGS) -Feweave weave.obj weavext.obj
        pack weave
weave.p: weave.web weave.ch
weave.c: weave.p
        convhuge weave
weavext.obj:    weavext.c ../site.h
 
# Tangle
tangle: tangle.obj tanext.obj
        $(CC) $(CFLAGS) $(DFLAGS) $(LDFLAGS) tangle tanext
        pack tangle
tangle.obj: tangle.c web2c.h
        $(CC) $(CFLAGS) $(DFLAGS) -c $*.c $(ERR)
tanext.obj: tanext.c ../site.h
 
# Commands to generate tangle.c from tangle.web
tangle.c: tangle.web tangle.ch
        tangle tangle.web tangle.ch
        convhuge tangle
 
# TFtoPL
tftopl: tftopl.obj plext.obj
        $(CC) $(CFLAGS) $(DFLAGS) -Fetftopl tftopl.obj plext.obj
        pack tftopl
tftopl.c: tftopl.p
        convert tftopl
tftopl.p: tftopl.web tftopl.ch
tftopl.obj: tftopl.c web2c.h
        $(CC) $(CFLAGS) $(DFLAGS) -c -Dindex=index_type tftopl.c $(ERR)
 
# PLtoTF
pltotf: pltotf.obj plext.obj
        $(CC) $(CFLAGS) $(DFLAGS) -Fepltotf pltotf.obj plext.obj
        pack pltotf
pltotf.p: pltotf.web pltotf.ch
pltotf.c: pltotf.p
        convert pltotf
pltotf.obj: pltotf.c web2c.h
        $(CC) $(CFLAGS) $(DFLAGS) -c -Dindex=index_array pltotf.c $(ERR)
plext.obj:  plext.c ../site.h
 
# DVItype
dvitype: dvitype.obj dvityext.obj
        $(CC) $(CFLAGS) $(DFLAGS) -Fedvitype dvitype.obj dvityext.obj
        pack dvitype
dvityext.obj: dvityext.c ../site.h
dvitype.obj: dvitype.c web2c.h
        $(CC) $(CFLAGS) $(DFLAGS) -c dvitype.c $(ERR)
dvitype.p: dvitype.web dvitype.ch
dvitype.c: dvitype.p
        convert dvitype
 
# PatGen
patgen: patgen.obj plext.obj
        $(CC) $(CFLAGS) $(DFLAGS) -Fepatgen patgen.obj plext.obj
        pack patgen
patgen.p: patgen.web patgen.ch
patgen.c: patgen.p
        convert patgen
patgen.obj: patgen.c web2c.h
        $(CC) $(CFLAGS) $(DFLAGS) -c patgen.c $(ERR)
 
# POOLtype
pooltype: pooltype.obj plext.obj
        $(CC) $(CFLAGS) $(DFLAGS) -Fepooltype pooltype.obj plext.obj
pooltype.p: pooltype.web pooltype.ch
pooltype.c: pooltype.p
        convert pooltype
pooltype.obj: pooltype.c web2c.h
        $(CC) $(CFLAGS) $(DFLAGS) -c pooltype.c $(ERR)
 
clean:
        del *.p
        del *.poo
        del *.obj
        del err
 
# NB: we don't use *.c or *.h here because we *never* want to delete the
# bootstrapping version of tangle.c|h, nor do dvityext, tanext or weavext
# want to be deleted here.
very_clean:     clean
        del weave.c
        del dvitype.c
        del tftopl.c
        del pltotf.c
        del patgen.c
        del pooltype.c
        del weave.h
        del dvitype.h
        del tftopl.h
        del pltotf.h
        del patgen.h
        del pooltype.h
        del *.exe
