###############################################################################
#
#	Microsoft C++
#
#	makefile for 16 Bit UltraSound libraries & example code
#
###############################################################################
#
#	This makefile will build the objects in sub-directories.
#	The libraries are built in the current directory from those objs.
#	Make sure these subdirs exist before making the particular model.
#
#	largem	- Microsoft large model
#	mediumm	- Microsoft medium model
#	smallm	- Microsoft small model
#	tinym	- Microsoft tiny model
#
###############################################################################

INCS=c:\c600\include -I..\incs
#DEBUG = /CO
COMPILER = m

!if $(SIZE) == 0
TYPE=large$(COMPILER)
MODEL=L
LIBMODEL=l

!elif $(SIZE) == 1
TYPE=medium$(COMPILER)
MODEL=M
LIBMODEL=m

!elif $(SIZE) == 2
TYPE=small$(COMPILER)
MODEL=S
LIBMODEL=s

!elif $(SIZE) == 3
TYPE=tiny$(COMPILER)
MODEL=T
LIBMODEL=s
!endif

###############################################################################
#            Transformation rules
# Compile all .c files with the Microsoft C compiler
# SOME MODEL .............
###############################################################################
.path.obj = .\$(TYPE)

.c.obj:
!if $(SIZE) >= 2
 cl  -Ox -Oi -Fa -Gs -FPi -A$(MODEL) -I$(INCS) /c /Fo$(TYPE)/$&.obj $&.c 
 @del $&.asm
!else
 cl  -Ox -Oi -Fa -Gs -FPi -A$(MODEL) -I$(INCS) /Fo$(TYPE)\$&.obj /c $&.c 
 @del $&.asm
!endif

.asm.obj:
 masm /Z /MX /DMSIZE$(SIZE) $*.asm,$(TYPE)\$*.obj;

.autodepend

all: ult16$(MODEL)$(COMPILER).lib

###############################################################################
#
# 16 Bit files
#
###############################################################################
FILE01=	vars16.obj open16.obj irq16.obj handle16.obj timer16.obj probe16.obj
FILE02= freq16p.obj freq16r.obj sample16.obj util16.obj play16.obj mixer16.obj

###############################################################################

ult16$(MODEL)$(COMPILER).lib: $(FILE01) $(FILE02)
	cd $(TYPE)
	c:\c600\binb\lib ..\ult16$(MODEL)$(COMPILER).lib @..\ultra16.dat
	cd ..

lint:
	del lint.tmp
	C:\LINT\LINT +fxc -e537 -e785 +v -iC:\LINT STD.LNT lint.lnt -od(proto.xxx) >lint.tmp

clean:
	del ult16$(MODEL)$(COMPILER).lib
	cd $(TYPE)
	del *.obj
	cd ..
