# InterWave Kernel Makefile for Borland C++ 4.0
# $Revision: 1.6 $

DEBUG = -v
PROCESSOR = -DPROC386
BCC3_1 = -DTHREE_1
EXTRA =
DIR = t$(MODEL)
LIBNAME = iw_os$(MODEL).lib
!if '$(MODEL)'=='t'
EXTRA = $(EXTRA) -D__t__
!endif
!if '$(MODEL)'=='t' || '$(MODEL)'=='s' || '$(MODEL)'=='c'
CODESIZE = -DNEARCODE=1
!else
CODESIZE = -DNEARCODE=0
!endif
!if '$(MODEL)'=='t' || '$(MODEL)'=='s' || '$(MODEL)'=='m'
DATASIZE = -DNEARDATA=1
!else
DATASIZE = -DNEARDATA=0
!endif
!if $(PROCESSOR)==-DPROC386
EXTRA = $(EXTRA) $(PROCESSOR)
CPROC = -3
ASMPROC = -j.386p 
!else
CPROC = -2
ASMPROC = -j.286p
!endif
INCLUDEPATH=\bc4\include
OSINCDIR = os\dos\borland
CONFIGINCDIR = configs\borland
CFLAGS = $(DEBUG) -I$(INCLUDEPATH);$(OSINCDIR);$(CONFIGINCDIR) $(DATASIZE) $(CODESIZE) $(BCC3_1) $(CPROC) -Ox -Os -j7 -m$(MODEL)! $(PROCESSOR)
ASMFLAGS = -q -t -ml -DTASM $(ASMPROC) $(CODESIZE) $(DATASIZE) -D__$(MODEL)__ $(PROCESSOR)

.autodepend
.path.obj = $(DIR)

.c.obj:
	bcc -c +bcc.cfg { $*.c}
#	bcc -c +bcc.cfg -S $*.c
#	tasm -q -t -l -ml $(CODESIZE) $(DATASIZE) -D__$(MODEL)__ $(DIR)\$*.asm
#	del $*.asm

!if "$(DEBUG)"=="-v"
.asm.obj :
        tasm -l -zi $(ASMFLAGS) $< , $(DIR)\\
#        tasm -DNOSEM -l -zi $(ASMFLAGS) $< , nosem$(DIR)\\
!else
.asm.obj :
        tasm $(ASMFLAGS) $< , $(DIR)\\
#        tasm -DNOSEM $(ASMFLAGS) $< , nosem$(DIR)\\
!endif

OBJS=	iwinit2.obj\
	iwisr1.obj\
	iwisr.obj\
	iwsem.obj\
	iwinit.obj\
	iwload.obj\
	iwsynth.obj\
	iwpnp.obj\
	iwdetct.obj\
	globals.obj\
	iwmem.obj\
	iwdram.obj\
	iwutils.obj\
	iwvoice.obj\
	iwdma.obj\
	iwaddr.obj\
	iwatten.obj\
	iwllist.obj\
	iwnote.obj\
	iwnote1.obj\
	iwnote2.obj\
	iwlfo.obj\
	iwscale.obj\
	timer.obj\
	iwerror.obj\
	iwmidi.obj\
	iwuart.obj\
	iwmixer.obj\
	iwsound.obj\
	iwdig.obj\
	iwmls.obj \
        play.obj \
        record.obj \
        codec.obj \
        play16.obj \
        irq16.obj \
        vars16.obj \
        util16.obj \
        mixer.obj \
	mixctl.obj \
	mixbld.obj \
	profile.obj \
	profile1.obj \
	os.obj

all: bcc.cfg $(DIR)\iw_os$(MODEL).lib

bcc.cfg: makeosb4 makefile
  copy &&|
$(CFLAGS)
-n$(DIR)
| bcc.cfg

os.obj: $(OSINCDIR)\os.c
	bcc -c +bcc.cfg $(OSINCDIR)\os.c

$(DIR)\$(LIBNAME): $(OBJS) makeos
        makersp "+$(DIR)\\!s &\n" &&|
        $(OBJS)
|       > lib.rsp
        if exist $(DIR)\$(LIBNAME) del $(DIR)\$(LIBNAME)
        tlib $(DIR)\$(LIBNAME) /C @lib.rsp,nul
        if exist $(DIR)\*.bak del $(LIBDIR)\*.bak
        del *.rsp
#        makersp "+detune$(DIR)\\\%s &\n" &&|
#        $(OBJS)
#|       > lib.rsp
#        if exist detune$(DIR)\$(LIBNAME) del detune$(DIR)\$(LIBNAME)
#        tlib detune$(DIR)\$(LIBNAME) /C @lib.rsp,nul
#        if exist detune$(DIR)\*.bak del detune$(DIR)\$(LIBDIR)\*.bak
#        del *.rsp
#        makersp "+nosem$(DIR)\\\%s &\n" &&|
#        $(OBJS)
#|       > lib.rsp
#        if exist nosem$(DIR)\$(LIBNAME) del nosem$(DIR)\$(LIBNAME)
#        tlib nosem$(DIR)\$(LIBNAME) /C @lib.rsp,nul
#        if exist nosem$(DIR)\*.bak del nosem$(DIR)\$(LIBDIR)\*.bak
        del *.rsp

clean:
	if exist $(DIR)\*.obj del $(DIR)\*.obj
	if exist $(DIR)\*.lib del $(DIR)\*.lib
	if exist $(DIR)\*.bak del $(DIR)\*.bak

