MAIN            = winch11.r
1               = winch.r
2               = wlib.r
3               = wtest.r
4               = pwlib.r
6               = c:\tt8\lib\userio.r

OBJ             = $1 $2 $3 $4 $6
LIB             =-ltt8 -lml16tt8 -lcl16tt8 -ltt8

#### Compiler options
# -ps 16 bit integers 
# -mc Large code model
# -md Large data model
# -sm Adds __C_MACROS__ definition
# -bs Generate debugger information
# -qq Inhibit compiler signon message
#
#### Linker options
# +c Start of code segment
# +d Start of initialized data segment 
#    (default, if not given, is right after code segment)
# +j Top of stack
# +s Stack size in hex                   	
# -g Generate debugger information
# +q Quiet, don't list modules
# -m Inhibit symbol override warnings
# -t Generate ASCII symbol table file
#
#### S-Record generator options
# -p rom size in kilobytes (large to generate only one s-record)  
# -a Address field size 3 bytes
# -b Hex Byte offset 

# Compiler options
CCOPTS  = -ps -mc -md -sm -bs -qq

.c.r:
	c68 $(CCOPTS) -o $@ $*.c

.c.:
	c68 $(CCOPTS) -o $@ $*.c

#Link and Generate hex files

all:    $(MAIN).rhx   $(MAIN).ahx


#### ROM VERSION
# Linker and srecord options for Application hex file (to be burned to FLASH)
 LNOPTSA =       +q -t -m +c 2000 +j 2c2000 +d 2c2000 +s 2000
 SROPTSA =       -p4000 -a3 -b2000
 $(MAIN).ahx: $(OBJ)
	ln68 -o $*.app $(LNOPTSA) $(OBJ) $(LIB)
	@srec68 $(SROPTSA) $*.app
	@copy $*.m00 $*.ahx 
	@erase $*.m00


#### RAM VERSION
# Linker and s-record options for Ram hex file (to be loaded to ram)
LNOPTSR =       +q -m +c 2c2000 +j 2C2000 +s 2000 -g
SROPTSR =       -p4000 -a3 -b2c2000
$(MAIN).rhx: $(OBJ)
	ln68 -o $*.run $(LNOPTSR) $(OBJ) $(LIB)
	@srec68 $(SROPTSR) $*.run
	@copy $*.m00 $*.rhx 
	@erase $*.m00
