#
# 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_mac
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)

ifdef ACCESSIBILITY
REQUIRES	+= accessibility
endif

GFX_LCPPSRCS = \
		nsRepeater.cpp \
		nsWatchTask.cpp \
		$(NULL)

CPPSRCS			= nsAppShell.cpp \
		nsBidiKeyboard.cpp \
		nsButton.cpp \
		nsChildWindow.cpp \
		nsClipboard.cpp \
		nsDeleteObserver.cpp \
		nsDragService.cpp \
		nsDragHelperService.cpp \
		nsFilePicker.cpp \
		nsLabel.cpp \
		nsLookAndFeel.cpp \
		nsMacControl.cpp \
		nsMacEventHandler.cpp \
		nsMacMessagePump.cpp \
		nsMacResources.cpp \
		nsMacTSMMessagePump.cpp \
		nsMacWindow.cpp \
		nsMenuX.cpp \
		nsMenuBarX.cpp \
		nsMenuItemX.cpp \
		nsMimeMapper.cpp \
		nsNativeScrollbar.cpp \
		nsSound.cpp \
		nsTextWidget.cpp \
		nsTSMStrategy.cpp \
		nsToolkitBase.cpp \
		nsToolkit.cpp \
		nsWidgetFactory.cpp \
		nsWindow.cpp \
		nsMacNativeUnicodeConverter.cpp \
		nsStylClipboardUtils.cpp \
		$(GFX_LCPPSRCS) \
		$(NULL)

XPIDLSRCS  += \
		nsIChangeManager.idl \
		nsIMacTextInputEventSink.idl \
		nsIMenuCommandDispatcher.idl \
		nsPIWidgetMac.idl \
		nsPIEventSinkStandalone.idl \
		nsIDragHelperService.idl \
		$(NULL)

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

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

GARBAGE		+= $(GFX_LCPPSRCS)

include $(topsrcdir)/config/rules.mk

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

export:: $(addprefix $(topsrcdir)/gfx/src/mac/,$(GFX_LCPPSRCS))
	$(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 \
	$(NULL)

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