#######################################################################
#
# Filename:    makefile
# 
# Description: Makefile for the serial device driver.
#
# Copyright (c) 2006 Anthony Massa and Michael Barr.  All rights reserved.
# This code is from the book Programming Embedded Systems, With C and
# GNU Development Tools, 2nd Edition.
# It is provided AS-IS, WITHOUT ANY WARRANTY either expressed or implied.
# You may study, use, and modify it for any non-commercial purpose,
# including teaching and use in open-source projects.
# You may distribute it non-commercially as long as you retain this notice.
# For a commercial use license, or to purchase the book,
# please visit http://www.oreilly.com/catalog/embsys2.
#
#######################################################################

XCC     = arm-elf-gcc
LD      = arm-elf-gcc
STRIP   = arm-elf-strip
CFLAGS  = -g -c -Wall -mcpu=xscale -I../include --specs=redboot.specs
LDFLAGS = -mcpu=xscale -g --specs=redboot.specs -Wl,-Ttext,0x400000 -Wl,-Map,serial.map


all: serial.exe

serial.o: serial.c serial.h
	$(XCC) $(CFLAGS) serial.c

main.o: main.c serial.h
	$(XCC) $(CFLAGS) main.c

serialdbg.exe: serial.o main.o
	$(LD) $(LDFLAGS) -o $@ serial.o main.o

serial.exe: serialdbg.exe
	$(STRIP) --remove-section=.comment serialdbg.exe -o $@

clean:
	-rm -f *.exe *.o serial.map
