#
# (c) 2001/2002 Jouni 'Mr.Spiv' Korhonen / Dead Coders Society
#
#

.PHONY: clean all dep dist bins cbins
.SUFFIXES:
.SUFFIXES: .cpp .o .h .s .c
.DEFAULT:
	make all
#


SRCS = $(wildcard *.c) $(wildcard *.s) 
HDRS = $(wildcard *.h) 

OBJS = $(addsuffix .o, $(basename $(wildcard *.s))) $(addsuffix .o, $(basename $(wildcard *.c)))

#
#
#

LOCAL_LIBDIR = 
LOCAL_LIBS =
GPSLIB = libGPS.a

CC = arm-elf-gcc
AS = arm-elf-as
AR = arm-elf-ar
OC = arm-elf-objcopy
RM = rm -f
CP = cp
DEPEND = .dep
WILD = *
WRITER = /Volumes/Unlabeled
FOO = GP32 rules!
DEFINES =



LOCAL_CFLAGS =  $(INC_DIR) -mtune=arm920t -Os -fomit-frame-pointer -finline-functions \
	-fno-exceptions -fno-common -fno-builtin -ffreestanding -mstructure-size-boundary=32 \
	-mno-thumb-interwork -Wall 
LOCAL_AFLAGS =

#
#
#
# rules

all: $(DEPEND) $(GPSLIB)
	@echo $(FOO)


ifeq ($(DEPEND),$(wildcard $(DEPEND)))
include $(DEPEND)
endif

$(DEPEND): Makefile
	$(CC) $(INC_DIR) -MM $(SRCS) > $(DEPEND)
	@echo "Dependencies done"

%.o: %.cpp
	$(CC) $(LOCAL_CFLAGS) $(DEFINES) -c $< -o $@

%.o: %.c
	$(CC) $(LOCAL_CFLAGS) $(DEFINES) -c $< -o $@

%.o: %.S
	$(AS) $(LOCAL_AFLAGS) $< -o $@

$(GPSLIB): $(OBJS)
	$(AR) crs $(GPSLIB) $(OBJS)

clean:
#	-$(RM) $(WILD).bin
	-$(RM) $(WILD).map
	-$(RM) $(WILD).o
	-$(RM) $(WILD)~
	-$(RM) $(PROG).tgz
	-$(RM) $(DEPEND)
	-$(RM) $(GPSLIB)

dist:
	tar zcvf $(PROG).tgz *.c *.h Makefile




