#############################################################################
#
#                   Copyright (C) 1993 Kendall Bennett.
#                           All rights reserved.
#
# Descripton:   Makefile for the MegaGraph graphics library test programs.
#               MSDOS version for Borland C++ 3.1
#
# $Id$
#
#############################################################################

# Turn on autodependency checking

.AUTODEPEND

# Let make know where to find all the appropriate files

.PATH.asm       = .
.PATH.lib       = \bc\lib\mylib
.PATH.obj       = .
.PATH.exe       = .

CC              = bcc               # Name of C compiler
ASM             = tasm              # Name of assembler
LINK            = tlink             # Name of linker
LIB             = tlib              # Name of librarian
LIB_FLAGS       = /C /E

!if $d(debug)
CC_DOPT         = -v                # Turn on debugging for C compiler
ASM_DOPT        = /ZI               # Turn on debugging for assembler
!endif

# Always compile stuff in the large memory model.

MODEL           = l
ASM_MODEL       = /d__LARGE__
LIBS            = mgraph.lib ztimer_l.lib

ASM_FLAGS       = /MX /m /i$(.PATH.asm) $(ASM_DOPT) $(ASM_MODEL)
CC_FLAGS        = -m$(MODEL) $(CC_DOPT)

# Implicit rules to make the object files for the library...

.c.obj:
    $(CC) $(CC_FLAGS) -c {$< }

.asm.obj:
	$(ASM) $(ASM_FLAGS) $<, $(.PATH.obj)\$&

OBJS    = main.obj getopt.obj

all:    mgldemo.exe ffilltst.exe tests

tests:  test1.exe test2.exe test3.exe test4.exe test5.exe test6.exe     \
		test7.exe test8.exe test9.exe test10.exe test11.exe test12.exe  \
		test13.exe test14.exe test15.exe test16.exe test17.exe          \
        test18.exe test19.exe test20.exe test21.exe test22.exe          \
        test23.exe

mgldemo.obj: mgldemo.c
    $(CC) $(CC_FLAGS) -DFLOODFILL_DEMO -c mgldemo.c

mgldemo.exe: mgldemo.obj ffill.obj
    $(CC) $(CC_FLAGS) -e$< mgldemo.obj ffill.obj mgraph.lib

ffilltst.exe: ffilltst.obj ffill.obj $(OBJS)
    $(CC) $(CC_FLAGS) -e$< ffilltst.obj ffill.obj $(OBJS) $(LIBS)

test1.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST1 testgr.c $(OBJS) $(LIBS)

test2.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST2 testgr.c $(OBJS) $(LIBS)

test3.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST3 testgr.c $(OBJS) $(LIBS)

test4.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST4 testgr.c $(OBJS) $(LIBS)

test5.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST5 testgr.c $(OBJS) $(LIBS)

test6.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST6 testgr.c $(OBJS) $(LIBS)

test7.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST7 testgr.c $(OBJS) $(LIBS)

test8.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST8 testgr.c $(OBJS) $(LIBS)

test9.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST9 testgr.c $(OBJS) $(LIBS)

test10.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST10 testgr.c $(OBJS) $(LIBS)

test11.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST11 testgr.c $(OBJS) $(LIBS)

test12.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST12 testgr.c $(OBJS) $(LIBS)

test13.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST13 testgr.c $(OBJS) $(LIBS)

test14.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST14 testgr.c $(OBJS) $(LIBS)

test15.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST15 testgr.c $(OBJS) $(LIBS)

test16.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST16 testgr.c $(OBJS) $(LIBS)

test17.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST17 testgr.c $(OBJS) $(LIBS)

test18.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST18 testgr.c $(OBJS) $(LIBS)

test19.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST19 testgr.c $(OBJS) $(LIBS)

test20.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST20 testgr.c $(OBJS) $(LIBS)

test21.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST21 testgr.c $(OBJS) $(LIBS)

test22.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST22 testgr.c $(OBJS) $(LIBS)

test23.exe: $(OBJS)
    $(CC) $(CC_FLAGS) -e$< -DTEST23 testgr.c $(OBJS) $(LIBS)

# Clean up directory removing all files not needed to make the library

clean:
    @del *.obj *.sym *.bak *.tdk *.map *.dsk

realclean:  clean
    @del *.exe

stamp:
    @foreach "rcs -N$(VERSION): -srelease" files.lst

rcsclean:
    @foreach rcsclean files.lst

# Check in the latest revisions of source files with RCS

ci:
    @foreach "ci -q -u $(RCSOPT)" files.lst

# Check out the latest revisions of source files from RCS

co:
    @foreach "co -q $(RCSOPT)" files.lst

