#
# The contents of this file are subject to the Netscape Public License
# Version 1.1 (the "NPL"); you may not use this file except in
# compliance with the NPL.  You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation.  Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.  All Rights
# Reserved.
#

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

include $(DEPTH)/config/autoconf.mk

MODULE		= widget
LIBRARY_NAME	= widget_mac
EXPORT_LIBRARY = 1
IS_COMPONENT	= 1
MODULE_NAME	= nsWidgetMacModule
XPIDL_MODULE	= widget_cocoa
GRE_MODULE	= 1

REQUIRES = xpcom \
		  gfx \
		  string \
		  uconv \
		  dom \
		  webshell \
		  docshell \
		  plugin \
		  content \
		  layout \
		  view \
		  xul \
		  necko \
		  nkcache \
		  locale \
		  pref \
		  intl \
		  mimetype \
		  unicharutil \
		  exthandler \
		  $(NULL)

EXPORTS = \
		mozView.h \
		$(NULL)

GFX_LCPPSRCS = \
		nsWatchTask.cpp \
		$(NULL)

MAC_LCPPSRCS = \
		nsBidiKeyboard.cpp \
		nsClipboard.cpp \
		nsDragService.cpp \
		nsDragHelperService.cpp \
		nsLookAndFeel.cpp \
		nsMacNativeUnicodeConverter.cpp \
		nsMacResources.cpp \
		nsMimeMapper.cpp \
		nsSound.cpp \
		nsStylClipboardUtils.cpp \
		nsToolkitBase.cpp \
		nsTSMStrategy.cpp \
		$(NULL)


CPPSRCS =  \
		nsMenuX.cpp \
		nsMenuBarX.cpp \
		nsMenuItemX.cpp \
		$(MAC_LCPPSRCS) \
		$(GFX_LCPPSRCS) \
		$(NULL)

CMMSRCS = \
		nsFilePicker.mm \
		nsToolkit.mm \
		nsAppShellCocoa.mm \
		nsCocoaWindow.mm \
		nsChildView.mm \
		nsWidgetFactory.mm \
		nsNativeScrollbar.mm \
		$(NULL)
	
XPIDLSRCS	+= \
		nsIChangeManager.idl \
		nsIMenuCommandDispatcher.idl \
		nsIDragHelperService.idl \
		$(NULL)

GFX_CPPSRCS     := $(addprefix $(topsrcdir)/gfx/src/mac/,$(GFX_LCPPSRCS))
MAC_CPP_CSRCS   := $(addprefix $(srcdir)/../mac/,$(MAC_LCPPSRCS))

SHARED_LIBRARY_LIBS = $(DIST)/lib/libxpwidgets_s.a

EXTRA_DSO_LDOPTS += \
		$(MOZ_UNICHARUTIL_LIBS) \
		$(TK_LIBS) \
		$(MOZ_COMPONENT_LIBS) \
		-lgkgfx \
		$(NULL)

GARBAGE		+= $(GFX_LCPPSRCS) $(MAC_LCPPSRCS)

include $(topsrcdir)/config/rules.mk

RES_DEST = $(DIST)/bin/libwidget.rsrc
RES_SRC = nsMacWidget.r

export:: $(GFX_CPPSRCS) $(MAC_CPP_CSRCS) $(srcdir)/../mac/$(RES_SRC)
	$(INSTALL) $^ .

$(RES_DEST): $(RES_SRC)
	/Developer/Tools/Rez -i /Developer/Headers/FlatCarbon -useDF $(RES_SRC) -o $(RES_DEST)

libs:: $(RES_DEST)

LOCAL_INCLUDES	= \
	$(TK_CFLAGS) \
	-I$(topsrcdir)/gfx/src/mac \
	-I$(srcdir)/../xpwidgets \
	-I$(srcdir)/../mac \
	-I/System/Library/Frameworks/Carbon.Framework/Headers \
	-I/System/Library/Frameworks/Cocoa.Framework/Headers \
	$(NULL)

LDFLAGS	+= \
	-framework QuickTime \
	-framework IOKit \
	-framework Cocoa \
	$(NULL)

CXXFLAGS += \
  -DUSE_COCOA \
  $(NULL)

  
