#
# This make file uses the Cygwin tool set to compile the application.
# The tool set is shipped with NET+OS for GNU.  If do not have the
# tool set, you can download it free of charge from http://www.cygwin.com/.
#

#include ./../../../Makefile.inc

# GNU set up
GNU_PATH=/bin


PREFIX=$(GNU_PATH)
CC= $(PREFIX)/gcc -DNA_BOARD_TYPE=\"none\"
LD= $(PREFIX)/ld
AR= $(PREFIX)/ar
AS= $(PREFIX)/as
NM= $(PREFIX)/nm
RM= $(PREFIX)/rm

# debug flag
DEBUG_FLAG= -g

# Set endianess
ifeq ($(ENDIAN_MODE), little)
CC_DEFS=-D_LITTLE_ENDIAN -DTM_LITTLE_ENDIAN -DNETOS_ARM_TOOLS
endif

# search path for source header file
INC_DIR=../../../h


INC  = -I. -I/usr/i686-cygwin/include -I/usr/i686-cygwin/include/cygwin 
INC += -I/usr/include/cygwin -I$(INC_DIR) -I../../../src/bsp/h

INC +=  -I/usr/i686-cygwin/include/sys

CRC_DIR=../../bsp/common
TABLE_DIR=../../bsp/customize
OBJDIR=.
OBJECTS=$(OBJDIR)/boothdr.o $(OBJDIR)/crc32h.o $(OBJDIR)/platformCode.o
DEPEND=depend.mk
SOURCE_DIRECTORY=.
CFILES=$(SOURCE_DIRECTORY)/boothdr.c $(CRC_DIR)/crc32h.c $(TABLE_DIR)/platformCode.c
BIN_DIR=../../../bin
TARGET=$(BIN_DIR)/boothdr.exe

# search path(s) for source file or library
VPATH= $(SOURCE_DIRECTORY):$(CRC_DIR):$(TABLE_DIR)

# goal(s)
all: $(TARGET)

$(TARGET): $(OBJECTS)
	$(CC) -o $@ $(OBJECTS)
	$(RM) -f $(OBJECTS) $(DEPEND)

$(OBJDIR)/%.o: %.c
	$(CC) -c $(INC) $(DEBUG_FLAG) $(CC_DEFS) $< -o $@

	


# clean up
clean:
	$(RM) -f $(OBJECTS)
	$(RM) -f $(TARGET)
	$(RM) -f $(DEPEND)

# generate dependencies
$(DEPEND): $(CFILES) Makefile
	$(CC) $(INC) -M $(CFILES) > $(DEPEND)


# header dep.
-include $(DEPEND)
