#################################################################################
#
# Makefile for Business Audio - AD1848, CS4231 Audio PDD
#
#   Generates
#         busaudio.sys
#
# Copyright (c) IBM Corporation 1994
# All Rights Reserved
#
#################################################################################


NAMESYS= busaudio


TOOLS=..\..\tools
H= ..\..\src\h


!if "$(_VENDOR)" == "IBM"
HPATH= -I..\..\ship_h -I..\..\src\h  -I..\..\common
LIBPATH = ..\..\src\lib

!if [set PATH=$(TOOLS)] || [set LIB=$(LIBPATH)]
!endif
!else
#DDK BUILD ENVIRONMENT
TOOLS=..\..\..\TOOLS
HPATH= -I..\..\H -I..\..\INC -I..\..\..\H
LIBPATH = ..\..\LIB
DDKLIB=..\..\..\LIB
!if [set PATH=$(TOOLS);%PATH%] || \
    [set LIB=$(LIBPATH);$(DDKLIB);%LIB%] || \
    [set INCLUDE=$(HPATH);%INCLUDE%]
!endif
!endif

# libraries
RMLIB=$(LIBPATH)\rmcalls.lib+$(DDKLIB)\os2286.lib


# linker info
#   BA - suppress prompts
#   NOD - no default library search
#   M - create a listing file
LN= link
LFLAGS= /BA /NOD /M


# assembler info
#   MX - turn on case sensitivity
#   p - check for impure code
#   t - report only errors
#   L - create listing file
AS= masm
AFLAGS= -MX -p -t -L


# compiler info
#   c - suppress linking
#   Zl - remove default library info
#   Od - disable optimization
#   G2 - generate 286 instructions
#   Gs - no stack checking
#   Asnd - use near code pointers
#        - use near data pointers
#        - sets ss == ds; ds not loaded on function entry
#   W2 - warns about everthing except ANSI compliance
#   Fm - create map file
#   Fc - create assembly listing file
#   Zi - produce codeview info
#   Zp - pack structures
#   I - path for include files
#   DDEBUG_FLAG - enable debug flag
CC= cl
CFLAGS= $(HPATH) -c -Zp -Zl -Asfd -G2s -W2 -Od -DRESMGR -DDEBUG_FLAG


OBJS= header.obj entry.obj timer.obj string.obj strategy.obj param.obj\
      trace.obj mem.obj devhlp.obj ad1848.obj dma.obj audcont.obj \
      strmcont.obj strmhelp.obj util.obj echo.obj rmhelp.obj ddprintf.obj \
      end.obj


!include        "$(H)\version.mak"


all:sys

sys: $(NAMESYS).sys

$(NAMESYS).sys: $(OBJS) makefile $(NAMESYS).lrf $(NAMESYS).def
    $(LN) $(LFLAGS) @$(NAMESYS).lrf
    mapsym $(NAMESYS).map


$(NAMESYS).def: makefile $(H)\version.mak
        @echo Creating file <<$(@B).def
LIBRARY $(NAMESYS)
DESCRIPTION '$(FILEVER)'
PROTMODE
CODE        PRELOAD
DATA        PRELOAD
SEGMENTS
   _DATA      CLASS 'DATA'
   _BSS       CLASS 'BSS'
   c_common   CLASS 'BSS'
   CONST      CLASS 'CONST'
   FAR_BSS    CLASS 'FAR_BSS'
   _ENDDATA   CLASS 'ENDDATA'
   RMCode     CLASS 'CODE' IOPL
   _TEXT      CLASS 'CODE' IOPL
<<keep


$(NAMESYS).lrf:  makefile
        @echo Creating file <<$(@B).lrf
$(OBJS)
$(NAMESYS).sys
$(NAMESYS).map
$(RMLIB)
$(NAMESYS).def;
<<keep


clean:
        -del $(NAMESYS).sys
        -del *.obj
        -del *.a
        -del *.lst
        -del *.map
        -del *.def
        -del *.lrf
        -del *.sym


header.obj: header.c
        $(CC) $(CFLAGS) -Fcheader.a -Foheader.obj header.lst header.c

strategy.obj: strategy.c
        $(CC) $(CFLAGS) -Fcstrategy.a -Fostrategy.obj strategy.lst strategy.c

param.obj: param.c
        $(CC) $(CFLAGS) -Fcparam.a -Foparam.obj param.lst param.c

audcont.obj: audcont.c
        $(CC) $(CFLAGS) -Fcaudcont.a -Foaudcont.obj audcont.lst audcont.c

trace.obj: trace.c
        $(CC) $(CFLAGS) -Fctrace.a -Fotrace.obj trace.lst trace.c

timer.obj: timer.c
        $(CC) $(CFLAGS) -Fctimer.a -Fotimer.obj timer.lst timer.c

string.obj: string.c
        $(CC) $(CFLAGS) -Fcstring.a -Fostring.obj string.lst string.c

mem.obj: mem.c
        $(CC) $(CFLAGS) -Fcmem.a -Fomem.obj mem.lst mem.c

strmcont.obj: strmcont.c
        $(CC) $(CFLAGS) -Fcstrmcont.a -Fostrmcont.obj strmcont.lst strmcont.c

strmhelp.obj: strmhelp.c
        $(CC) $(CFLAGS) -Fcstrmhelp.a -Fostrmhelp.obj strmhelp.lst strmhelp.c

dma.obj: dma.c
        $(CC) $(CFLAGS) -Fcdma.a -Fodma.obj dma.lst dma.c

devhlp.obj: devhlp.asm
        $(AS) $(AFLAGS) devhlp.asm devhlp.obj;

end.obj: end.asm
        $(AS) $(AFLAGS) end.asm end.obj;

util.obj: util.asm
        $(AS) $(AFLAGS) util.asm util.obj;

entry.obj: entry.asm
        $(AS) $(AFLAGS) entry.asm entry.obj;

ad1848.obj: ad1848.c
        $(CC) $(CFLAGS) -Fcad1848.a -Foad1848.obj ad1848.lst ad1848.c

echo.obj: echo.c
        $(CC) $(CFLAGS) -Fcecho.a -Foecho.obj echo.lst echo.c

rmhelp.obj: rmhelp.c
        $(CC) $(CFLAGS) -Fcrmhelp.a -Formhelp.obj rmhelp.lst rmhelp.c
