################################################################################
# uboot_load
# Copyright (C) 2005 Everett Coleman <gcc80x86@fuzzyneural.net>
# http://fuzzyneural.net
#
# This program 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.
#
# 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.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
################################################################################
# Globals
PACKAGE =uboot_load
VERSION =1.0.4
CROSS_COMPILE=arm-wince-pe-
ARCH=arm

DEBUG_PACKAGE=no

EXT   =.exe
CC    =$(CROSS_COMPILE)gcc
AS    =$(CROSS_COMPILE)as
STRIP =$(CROSS_COMPILE)strip
CFLAGS=-I$(PWD) -Wall -msoft-float -static
LIBS  =
DEFS  =-DPACKAGE=\"$(PACKAGE)\" -DVERSION=\"$(VERSION)\" #-DUSE_VIDEO
OBJS  =uboot_load.o svc_net.o command.o config.o bload.o asm-bload.o memory.o

ifeq ($(DEBUG_PACKAGE), yes)
	DEFS+=-DDEBUG_PACKAGE=1
else
#	CFLAGS+=-O2
endif

DEFS  +=-DPAGE_PHYSICAL=0x400
################################################################################
.SILENT:
.SUFFIXES: .o .h .c .S
.c.o:
	echo "[build] $<"
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
.S.o:
	echo "[build] $<"
	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@

default: $(PACKAGE)$(EXT)
all:	default

$(PACKAGE)$(EXT): $(OBJS) $(GOBJS)
	echo " [link] $@ <- $^"
	$(CC) -o $@ $(CFLAGS) $(LIBS) $^

clean:
	rm -f $(OBJS)
	rm -f core

distclean: clean
	rm -f $(PACKAGE)$(EXT)

include make.include
