# Makes TstMgr and ErrRpt.lib
CC= lc:lc
CFLAGS= -cs -t
LIBS= lib:lc.lib lib:amiga.lib lib:debug.lib lib:ddebug.lib
LFLAGS= sc sd nd define __main=__tinymain
ASM = casm -a
ASMOPTS = -o
OFILES= \
	TstMgr_tm.o\
	TstMgr.o\
	tmgr_misc.o\
	akprintf.o\
	bsprintf.o
OFILES2= ErrRpt.o bsprintf.o
PROGNAME = TstMgr
#

all: $(PROGNAME) ErrReport.lib client
    @echo "Done compiling and linking."

$(PROGNAME):	$(OFILES)
    revit $(PROGNAME) pn $(PROGNAME) com "by J.W. Lockhart"
    $(ASM) $(PROGNAME)_rev.asm $(ASMOPTS) $(PROGNAME)_rev.o
    @echo "Linking $(PROGNAME)..."
	BLINK < WITH <
FROM lib:c.o $(PROGNAME)_rev.o $(OFILES)
LIB $(LIBS)
TO $(PROGNAME) $(LFLAGS)
<

client:	client.o ErrReport.lib
    @echo "Linking client..."
	BLINK < WITH <
FROM lib:c.o client.o $(OFILES2)
LIB lib:lc.lib ErrReport.lib lib:amiga.lib
TO client $(LFLAGS)
<

client.o: client.c\
        tmgr_common.h
        $(CC) -j73 $(CFLAGS) client.c

omllist:
        echo >omllist "r ErrRptLib_rev.o ErrRpt.o bsprintf.o*Nl"

ErrReport.lib: $(OFILES2) omllist
        revit ErrRptLib pn ErrReport_lib
        $(ASM) ErrRptLib_rev.asm $(ASMOPTS) ErrRptLib_rev.o
        oml <omllist ErrReport.lib

ErrRpt.o:  ErrRpt.c\
        tmgr_common.h\
        bsprintf.o
        $(CC) $(CFLAGS) ErrRpt.c

tmgr_misc.o: tmgr_misc.c\
        tmgr_common.h\
        TstMgr.h
		$(CC) $(CFLAGS) tmgr_misc.c

TstMgr_rev.h:	
		bumprev TstMgr_rev.h

TstMgr_tm.o:	TstMgr_tm.c\
		TstMgr_tm.h\
		TstMgr_text.h\
		TstMgr.h\
		TstMgr_tm_protos.h\
        tmgr_misc_protos.h
		$(CC) $(CFLAGS) TstMgr_tm.c

TstMgr_tm.h:	\
		tmgr_common.h
		touch TstMgr_tm.h

# note that protos must be EXPLICITY MADE.
TstMgr_tm_protos.h:
		touch TstMgr_tm_protos.h

# note that protos must be EXPLICITY MADE.
tmgr_misc_protos.h:
		touch tmgr_misc_protos.h

# note that protos must be EXPLICITY MADE.
TstMgr_protos.h:
		touch TstMgr_protos.h

TstMgr_text.h:	
		touch TstMgr_text.h

TstMgr.h:	\
		tmgr_common.h
		touch TstMgr.h

tmgr_common.h:	
		touch tmgr_common.h

TstMgr.o:	TstMgr_tm.h\
		TstMgr.h\
		tmgr_common.h\
		TstMgr_protos.h\
		tmgr_misc_protos.h\
		TstMgr.c
		$(CC) $(CFLAGS) TstMgr.c

akprintf.o: akprintf.asm
    $(ASM) akprintf.asm $(ASMOPTS) akprintf.o

bsprintf.o: bsprintf.asm
    $(ASM) bsprintf.asm $(ASMOPTS) bsprintf.o

clean:
    delete $(OFILES) ErrRpt.o ErrReport.lib

protos:
    lc -pr -oTstMgr_protos.h TstMgr.c
    lc -pr -oTstMgr_tm_protos.h TstMgr_tm.c
    lc -pr -otmgr_misc_protos.h tmgr_misc.c

df0: all
    @echo "Copying files to df0: ..."
    @copy $(PROGNAME) client df0: clone quiet
    @echo "All done!"
