#############################################################################
#
#                   Copyright (C) 1993 Kendall Bennett.
#                           All rights reserved.
#
# Descripton:   Makefile for the SuperVGA test library.
#               MSDOS version for Microsoft C 6.0
#
# $Id: makefile.msc 1.1 1993/09/19 02:05:54 kjb Exp $
#
#############################################################################

CC              = cl                # Name of C compiler
ASM             = tasm              # Name of assembler
LINK            = link              # Name of linker
LIB             = lib               # Name of librarian
LIB_FLAGS       = /NOI

!IFDEF debug
CC_DOPT         = /Zi               # Turn on debugging for C compiler
DEBUG           = -Ddebug
!ENDIF

# We must assemble the test programs in the large memory model

MODEL           = /AL
ASM_MODEL       = /d__LARGE__

ASM_FLAGS       = /MX /m $(ASM_MODEL)
CC_FLAGS        = /D__MSDOS__ $(MODEL) $(CC_DOPT) /Ox /Oz

# Implicit rules to make the object files for the test code

.SUFFIXES: .c .obj .lib .exe

.c.obj:
    $(CC) $(CC_FLAGS) /c $<

.asm.obj:
    $(ASM) $(ASM_FLAGS) $<, $*.obj

# Object files required to build the libraries

OBJECTS         = svgac.obj svga.obj

all: test16.exe test256.exe test32k.exe test64k.exe test16m.exe

test16.exe: test16.obj svga_msc.lib cpu.obj
    $(CC) $(CC_FLAGS) test16.obj svga_msc.lib cpu.obj

test256.exe: test256.obj svga_msc.lib cpu.obj
    $(CC) $(CC_FLAGS) test256.obj svga_msc.lib cpu.obj

test32k.exe: test32k.obj svga_msc.lib cpu.obj
    $(CC) $(CC_FLAGS) test32k.obj svga_msc.lib cpu.obj

test64k.exe: test64k.obj svga_msc.lib cpu.obj
    $(CC) $(CC_FLAGS) test64k.obj svga_msc.lib cpu.obj

test16m.exe: test16m.obj svga_msc.lib cpu.obj
    $(CC) $(CC_FLAGS) test16m.obj svga_msc.lib cpu.obj

# Target to make each of the library file

svga_msc.lib: $(OBJECTS)
    echo svga_msc.lib & > temp.rsp
    echo -+svgac.obj & >> temp.rsp
    echo -+svga.obj & >> temp.rsp
    echo ,,svga_msc.lib >> temp.rsp
    $(LIB) $(LIB_FLAGS) @temp.rsp
    del temp.rsp

# Dependencies

svgac.obj:      svga.h
test16.obj:     svga.h
test256.obj:    svga.h
test32k.obj:    svga.h
test64k.obj:    svga.h
test16m.obj:    svga.h

# Clean up directory removing all files not needed to make the library

clean:
    @del *.sym *.bak *.tdk *.map *.dsk
    except (cpu.obj svga.obj) del *.obj

realclean:  clean
    @del *.exe svga_msc.lib *.obj

