#/****************************************************************
#KPIT Cummins Infosystems Limited Pune, India. -15-Jan-2010.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
#*****************************************************************/

PREFIX=rx-elf

DEBUG_FLAGS=-gdwarf-2

# Specify compiler to be used
CC = $(PREFIX)-gcc

# Specify Assembler to be used
AS = $(PREFIX)-as

# Specify linker to be used
LD = $(PREFIX)-ld

# Specify CPU flag
CPU = -mcpu=rx610 -mlittle-endian-data

# Common compiler flags
CFLAGS = -nostartfiles

ALL_FLAGS = $(CFLAGS) $(DEBUG_FLAGS) $(CPU)


# Application name
APPNAME = led_lcd

# Specify all objects that you are going to link together
OBJS = vects.o hwinit.o inthandler.o lcd.o tpu.o $(APPNAME).o

SOURCES = start.S vects.c hwinit.c inthandler.c lcd.c tpu.c $(APPNAME).c 

$(APPNAME).mot : $(APPNAME).out
	$(PREFIX)-objcopy -O srec $(APPNAME).out $@


$(APPNAME).out : $(SOURCES) $(APPNAME).ld makefile
	$(CC) $(ALL_FLAGS) -DRELEASE -T$(APPNAME).ld -Xlinker -Map -Xlinker $(APPNAME).map -o $@ $(SOURCES) -lm

all: $(APPNAME).mot

rom: $(APPNAME).mot

clean:
	rm -f *.o *.out *.mot *.x *.map


