###############################################################################
# Copyright (C) 1998-2011 Vix Technology, All rights reserved
#
# File:         TOOLSET/ARM251.rul[e]
# Contents:     Rules as used for the ARM251 compiler
#               Make definitions for the ARM251 tools.
#
# Description:
#       This file provides Toolset definitions for the target makefiles
#       The file is dropped into the top of the generated platform specfic makefile
#
###############################################################################

toolset = arm251

o       = o
s       = s
a       = lib
exe     = axf

.SUFFIXES:  .asm
.PHONY:     arm251

#
#   Ensure that the compiler can be found
#   Use the environment varibales
#       GBE_ARM251 - Root of the ARM251 directory
#       GBE_ARM251_INGEDEV - Root of the Ingedev SDK
#
GBE_ARM251          ?= c:/ARM251
GBE_ARM251_INGEDEV  ?= C:/Ingedev/V5.03.0.2

export GBE_ARM251 GBE_ARM251_INGEDEV

arm251:
	@$(echo) "[Toolset ARM 2.51]"; \
	if [ -z "$$GBE_ARM251" ]; then echo GBE_ARM251 env var not set; exit 2; fi; \
	if [ ! -d "$$GBE_ARM251" ]; then echo "ERROR: GBE_ARM251 directory not found ($$GBE_ARM251). Compiler not available"; exit 2; fi; \
	if [ -z "$$GBE_ARM251_INGEDEV" ]; then echo GBE_ARM251_INGEDEV env var not set; exit 2; fi; \
	if [ ! -d "$$GBE_ARM251_INGEDEV" ]; then echo "ERROR: GBE_ARM251_INGEDEV directory not found ($$GBE_ARM251_INGEDEV). Compiler not available"; exit 2; fi;

#
#   Ensure tools are not in paths with a space
#   The toolchain does not handle spaces
#
ifeq  ($(findstring $(space),$(GBE_ARM251_INGEDEV)),$(space))
$(error ERROR: GBE_ARM251_INGEDEV path contain a space: $(GBE_ARM251_INGEDEV))
endif

ifeq  ($(findstring $(space),$(GBE_ARM251)),$(space))
$(error ERROR: GBE_ARM251 path contain a space: $(GBE_ARM251))
endif


COMPILER_HOME = $(subst \,/,$(strip $(GBE_ARM251)))
INGEDEV_SDK = $(subst \,/,$(strip $(GBE_ARM251_INGEDEV)))

#
#   Define the compiler specfic names and paths for the various tools
#
assembler   := $(COMPILER_HOME)/bin/armasm
compiler    := $(COMPILER_HOME)/bin/armcc
librarian   := $(COMPILER_HOME)/bin/armlib
linker      := $(COMPILER_HOME)/bin/armlink

#
#   Compiler include search paths
#
ARM_INCLUDES  := $(COMPILER_HOME)/include

#
#   Compiler library search paths
#   EnvVar ARMLIB may be used by some tools
#
ARMLIB  := $(COMPILER_HOME)/lib
INGEDEV_LIBS := $(INGEDEV_SDK)/Lib/Arm

export ARMLIB
