# -*- mode: mak; -*-
###############################################################################
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
#
# File:         TOOLSET/mos_mri_cf.def
# Contents:     MRI ColdFire rules as used for the MOS
#
# Description:
#       MRI ColdFire toolset for MOS
#       This file provides Toolset definitions for the target makefiles
#       The file is dropped into the top of the generated platform specfic makefile
#
#       This file is included to provide Colfire support to the basic MOS_MRI toolset
#
# Revision History:
#       13-Feb-04   DDP     Started Work
###############################################################################

toolset = mos_mricf

o       = obj
s       = asm
a       = lib
exe     =

.SUFFIXES:  .asm
.PHONY:     mri mri2

ifeq    "$(mri_ver)" "53"       # Need version 5.3
mri:
	@if [ -z "$$MRI_CF53" ]; then echo "MRI_CF53 env var not set"; exit 2; fi; \
	if [ -z "`$(grep) 5.3 $$MRI_CF53/version`" ]; then echo "not MRI_CF 5.3"; exit 2; fi; \
	echo -n "[Toolset ColdFire - Microtec Research C 5.3, C++ 3.3, ASM 7.6]";

mri = $(subst \,/,$(strip $(MRI_CF53)))
endif   #. 5.3

ifeq   "$(mri_ver)" "0"
mri:
	@if [ -z "$$MRI_CF" ]; then echo "MRI_CF env var not set"; exit 2; fi; \
	echo -n "[Toolset ColdFire - Microtec Research C X.X]";

mri = $(subst \,/,$(strip $(MRI_CF)))
endif

#
#   Unknown Version
#
ifndef mri
    $(error ERROR: Specfied MRI_CF compiler version ($(mri_ver)) not known to toolset.)
endif

#
#   Define the compiler specfic names and paths for the various tools
#
COMPILER_HOME=$(mri)/embedded
MRI_BIN=$(COMPILER_HOME)/bin
MRI_INC=$(COMPILER_HOME)/include/mcccf
MRI_LIB=$(COMPILER_HOME)/lib
MRI_TMP=$(INTERFACEDIR)/mcccf

mri_assembler           = $(MRI_BIN)/asmcf
mri_compiler            = $(MRI_BIN)/mcccf
mri_cpp_compiler        = $(MRI_BIN)/ccccf
mri_linker              = $(MRI_BIN)/lnkcf
mri_librarian           = $(MRI_BIN)/libcf
mri_compiler_define     = _MCCCF
mri_linker_lib          = $(MRI_LIB)/nze/mcccfa552
mri_cpu_type            = 5200
mri_coprocessor_type    = /MAC/DIV
mri_cpu_code            = 5272

#
#   Setup the compiler specfic environment variables based on the required version
#   The compiler does not need to be in the users path as it will be fully pathed
#
MRI_CF_BIN=$(MRI_BIN)
MRI_CF_INC=$(MRI_INC)
MRI_CF_LIB=$(MRI_LIB)

#
#   The ColdFire compiler has a bug. It creates temp files and does not
#   ensure that they are unique. The result is chaos.
#   Create temp files in the 'interface' directory.
#
MRI_CF_TMP=$(MRI_TMP)
TMP=$(MRI_TMP)
TMPDIR=$(MRI_TMP)
TEMP=$(MRI_TMP)
MRI_68K_TMP=$(MRI_TMP)
export COMPILER_HOME MRI_CF_BIN MRI_CF_LIB MRI_CF_TMP TMP TMPDIR TEMP MRI_68K_TMP

mri2:
	@if [ -n "$$VISIONCLICK" ]; then \
		echo "and VisionCLICK]"; \
	else echo "]"; fi

ifdef VISIONCLICK
est32		= $(subst \,/,$(strip $(VISIONCLICK)))
else
est32		= --dummy--
endif

RPCGEN_CPP      := $(GBE_BIN)/rpccpp.exe
RPCGEN_CFLAGS   := -e -c
export RPCGEN_CPP RPCGEN_CFLAGS


