#
#   
#
# Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
#

# Build configuration for linux_arm. The build host is a Linux/x86 PC,
# the build target is a Linux/ARM device that supports the THUMB
# instruction set architecture (Thumb ISA).
#
# Use the GNU_TOOLS_DIR environment variable to choose the cross
# compiler for the device you want to compile for. For example,
# if your system installs the cross compilers at:
#
#   /opt/thumb/arm-linux
#   /usr/local/arm-linux/arm-linux
#   /micro/tools/i686-redhat-linux/gnu/arm-netwinder-linux
#   /micro/tools/i686-redhat-linux/gnu/arm-zaurus-linux
#   /micro/tools/i686-redhat-linux/gnu/arm-familiar-linux
#
# You can choose the compiler using a command-line like the following
#
#   setenv GNU_TOOLS_DIR /opt/thumb/arm-linux
#   gnumake

# ENABLE_THUMB_VM -- 
#
#     If set to true, the C code inside the VM is compiled in Thumb ISA.
#
ifndef ENABLE_THUMB_VM
export ENABLE_THUMB_VM                := true
export ENABLE_THUMB_VM__BY            := linux_thumb.cfg
endif

# ENABLE_THUMB_COMPILER --
#
#     If set to true, the Java bytecodes is compiled in Thumb
#     ISA. This applies to both JIT and AOT compilers. The ISA use
#     by the JIT and AOT compilers cannot be individually configured.
ifndef ENABLE_THUMB_COMPILER
export ENABLE_THUMB_COMPILER       := true
export ENABLE_THUMB_COMPILER__BY   := linux_thumb.cfg
endif

# ENABLE_TIMER_THREAD --
#
#     All of our current linux/thumb platforms do not support timer threads,
#     so let's set it to a safe default.
ifndef ENABLE_TIMER_THREAD
export ENABLE_TIMER_THREAD         := false
export ENABLE_TIMER_THREAD__BY     := linux_thumb.cfg
endif


# Linux-arm generic configuration setting.
include $(JVMWorkSpace)/build/linux_arm/linux_arm.cfg

# Convenient setting for Sun internal use. You system may install
# the GNU tools in a different location.
#
ifndef GNU_TOOLS_DIR 
GNU_TOOLS_DIR = /opt/thumb/arm-linux
endif


ifeq ($(ENABLE_THUMB_COMPILER), true)
    ifeq ($(IsLoopGen),true)
        override iarch := arm
        override carch := arm
	export ENABLE_THUMB_REGISTER_MAPPING     := true
	export ENABLE_THUMB_REGISTER_MAPPING__BY := linux_thumb.cfg
	export ENABLE_THUMB_GP_TABLE             := true
	export ENABLE_THUMB_GP_TABLE__BY         := linux_thumb.cfg

        # ENABLE_THUMB_COMPILER must not be set in loopgen.
        export ENABLE_THUMB_COMPILER             := false
        export ENABLE_THUMB_COMPILER__BY         := linux_thumb.cfg
    endif

    ifeq ($(IsRomGen),true)
        override iarch := c
        override carch := thumb
    endif

    ifeq ($(IsTarget),true)
        override iarch := arm
        override carch := thumb

        # These two generators do not work with THUMB compiler
	export ENABLE_INTERPRETER_GENERATOR      := false
	export ENABLE_ROM_GENERATOR              := false

	# IMPL_NOTE: consider whether thumb interworking is necessary
	# if the VM is built in ARM mode.
        THUMB_CFLAGS           += -mthumb-interwork
        ARM_CFLAGS             += -mthumb-interwork
        ASM_FLAGS              += -mthumb-interwork
        LINK_FLAGS             += -mthumb-interwork

        LOOP_GEN_FLAGS         += +GenerateThumbInterwork
    endif
endif


export BUILD_ANI_LIB := true
