
objects      = display.rel time.rel lcd44780.rel uart.rel
qdvmobjects  = adc.rel main.rel
dtlfaobjects = syncdet.rel dualtone_lfa.rel math32.rel
gainobjects  = gain.rel syncdet2ch.rel math32.rel
lists        = display.lst lcd44780.lst time.lst uart.lst
qdvmlists    = adc.lst main.lst
dtlfalists   = syncdet2ch.lst dualtone_lfa.lst math32.lst
gainlists    = gain.lst syncdet2ch.lst math32.lst
inc = adc.h ADuC845.h boardhw.h command.h configuration.h display.h eepages.h hd44780.h lcd44780.h sstypes.h time.h uart.h version.h

all: SDisplay.hex DT_lfa.hex SDGain.hex

SDisplay.hex : $(objects) $(qdvmobjects) $(lists) $(qdvmlists) command.c configuration.c
	del SDisplay.*
	sdcc -c -DQUAD_DVM command.c
	sdcc -c -DQUAD_DVM configuration.c
	sdcc -o SDisplay.hex --xram-size 2048 command.rel configuration.rel $(qdvmobjects) $(objects)
	type SDisplay.mem	
     
DT_lfa.hex : $(objects) $(dtlfaobjects) $(lists) $(dtlfalists) command.c configuration.c
	del DT_lfa.*
	sdcc -c -DDUALTONE_LFA command.c
	sdcc -c -DDUALTONE_LFA configuration.c
	sdcc -o DT_lfa.hex --xram-size 2048 command.rel configuration.rel $(dtlfaobjects) $(objects)
	type DT_lfa.mem	
     
SDGain.hex : $(objects) $(gainobjects) $(lists) $(gainlists) command.c configuration.c
	del SDGain.*
	sdcc -c -DGAIN command.c
	sdcc -c -DGAIN configuration.c
	sdcc -o SDGain.hex --xram-size 2048 command.rel configuration.rel $(gainobjects) $(objects)
	type SDGain.mem	
     
adc.rel : adc.c $(inc) 
	sdcc -c adc.c
display.rel : display.c $(inc) 
	sdcc -c display.c
dualtone_lfa.rel : dualtone_lfa.c dualtone_lfa_cmnds.c $(inc) 
	sdcc -c dualtone_lfa.c
gain.rel : gain.c gain_cmnds.c $(inc) 
	sdcc -c gain.c
lcd44780.rel : lcd44780.c $(inc) 
	sdcc -c lcd44780.c
main.rel : main.c quad_dvm_cmnds.c $(inc) 
	sdcc -c main.c
math32.rel : math32.c
	sdcc -c math32.c
syncdet.rel : syncdet.c ddstables32.c ddstables48.c $(inc) 
	sdcc -c syncdet.c
syncdet2ch.rel : syncdet2ch.c ddstables32.c ddstables48.c $(inc) 
	sdcc -c syncdet2ch.c
time.rel : time.c $(inc) 
	sdcc -c time.c
uart.rel : uart.c $(inc) 
	sdcc -c uart.c

adc.lst : adc.c $(inc) 
	sdcc -c adc.c
display.lst : display.c $(inc) 
	sdcc -c display.c
dualtone_lfa.lst : dualtone_lfa.c $(inc) 
	sdcc -c dualtone_lfa.c
gain.lst : gain.c gain_cmnds.c $(inc) 
	sdcc -c gain.c
lcd44780.lst : lcd44780.c $(inc) 
	sdcc -c lcd44780.c
main.lst : main.c $(inc) 
	sdcc -c main.c
math32.lst : math32.c
	sdcc -c math32.c
syncdet.lst : syncdet.c ddstables32.c ddstables48.c $(inc) 
	sdcc -c syncdet.c
syncdet2ch.lst : syncdet2ch.c ddstables32.c ddstables48.c $(inc) 
	sdcc -c syncdet2ch.c
time.lst : time.c $(inc) 
	sdcc -c time.c
uart.lst : uart.c $(inc) 
	sdcc -c uart.c

clean :
	del *.asm
	del *.lst
	del *.sym
