# MSP430 Makefile
# Author: Florian Heller <flo@cs.rwth-aachen.de>
# Copyright: C2010
# License: GPL

# This is a template Makefile for the TI MSP430 MCU series.
# 

# Path to your MPS430 GCC installation
MSP430PATH = /opt/local
MSP430GCC = $(MSP430PATH)/bin/msp430-gcc


# run "make devices" for a list of supported MCUs
DEVICE		= msp430x2012
TARGET		= main
SRC			= $(TARGET).c
OBJECTS		= main.o
COMPILE 	= $(MSP430GCC) -mmcu=$(DEVICE) -O2 -Wall -g 

all: main.hex

.c.o:
	$(COMPILE) -c $< -o $@
	
clean:
		rm -f $(TARGET).hex $(TARGET).elf $(TARGET).a43 $(TARGET).lst $(OBJECTS)

main.elf: $(OBJECTS)
			$(COMPILE) -o main.elf $(OBJECTS)

main.hex: main.elf
	rm -f main.hex
	$(MSP430PATH)/bin/msp430-objcopy -O ihex $(TARGET).elf $(TARGET).a43

disasm:	main.elf
	$(MSP430PATH)/bin/msp430-objdump -dST $(TARGET).elf > $(TARGET).lst
	
devices:
	$(MSP430GCC) --target-help
	