#   
#
# Copyright  1990-2006 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version
# 2 only, as published by the Free Software Foundation. 
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License version 2 for more details (a copy is
# included at /legal/license.txt). 
# 
# You should have received a copy of the GNU General Public License
# version 2 along with this work; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA 
# 
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
# Clara, CA 95054 or visit www.sun.com if you need additional
# information or have any questions. 
#

#Flag USE_JSR_XX means that JSR_XX will be included to the javacall library if the flag
#is set to 'true' (example: USE_JSR_XX=true). JSR_XX will not be included to the javacall
#library if the flag USE_JSR_XX is not 'true' (example: USE_JSR_XX=false). 
#
#For each used JSR path to its particular implementation shall be specified explicitly as javacall
#library can be formed from JSRs taken from different locations
#JSR_XX_JC_IMPL_PATH varibale sets path to implementation 
#
#For 'midp' USE_MIDP and MIDP_JC_IMPL_PATH variables are used
#For 'nams' USE_NATIVE_AMS_JC and NATIVE_AMS_JC_IMPL_PATH variables are used

JSR_LIST = MIDP JSR_120 JSR_135 JSR_177 JSR_211

USE_MIDP=true
MIDP_JC_IMPL_PATH=$(JAVACALL_DIR)/implementation/win32

JSR_120_JC_IMPL_PATH=$(JAVACALL_DIR)/implementation/win32

JSR_135_JC_IMPL_PATH=$(JAVACALL_DIR)/implementation/win32

JSR_177_JC_IMPL_PATH=$(JAVACALL_DIR)/implementation/win32

JSR_211_JC_IMPL_PATH=$(JAVACALL_DIR)/implementation/win32

ifeq ($(USE_NATIVE_AMS_JC),)
USE_NATIVE_AMS_JC=false
endif

# Switch native AMS function on/off
ifeq ($(USE_NATIVE_AMS_JC), true)

JSR_LIST += NATIVE_AMS
NATIVE_AMS_JC_IMPL_PATH = $(JAVACALL_DIR)/implementation/win32
SPECIFIC_DEFINITIONS += -DENABLE_NATIVE_AMS=1

else

SPECIFIC_DEFINITIONS += -DENABLE_NATIVE_AMS=0

endif

#For each project location for basic definitions shall be specified
#(location of the used javacall_platform_defs.h)
JAVACALL_PLATFORM_DEFS_DIR=$(JAVACALL_DIR)/implementation/win32

SOURCE_OUTPUT_LIST += $(JAVACALL_PLATFORM_DEFS_DIR)/javacall_platform_defs.h javacall/implementation/win32
SOURCE_OUTPUT_LIST += $(JAVACALL_DIR)/configuration/phoneMEFeature/win32_x86 javacall/configuration/phoneMEFeature
SOURCE_OUTPUT_LIST += $(foreach jsr,$(JSR_LIST), $(if $(PREFIX_$(USE_$(jsr))), $($(jsr)_JC_IMPL_PATH)/$($(jsr)_JC_DIR) javacall/implementation/win32))

# Enable multiple runMidlet instances running on the same machine
# Setting this to TRUE disables remote control of running runMidlet instance
# implemented vie interprocess communication
#
USE_MULTIPLE_INSTANCES=true

#Specify list of utility objects necessary for the build
UTILITIES =                 \
        javautil_jad_parser \
        javautil_string \
	javautil_unicode

#Compile options that are not common for all configurations can be specified in
#SPECIFIC_DEFINITIONS variable
SPECIFIC_DEFINITIONS+=-I$(MIDP_JC_IMPL_PATH)/$(MIDP_JC_DIR)/
SPECIFIC_DEFINITIONS+=-DWIN32

ifeq ($(USE_JSR_135),true)
SPECIFIC_DEFINITIONS+=-I$(JSR_135_JC_IMPL_PATH)/$(JSR_135_JC_DIR)/
endif

ifeq ($(USE_JSR_120),true)
SPECIFIC_DEFINITIONS+= -DENABLE_JSR_120=1 
endif

ifeq ($(USE_MULTIPLE_INSTANCES),true)
SPECIFIC_DEFINITIONS+=-DENABLE_MULTIPLE_INSTANCES=1
endif

#Specific directories with source files that are used in the project can be specified 
#explicitly via vpath directive
vpath %.rc $(MIDP_JC_IMPL_PATH)/midp/res

# NEED REVISIT: provide pure solution without hidden dependencies
ifeq ($(ENABLE_HIDDEN_DEP_FEATURES),true)
SPECIFIC_DEFINITIONS+=-DENABLE_HIDDEN_DEP_FEATURES
endif # ifeq ($(ENABLE_HIDDEN_DEP_FEATURES),true)

#Porting objects that are added to PORTING_OBJECTS by default rules can be excluded
#from the javacall library by setting FILTER_OBJECTS variable
ifdef SUBSYSTEM_EVENTS_MODULES
   ifeq ($(SUBSYSTEM_EVENTS_MODULES), slave_mode)
      FILTER_OBJECTS=events.obj
   else
      FILTER_OBJECTS=events_slave_mode.obj
   endif
else
   FILTER_OBJECTS=events_slave_mode.obj
endif
