 # ##### BEGIN LICENSE BLOCK #####
 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
 #
 # The contents of this file are subject to the Mozilla Public
 # License Version 1.1 (the "License"); you may not use this file
 # except in compliance with the License. You may obtain a copy of
 # the License at http://www.mozilla.org/MPL/
 #
 # Software distributed under the License is distributed on an "AS IS" basis,
 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 # for the specific language governing rights and limitations under the
 # License.
 #
 # Contributor(s):
 #   C.N Medappa <jrex_moz@yahoo.com>
 #
 # Alternatively, the contents of this file may be used under the terms of
 # either the GNU General Public License Version 2 or later (the "GPL"), or
 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 # in which case the provisions of the GPL or the LGPL are applicable instead
 # of those above. If you wish to allow use of your version of this file only
 # under the terms of either the GPL or the LGPL, and not to allow others to
 # use your version of this file under the terms of the NPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the NPL, the GPL or the LGPL.
 #
 # ##### END LICENSE BLOCK ##### #

DEPTH		= ../../../..
topsrcdir	= ../../../..
srcdir		= .
VPATH		= .

include $(DEPTH)/config/autoconf.mk

MODULE           = jrex
LIBRARY_NAME     = jrex
FORCE_SHARED_LIB = 1

REQUIRES	= xpcom \
		  string \
		  docshell \
		  webshell \
		  appshell \
		  embedstring \
		  necko \
		  widget \
		  dom \
		  xpconnect \
		  gfx \
		  layout \
		  content \
		  uriloader \
		  webbrwsr \
		  webbrowserpersist \
		  shistory \
		  embed_base \
		  pref \
		  windowwatcher \
		  commandhandler \
		  profile \
		  $(NULL)

CPPSRCS		= \
		JRexDirectoryServiceProviderImpl.cpp \
		JRexWindowImpl.cpp \
		JRexWindowCreatorImpl.cpp \
		JRexWebBrowserChromeImpl.cpp \
		JRexEmbeddingSiteWindow2Impl.cpp  \
		JRexInterfaceRequestorImpl.cpp    \
		JRexTooltipListenerImpl.cpp \
		JRexWebBrowserChromeFocusImpl.cpp \
		JRexContextMenuListener2Impl.cpp   \
		JRexSHistoryListenerImpl.cpp \
        	JRexWebProgressListenerImpl.cpp \
		JRexNavigationWrapper.cpp \
		JRexInputEventWrapper.cpp \
		JRexURIContentEventWrapper.cpp \
		JRexPrintEventWrapper.cpp \
		JRexInputStream.cpp \
		JRexEditEventWrapper.cpp \
		JRexObserverImpl.cpp \
		JRexInputEventListener.cpp \
		JRexURIContentEventListener.cpp \
		JRexStreamListener.cpp \
		JRexPreferenceWrapper.cpp \
		JRex_JNI_util.cpp \
		JRex_JNI_Event.cpp \
		JRex_JNI_WindowEvent.cpp \
		JRex_JNI_HistoryEvent.cpp \
		JRex_JNI_ProgressEvent.cpp \
		JRex_JNI_ContextMenuEvent.cpp \
		JRex_JNI_TooltipEvent.cpp \
		JRex_JNI_ObserverEvent.cpp \
		JRex_JNI_URIContentEvent.cpp \
		jni/org_mozilla_jrex_xpcom_JRexXPCOMImpl.cpp \
		jni/org_mozilla_jrex_ui_JRexCanvas.cpp \
		jni/org_mozilla_jrex_event_JRexEventManager.cpp \
		jni/org_mozilla_jrex_navigation_WebNavigationImpl.cpp \
		jni/org_mozilla_jrex_pref_JRexPreference.cpp \
		jni/org_mozilla_jrex_io_JRexInputStream.cpp \
		$(NULL)

SHARED_LIBRARY_LIBS= \
		$(NULL)

EXTRA_DSO_LDOPTS= \
                $(XPCOM_GLUE_LIBS) \
		$(MOZ_UNICHARUTIL_LIBS) \
		$(NSPR_LIBS) \
		$(MOZ_JS_LIBS) \
		$(MOZ_COMPONENT_LIBS) \
		$(DIST)/lib/$(LIB_PREFIX)xpcombase_s.$(LIB_SUFFIX) \
		$(DIST)/lib/$(LIB_PREFIX)embedstring_s.$(LIB_SUFFIX) \
		$(DIST)/lib/$(LIB_PREFIX)embed_base_s.$(LIB_SUFFIX) \
		$(NULL)
		
ifeq ($(OS_ARCH),Linux)
EXTRA_DSO_LDOPTS+= \
		$(JAVA_HOME)/jre/lib/i386/$(LIB_PREFIX)jawt.so \
		$(JAVA_HOME)/jre/lib/i386/client/$(LIB_PREFIX)jvm.so \
		$(NULL)
else
EXTRA_DSO_LDOPTS+= \
		$(JAVA_HOME)/lib/$(LIB_PREFIX)jawt.$(LIB_SUFFIX) \
		$(JAVA_HOME)/lib/$(LIB_PREFIX)jvm.$(LIB_SUFFIX) \
                $(NULL)
endif # Linux

include $(topsrcdir)/config/rules.mk
DEFINES	+= -DXPCOM_GLUE=1 $(JREX_DEBUG)

ifeq ($(OS_ARCH),WINNT)
ifndef GNU_CC
INCLUDES := -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/win32 $(INCLUDES) -I.
CXXFLAGS +=-GX
endif # !GNU_CC
endif # WINNT

ifeq ($(OS_ARCH),Linux)
ifdef GNU_CC
INCLUDES := -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(INCLUDES) -I.
CXXFLAGS        +=-fexceptions
CXXFLAGS        += $(MOZ_GTK_CFLAGS)
CFLAGS          += $(MOZ_GTK_CFLAGS)
EXTRA_DSO_LDOPTS+= $(MOZ_GTK_LDFLAGS)
endif # GNU_CC
endif # Linux

