#######################################################################
#
# Filename:    makefile
# 
# Description: Linux Blinking LED program.
#
# 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-linux-gcc
LD      = arm-linux-gcc
STRIP   = arm-linux-strip
CFLAGS  = -g -c -Wall -I../../include
LDFLAGS = -g -Wl,-Map,blink.map
LIBS    = -lpthread


all: blink

led.o: led.c led.h
	$(XCC) -o $@ $(CFLAGS) $<

blink.o: blink.c led.h
	$(XCC) -o $@ $(CFLAGS) $<

blinkdbg: blink.o led.o
	$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)

blink: blinkdbg
	$(STRIP) blinkdbg -o $@

clean:
	-rm -f blink blinkdbg *.o blink.map
