! Makefile for cmt stuff
! Last modified date: 20-Jul-86

!CURRENT is the exe file we want to make now.
CURRENT = adagio.exe
!EVERYTHING is everything this makefile knows how to make
E1 = adagio.exe dxget.exe dxput.exe mm.exe moxc.obj
E2 = record.exe transcri.exe tuning.exe
EVERYTHING = #(E1) #(E2)

~INIT = rem Current default file to make is #(CURRENT)
~DEINIT = echo Finished OK.`n:errdone`necho Done
! ~DEINIT = echo Finished OK.`n:errdone`necho Done
! ~BEFORE = echo before
~AFTER  = if errorlevel 1 goto errdone

LC1ARGS = -mS -i\lc\ -i\lc\s -i\include\ 
LC2ARGS = ` 
CLIB = \lc\s\lc.lib
MLIB = \lc\s\lcm.lib
COBJ = \lc\s\c.obj
CMTLIB = cmt.lib
LIBS = #(CLIB) #(CMTLIB) #(MLIB)

MUOBJ1 = aintr.obj atxt.obj break.obj cintr.obj cmdline.obj
MUOBJ2 = moxcasci.obj moxcbend.obj moxcctrl.obj moxckydn.obj moxckyup.obj
MUOBJ3 = moxcpddn.obj moxcpdup.obj moxcprgm.obj moxctouc.obj 
MUOBJ4 = mpu.obj userio.obj timdif.obj
MUOBJ = #(MUOBJ1) #(MUOBJ2) #(MUOBJ3) #(MUOBJ4)

ADH = adagio.h phase1.h phase2.h atxt.h userio.h cmdline.h
ADOBJ = adagio.obj phase1.obj phase2.obj adaspace.obj noteoff.obj

DXGOBJ = dxget.obj excldesc.obj

DXPOBJ = dxput.obj excldesc.obj

MMOBJ = mm.obj

RECOBJ = recmain.obj recspace.obj phase1.obj trans2.obj noteoff.obj record.obj

TRH = mpu.h cmdline.h musicfns.h userio.h record.h
TROBJ = transcri.obj traspace.obj record.obj

current : #(CURRENT)
	echo making #(CURRENT)

everything : #(EVERYTHING)
	echo making #(EVERYTHING)

adagio.exe : #(ADOBJ) #(CMTLIB)
	link #(COBJ) #(ADOBJ),adagio,,#(LIBS)

adagio.obj : #(ADH) adagio.c
	lc1 #(LC1ARGS) adagio
	lc2 #(LC2ARGS) adagio

adaspace.obj : adaspace.c
	lc1 #(LC1ARGS) adaspace
	lc2 #(LC2ARGS) adaspace

aintr.obj : aintr.asm
	masm aintr,,;

atxt.obj : atxt.asm
	masm atxt,,;

break.obj : break.asm
	masm break,,;

cintr.obj : cmdline.h cintr.c
	lc1 #(LC1ARGS) cintr
	lc2 #(LC2ARGS) cintr

cmdline.obj : cmdline.c
	lc1 #(LC1ARGS) cmdline
	lc2 #(LC2ARGS) cmdline

dxget.exe : #(DXGOBJ) #(CMTLIB)
	link #(COBJ) #(DXGOBJ),dxget,,#(LIBS)

dxget.obj : musicfns.h dxget.c
	lc1 #(LC1ARGS) dxget
	lc2 #(LC2ARGS) dxget

dxput.exe : #(DXPOBJ) #(CMTLIB)
	link #(COBJ) #(DXPOBJ),dxput,,#(LIBS)

dxput.obj : musicfns.h dxput.c
	lc1 #(LC1ARGS) dxput
	lc2 #(LC2ARGS) dxput

excldesc.obj : excldesc.c midicode.h
	lc1 #(LC1ARGS) excldesc
	lc2 #(LC2ARGS) excldesc

mm.exe : #(MMOBJ) #(CMTLIB)
	link #(COBJ) #(MMOBJ),mm,,#(LIBS)

mm.obj : musicfns.h midicode.h mpu.h mm.c 
	lc1 #(LC1ARGS) mm
	lc2 #(LC2ARGS) mm

moxc.obj : musicfns.h mpu.h cmdline.h midicode.h moxc.c
	lc1 #(LC1ARGS) moxc
	lc2 #(LC2ARGS) moxc

moxcasci.obj : moxcasci.c
	lc1 #(LC1ARGS) moxcasci
	lc2 #(LC2ARGS) moxcasci

moxcbend.obj : moxcbend.c
	lc1 #(LC1ARGS) moxcbend
	lc2 #(LC2ARGS) moxcbend

moxcctrl.obj : moxcctrl.c
	lc1 #(LC1ARGS) moxcctrl
	lc2 #(LC2ARGS) moxcctrl

moxckydn.obj : moxckydn.c
	lc1 #(LC1ARGS) moxckydn
	lc2 #(LC2ARGS) moxckydn

moxckyup.obj : moxckyup.c
	lc1 #(LC1ARGS) moxckyup
	lc2 #(LC2ARGS) moxckyup

moxcpddn.obj : moxcpddn.c
	lc1 #(LC1ARGS) moxcpddn
	lc2 #(LC2ARGS) moxcpddn

moxcpdup.obj : moxcpdup.c
	lc1 #(LC1ARGS) moxcpdup
	lc2 #(LC2ARGS)  moxcpdup

moxcprgm.obj : moxcprgm.c
	lc1 #(LC1ARGS) moxcprgm
	lc2 #(LC2ARGS)  moxcprgm

moxctouc.obj : moxctouc.c
	lc1 #(LC1ARGS) moxctouc
	lc2 #(LC2ARGS)  moxctouc

cmt.lib : #(MUOBJ) cmt.lnk
	plib86 @cmt.lnk

mpu.obj : mpu.c mpu.h atxt.h midicode.h cmdline.h userio.h pitch.h
	lc1 #(LC1ARGS) mpu
	lc2 #(LC2ARGS) mpu

noteoff.obj : adagio.h noteoff.c
	lc1 #(LC1ARGS) noteoff
	lc2 #(LC2ARGS) noteoff

phase1.obj : adagio.h cmdline.h phase1.c
	lc1 #(LC1ARGS) phase1
	lc2 #(LC2ARGS) phase1

phase2.obj : musicfns.h adagio.h mpu.h userio.h phase2.c
	lc1 #(LC1ARGS) phase2
	lc2 #(LC2ARGS) phase2

recmain.obj : adagio.h phase1.h phase2.h atxt.h userio.h cmdline.h recmain.c
	lc1 #(LC1ARGS) recmain
	lc2 #(LC2ARGS) recmain

record.exe : #(RECOBJ) #(CMTLIB)
	link #(COBJ) #(RECOBJ),record,,#(LIBS)

record.obj : musicfns.h mpu.h userio.h midicode.h record.c
	lc1 #(LC1ARGS) record
	lc2 #(LC2ARGS) record

recspace.obj : recspace.c
	lc1 #(LC1ARGS) recspace
	lc2 #(LC2ARGS) recspace

timdif.obj : timdif.asm timdif.h macsym.lib prcsym.lib
	masm timdif,,;

trans2.obj : musicfns.h adagio.h mpu.h record.h userio.h trans2.c
	lc1 #(LC1ARGS) trans2
	lc2 #(LC2ARGS) trans2

transcri.exe : #(TROBJ) #(CMTLIB)
	link #(COBJ) #(TROBJ),transcri,,#(LIBS)

transcri.obj : #(TRH) transcri.c
	lc1 #(LC1ARGS) transcri
	lc2 #(LC2ARGS) transcri

traspace.obj : traspace.c
	lc1 #(LC1ARGS) traspace
	lc2 #(LC2ARGS) traspace

tuning.exe : tuning.obj #(CMTLIB)
	link #(COBJ) tuning,tuning,,#(LIBS)

tuning.obj : tuning.c pitch.h
	lc1 #(LC1ARGS) tuning
	lc2 #(LC2ARGS) tuning

userio.obj : userio.c userio.h
	lc #(LC1ARGS) userio
	lc #(LC2ARGS) userio

clean :
	del *.map
	del *.lst


! clean out all but moxc.obj (needed for cmtl.bat)
cleanobjs : 
	del adagio.obj
	del adaspace.obj
	del aintr.obj
	del atxt.obj
	del break.obj
	del cintr.obj
	del cmdline.obj
	del dxget.obj
	del dxput.obj
	del excldesc.obj
	del mm.obj
	del moxcasci.obj
	del moxcbend.obj
	del moxcctrl.obj
	del moxckydn.obj
	del moxckyup.obj
	del moxcpddn.obj
	del moxcpdup.obj
	del moxcprgm.obj
	del moxctouch.obj
	del mpu.obj
	del noteoff.obj
	del phase1.obj
	del phase2.obj
	del recmain.obj
	del record.obj
	del recspace.obj
	del timdif.obj
	del trans2.obj
	del transcri.obj
	del traspace.obj
	del tuning.obj
	del userio.obj
