#
#   
#
# Portions Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
#
#!c<
# Copyright 2006 Intel Corporation. All rights reserved.
#!c>
#

ifndef ENABLE_JVMPI_PROFILE
export ENABLE_JVMPI_PROFILE := false
endif

ifndef ENABLE_JVMPI_PROFILE_VERIFY
export ENABLE_JVMPI_PROFILE_VERIFY := false
endif

export ENABLE_XSCALE_WMMX_INSTRUCTIONS          := true
export ENABLE_XSCALE_WMMX_INSTRUCTIONS__BY      := linux_bvd.cfg

ifeq ($(ENABLE_JVMPI_PROFILE), true)
export ENABLE_XSCALE_WMMX_TIMER_TICK            := false
else
export ENABLE_XSCALE_WMMX_TIMER_TICK            := true
endif

export ENABLE_XSCALE_WMMX_TIMER_TICK__BY        := linux_bvd.cfg
export ENABLE_XSCALE_WMMX_ARRAYCOPY             := true
export ENABLE_XSCALE_WMMX_ARRAYCOPY__BY         := linux_bvd.cfg
export ENABLE_REMEMBER_ARRAY_LENGTH             := true
export ENABLE_REMEMBER_ARRAY_LENGTH__BY         := linux_bvd.cfg
export ENABLE_LOOP_OPTIMIZATION                 := true
export ENABLE_LOOP_OPTIMIZATION__BY             := linux_bvd.cfg
export ENABLE_NPCE                              := true
export ENABLE_NPCE__BY                          := linux_bvd.cfg
export ENABLE_INTERNAL_CODE_OPTIMIZER           := true
export ENABLE_INTERNAL_CODE_OPTIMIZER__BY       := linux_bvd.cfg
export ENABLE_INLINE                            := true
export ENABLE_INLINE__BY                        := linux_bvd.cfg
export ENABLE_REMEMBER_ARRAY_CHECK              := true
export ENABLE_REMEMBER_ARRAY_CHECK__BY          := linux_bvd.cfg
export ENABLE_STATIC_TRAMPOLINE                 := true
export ENABLE_STATIC_TRAMPOLINE__BY             := linux_bvd.cfg
export ENABLE_CSE                               := true
export ENABLE_CSE__BY                           := linux_bvd.cfg

# This optimization is not stable yet. Disabled for now.
export ENABLE_TRAMPOLINE		        := true
export ENABLE_TRAMPOLINE__BY	 	        := linux_bvd.cfg

export ENABLE_CODE_OPTIMIZER                    := true
export ENABLE_CODE_OPTIMIZER__BY                := linux_bvd.cfg

export ENABLE_EMBEDDED_CALLINFO      := false
export ENABLE_EMBEDDED_CALLINFO__BY  := linux_bvd.cfg

# memcmp and memcpy in libc are faster on the linux/bvd platform.
export ENABLE_FAST_MEM_ROUTINES      := false
export ENABLE_FAST_MEM_ROUTINES__BY  := linux_bvd.cfg

export ENABLE_ARM_V5TE               := true
export ENABLE_ARM_V5TE__BY           := linux_bvd.cfg


ifndef GNU_TOOLS_DIR 
GNU_TOOLS_DIR=/usr/local/arm-linux/arm-linux
endif

host_os      = linux
host_arch    = i386

LOOP_GEN_FLAGS = +GenerateGNUCode
ROM_GEN_FLAGS  = +GenerateGNUCode

ifndef ENABLE_TIMER_THREAD
export ENABLE_TIMER_THREAD     = false
export ENABLE_TIMER_THREAD__BY = linux_bvd.cfg
endif

ifneq ($(ENABLE_FLOAT), false)
ifndef ENABLE_SOFT_FLOAT
export ENABLE_SOFT_FLOAT     = true
export ENABLE_SOFT_FLOAT__BY = linux_bvd.cfg
endif
endif

ifeq ($(IsLoopGen),true)
    # LoopGen: an a.out that runs on the HOST. It has
    # an ARM assembler loop generator and will generate the ARM
    # assembler loop.
    os_family = linux
    arch      = arm
    compiler  = gcc

    export MSW_FIRST_FOR_DOUBLE     := false
    export MSW_FIRST_FOR_DOUBLE__BY := linux_bvd.cfg

    CPP_DEF_FLAGS += -DARM -DCROSS_GENERATOR=1
endif

ifeq ($(IsRomGen),true)
    # RomGem: an a.out that runs on the HOST. It has
    # C interpreter loop. It runs on the HOST to
    # generate the (machine independent) ROM.cpp file.
    os_family = linux
    arch      = c
    compiler  = gcc

    export MSW_FIRST_FOR_DOUBLE     := false
    export MSW_FIRST_FOR_DOUBLE__BY := linux_bvd.cfg

    # AOT-related settings
    export ENABLE_C_INTERPRETER            := true
    export ENABLE_C_INTERPRETER__BY        := linux_bvd.cfg
    export ENABLE_INTERPRETER_GENERATOR    := false
    export ENABLE_INTERPRETER_GENERATOR__BY:= linux_bvd.cfg
    export TARGET_MSW_FIRST_FOR_DOUBLE     := false
    export TARGET_MSW_FIRST_FOR_DOUBLE__BY := linux_bvd.cfg
    carch                                   = arm
    iarch                                   = c
    CPP_DEF_FLAGS                          += -DARM -DCROSS_GENERATOR=1
endif

ifeq ($(IsTarget),true)
    # target/{cldc_vm, cldc_vm_r, cldc_vm_g}.
    # These are pure Linux/ARM binaries that run on the TARGET.
    os_family = linux
    arch      = arm
    compiler  = gcc

    # Turn off ROM and INTERPRETER generators if possible to reduce size
    # of release and product builds
    ifneq (${ENABLE_MONET}, true)
    ifndef ENABLE_ROM_GENERATOR
    export ENABLE_ROM_GENERATOR             = false
    export ENABLE_ROM_GENERATOR__BY         = linux_arm.cfg
    endif
    endif
    ifndef ENABLE_INTERPRETER_GENERATOR
    export ENABLE_INTERPRETER_GENERATOR     = false
    export ENABLE_INTERPRETER_GENERATOR__BY = linux_arm.cfg
    endif

    export MSW_FIRST_FOR_DOUBLE     := false
    export MSW_FIRST_FOR_DOUBLE__BY := linux_bvd.cfg

    CPP_DEF_FLAGS += -DARM
    
    ifeq ($(ENABLE_SOFT_FLOAT), true)
      CPP_DEF_FLAGS += -msoft-float
      ASM_FLAGS += -mno-fpu
      LINK_FLAGS += -Xlinker --no-warn-mismatch
    endif

    ifeq ($(ENABLE_OMAP), true)
	LINK_FLAGS += -Xlinker -static
    endif

    ifeq ($(ENABLE_THUMB_VM), true)

    THUMB_CFLAGS            = -mthumb -mthumb-interwork
    ARM_CFLAGS              = -mthumb-interwork

    ASM_FLAGS              += -mthumb-interwork
    LINK_FLAGS             += -mthumb-interwork

    LOOP_GEN_FLAGS += +GenerateThumbInterwork

    else

    CPP_DEF_FLAGS += -mcpu=xscale
    LINK_FLAGS    += -mcpu=xscale

    endif
     
endif

ifndef MERGE_SOURCE_FILES
MERGE_SOURCE_FILES  = true
endif

ifndef SOURCE_MERGER_SIZE
SOURCE_MERGER_SIZE  = 35
endif

export BUILD_ANI_LIB := true
