#control.c make file for "Delta Force" minisumo robot
#Note: Pin 36 may need to be isolated from the 40 pin zif
#socket the first time the chip is programmed to overide the
#factory default LVP mode when using the warp-13 programmer.

target = 16f877
cpu    = 16F877

#config word: No LVP, Flash PGM mem protected, pwr-up timer enabled,
# brownout enabled,  watchdog disabled, HS oscillator
config = 3d72
sname = control

#
all: $(sname).hex
# Assemble the program from the asm source
$(sname).hex: $(sname).asm
	gpasm  -p $(target) $(sname).asm
#
#Generate the asm source file from C source
$(sname).asm: $(sname).c
	c2c -vs0x20 -PPIC$(cpu) -Ip$(target).inc -o$(sname).asm $(sname).c
	
# Clean up the directory
clean:
	rm -f $(sname).hex  core  $(sname).asm $(sname).lst
#
pgm:
	tm4 -c $(target) -z $(config) $(sname).hex
	
pgme:   
	tm4 -e -c $(target) -z $(config) $(sname).hex

picstart:
	picp /dev/pic $(target) -wc 0x$(config) -wp $(sname).hex

