# OP03-makefile : Makefile fragment for compiling a target-specific version of libLPC2xxx
# Copyright (c) 2005-2007 Garth Zeglin

# This file is part of ArtLPC. 

# ArtLPC is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# ArtLPC 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.  See the GNU
# General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with ArtLPC; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

# ---------------------------------------------------------------------
# Makefile entries for creating a custom libLPC2XXX for a given
# target.  Since the library must be compiled in the context of a
# config.h customization file, this file should be included in a
# project Makefile with appropriate vpath settings, and the source
# compiled in the project directory.

# This file is specific to the Olimex LPC-P2103 target.

LPC2XXX_ASM_SRCS = \
	startup.S \

#	call_IAP.S \


LPC2XXX_C_SRCS = \
	LED_indicators.c \
	UART0_interrupt_handler.c \
	UART0_interrupt_handler.c \
	UART1_interrupt_handler.c \
	UART1_interrupt_handler.c \
	UART_port.c \
	UART_raw_port.c \
	chipinit.c \
	console.c \
	default_interrupts.c \
	fast_interrupt_handlers.c \
	fifo.c \
	interrupt_control.c \
	polled_serial.c \
	print.c \
	serial_console.c \
	timer_interrupt.c \
	timing.c \
	utility.c \
	watchdog.c \
	watchdog_interrupt.c \

#	block_device.c \
#	internal_FLASH.c \
#	lists.c \

LPC2XXX_OBJS = $(LPC2XXX_C_SRCS:%.c=%.o) $(LPC2XXX_ASM_SRCS:%.S=%.o)

$(LIBOBJDIR)/libLPC2xxx.a: $(LPC2XXX_OBJS:%=$(LIBOBJDIR)/%)
	$(AR) cru $@ $^
	$(RANLIB) $@

# special options for the FIQ handler
RESERVE_REGISTERS= -ffixed-r0 -ffixed-r1 -ffixed-r2 -ffixed-r3 -ffixed-r4 -ffixed-r5 -ffixed-r6 -ffixed-r7

$(LIBOBJDIR)/fast_interrupt_handlers.o: ../libLPC2xxx/fast_interrupt_handlers.c
	$(CC) -o $@ $(CFLAGS) $(RESERVE_REGISTERS) $<

