# Makefile for HT-PIC on windows (or linux hopefully)
# 12-Nov-2003 sib - written for cygwin compile for HT-PIC Windows
#                   only for PIC16F88

HT_PIC_BIN_DIR 		= /c/HT-PIC/BIN
HT_PIC_DIR		= C:\HT-PIC
HT_PIC_INCLUDE_DIR	= ${HT_PIC_DIR}\INCLUDE
HT_PIC_LIB_DIR		= ${HT_PIC_DIR}\LIB
PICINFO_INI		= ${HT_PIC_LIB_DIR}\picinfo.ini
PICRT41C_OBJ		= ${HT_PIC_LIB_DIR}\PICRT41C.OBJ
PIC41C-C_LIB		= ${HT_PIC_LIB_DIR}\PIC41C-C.LIB

all: WDBW.hex

WDBW.hex : WDBW.c
	picc -16f88 -NO_STRING_PACK WDBW.c

WDBW.hex2: WDBW.obj
	${HT_PIC_BIN_DIR}/HLINK.EXE -z -B11050100 -h+WDBW.sym -mWDBW.map -ppowerup=00h,intentry=04h,intcode,intret,init,init23,end_init,clrtext,stringtable,pstrings,strings -ABANK0=020h-07Fh -prbit_0=BANK0,rbss_0=BANK0,rdata_0=BANK0,idata_0=CODE -ABANK1=0A0h-0EFh -prbit_1=BANK1,rbss_1=BANK1,rdata_1=BANK1,idata_1=CODE -ABANK2=0110h-016Fh -prbit_2=BANK2,rbss_2=BANK2,rdata_2=BANK2,idata_2=CODE -ABANK3=0190h-01EFh -prbit_3=BANK3,rbss_3=BANK3,rdata_3=BANK3,idata_3=CODE -ACOMBANK=070h-07Fh -ptemp=COMBANK -ACODE=0-7FFhx2 -ACONST=0-0FFhx16 -pconfig=2007h -pidloc=2000h -AEEDATA=2100h-21FFh -peeprom_data=EEDATA -pfloat_text0=CODE,float_text1=CODE,float_text2=CODE -pfloat_text3=CODE,float_text4=CODE -pnvram=BANK0,nvram_1=BANK1,nvram_2=BANK2,nvram_3=BANK3 -pnvbit_0=BANK0,nvbit_1=BANK1,nvbit_2=BANK2,nvbit_3=BANK3 -Q16F88 -o~L.OBJ "${PICRT41C_OBJ}" WDBW.obj "${PIC41C-C_LIB}"
	${HT_PIC_BIN_DIR}/OBJTOHEX.EXE -m -i -16,2 -B11050100 ~L.OBJ WDBW.hex
	rm ~L.OBJ

WDBW.obj: WDBW.c Makefile
	${HT_PIC_BIN_DIR}/CPP.EXE -SP1,1,1,1,1,1,1 -S1,2,2,4,3,3 -D_MPC_ -DHI_TECH_C -D_PIC14 -D_16F88 -D_HTC_VER_MAJOR_=8 -D_HTC_VER_MINOR_=2 -D_HTC_VER_PATCH_=1 -D_COMMON_=1 -D_BANKBITS_=2 -D_GPRBITS_=2 -I"${HT_PIC_INCLUDE_DIR}" -E2 WDBW.c WDBW.cpp
	${HT_PIC_BIN_DIR}/P1.EXE -u -M -B -QTi,fastcall -QX,bank1 -QY,bank2 -QZ,bank3 -Gstrings,const -Y -r -E2 -D WDBW.cpp WDBW.SIC1
	${HT_PIC_BIN_DIR}/CGPIC.EXE -DWDBW.sdb -C"${PICINFO_INI}" -PPIC16F88,2,4096,4,0,2,0,2,4,112-127,1 WDBW.SIC1 WDBW.cpp
	${HT_PIC_BIN_DIR}/ASPIC.EXE -16F88 -R1000 -C"${PICINFO_INI}" -E2 -oWDBW.obj WDBW.cpp
	rm WDBW.SIC1

clean:
	rm -f *.HEX *.MAP *.OBJ *.SDB *.SYM *.dep *.SIC* *.CPP *.obj *.lst *.sym *.sdb *.hex \
	   *.map *.sic *.cpp *.cod *.COD *.cof *.COF *~




