#
#
#
# Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
#
# Build configuration for javacall_i386_vc.
# The build host is a Win32 
# The build target is a javacall/i386 device.
# The toolchain is Microsoft Visual C++
#

arch      = i386
host_os   = win32
host_arch = i386
os_family = javacall
compiler  = visCPP

MakeDepsMain_javacall = WinGammaPlatform
MakeDepsOpts_javacall = -resolveVpath true

INVALID_JAVACALL_OUTPUT_DIR = (\
echo ===================================================================== ; \
echo JAVACALL_OUTPUT_DIR \(environment or GNUmake variable\) must be set.  ; \
echo Please set it such that it is possible to access                      ; \
echo \$${JAVACALL_OUTPUT_DIR}/inc and \$${JAVACALL_OUTPUT_DIR}/lib         ; \
echo directories.                                                          ; \
echo ===================================================================== )

ifeq ($(JAVACALL_OUTPUT_DIR),)
  $(shell $(INVALID_JAVACALL_OUTPUT_DIR) 1>&2)
  $(error JAVACALL_OUTPUT_DIR is not set)
endif
ifneq ($(shell if test -d $(JAVACALL_OUTPUT_DIR); then echo valid; fi),valid)
  $(shell $(INVALID_JAVACALL_OUTPUT_DIR) 1>&2)
  $(error $${JAVACALL_OUTPUT_DIR} does not point to a directory)
endif
ifneq ($(shell if test -d $(JAVACALL_OUTPUT_DIR)/inc; then echo valid; fi),valid)
  $(shell $(INVALID_JAVACALL_OUTPUT_DIR) 1>&2)
  $(error $${JAVACALL_OUTPUT_DIR/inc} is not a directory)
endif
ifneq ($(shell if test -d $(JAVACALL_OUTPUT_DIR)/lib; then echo valid; fi),valid)
  $(shell $(INVALID_JAVACALL_OUTPUT_DIR) 1>&2)
  $(error $${JAVACALL_OUTPUT_DIR/lib} is not a directory)
endif

ifneq ($(findstring CYGWIN, $(shell uname)), CYGWIN)
    define fixcygpath_m
    echo $(1)
    endef
else
    define fixcygpath_m
    echo $(1) | xargs -n1 cygpath -m
    endef
endif

ifeq ($(IsLoopGen),true)
    # LoopGen: an .exe that runs on the HOST. It has
    # an i386 assembler loop generator and will generate the i386
    # assembler loop.
    os_family          = $(host_os)
endif

ifeq ($(IsRomGen),true)
    # RomGem: an .exe that runs on the HOST. It has
    # an i386 assembler or C loop. It runs on the HOST to
    # generate the (machine independent) ROM.cpp file.
    os_family      = $(host_os)
endif

ifeq ($(IsTarget),true)
export ENABLE_PCSL = true
export ENABLE_PCSL := true
    arch      = i386

    export skip_link_image := true

    ifeq ($(USE_DEBUG),true)
    BUILD_EXT_javacall=_g
    else
    BUILD_EXT_javacall=
    endif

    JAVACALL_INCLUDE_DIR=$(JAVACALL_OUTPUT_DIR)/inc
    JAVACALL_LIB_DIR=$(JAVACALL_OUTPUT_DIR)/lib

    CPP_DEF_FLAGS += -I$(JAVACALL_INCLUDE_DIR)
    LINK_FLAGS += `$(call fixcygpath_m, $(JAVACALL_LIB_DIR)/javacall$(BUILD_EXT_javacall).lib)` 
    LINK_FLAGS += /NODEFAULTLIB:LIBC Winmm.lib 

endif
