#! gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (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		= ../../..

include $(DEPTH)/config/config.mk

MODULE		= xfe2

USE_3PANE 	= 1
USE_ABCOM 	= 1
GLUE_COMPO_CONTEXT = 1

LIBRARY_NAME	= xfe2

REQUIRES	=\
			XfeWidgets \
			XfeBm \
			XfeComboBox \
			XfeToolBar \
			XfeToolTip \
			Microline \
			nspr \
			layer \
			js \
			jtools \
			applet \
			security \
			img \
			util \
			parse \
			layout \
			hook \
			pref \
			java \
			oji \
			libfont \
			ldap \
			lay \
			style \
			xfeicons \
			rdf \
			progress \
			xpcom \
			plugin \
			plugimpl \
			raptor \
			netcnvts \
			progress \
			privacy \
			caps

ifdef OJI
REQUIRES +=	  oji \
		  ojiimpl
endif

ifdef MOZ_MAIL_NEWS
REQUIRES +=	  msg
else
ifdef MOZ_MAIL_COMPOSE
REQUIRES +=	  mailto
endif
endif

CPPSRCS		= \
		  ToolbarButton.cpp \
		  ToolbarItem.cpp \
		  ToolbarUrlBar.cpp \
		  plugin.cpp \
		  BackForwardMenu.cpp \
		  BookmarkFrame.cpp \
		  BookmarkMenu.cpp \
		  BuiltinTreeView.cpp \
		  Button.cpp \
		  BrowserDrop.cpp \
		  BrowserFrame.cpp \
		  BrowserView.cpp \
		  ColorDialog.cpp \
		  Command.cpp \
		  Component.cpp \
		  DesktopTypes.cpp \
		  Dialog.cpp \
		  DisplayFactory.cpp \
		  Dashboard.cpp \
		  DownloadFrame.cpp \
		  DragDrop.cpp \
		  FindDialog.cpp \
		  FrameListMenu.cpp \
		  Frame.cpp \
		  HTMLDialogFrame.cpp \
		  HistoryMenu.cpp \
		  HTMLDrag.cpp \
		  HTMLView.cpp \
		  IconGroup.cpp \
		  Image.cpp \
		  LocationDrag.cpp \
		  Logo.cpp \
		  Menu.cpp \
		  MenuBar.cpp \
		  Minibuffer.cpp \
		  MozillaApp.cpp \
		  NavCenterFrame.cpp \
		  NavCenterView.cpp \
		  Netcaster.cpp \
		  NotificationCenter.cpp \
		  Outliner.cpp \
		  PopupMenu.cpp \
		  PrefsDialogAppl.cpp \
		  PropertyTabView.cpp \
		  ProxyIcon.cpp	\
		  PrefsApplEdit.cpp \
		  PrefsDialog.cpp \
		  PrefsDialogBrowser.cpp \
		  PrefsDialogGeneral.cpp \
		  PrefsDialogMailnews.cpp \
		  PrefsDialogSmart.cpp \
		  PrefsLang.cpp \
		  PrefsProxiesView.cpp \
		  RDFBase.cpp \
		  RDFChromeTreeView.cpp \
		  RDFImage.cpp \
		  RDFMenuToolbarBase.cpp \
		  RDFTreeView.cpp \
		  RDFToolbar.cpp \
		  RDFToolbox.cpp \
		  RadioGroup.cpp \
		  Toolbar.cpp \
		  ToolbarDrop.cpp \
		  Toolbox.cpp \
		  ToolboxItem.cpp \
		  URLBar.cpp \
		  ViewDialog.cpp \
		  ViewGlue.cpp \
		  View.cpp \
		  context_funcs.cpp \
		  pref.cpp \
		  utf8xfe.cpp \
		  $(NULL)


ifdef NSPR_SPLASH
CPPSRCS		+= \
			Splash.cpp \
			$(NULL)
endif

ifdef USE_MOTIF_DND
CPPSRCS		+= \
		OutlinerDrop.cpp \
		$(NULL)
endif

ifdef MOZ_MAIL_NEWS
MAIL_OR_COMPOSE	= 1
endif
ifdef MOZ_MAIL_COMPOSE
MAIL_OR_COMPOSE	= 1
endif

ifdef MAIL_OR_COMPOSE
CPPSRCS		+= \
		  AddressFolderView.cpp \
		  AddressOutliner.cpp \
		  AttachPanel.cpp \
		  AttachmentMenu.cpp \
		  ComposeAttachDialog.cpp \
		  ComposeAttachFolderView.cpp \
		  ComposeFolderView.cpp \
		  ComposeFrame.cpp \
		  ComposeView.cpp \
		  MNView.cpp \
		  MNListView.cpp \
		  OptionFolderView.cpp \
		  ProgressFrame.cpp \
		  TabView.cpp \
		  TextEditorView.cpp \
		  $(NULL)
endif

ifdef MOZ_MAIL_NEWS
CPPSRCS		+= \
		  ABComplPickerDlg.cpp \
		  ABComplPickerView.cpp \
		  ABDirGenTabView.cpp \
		  ABDirPropertyDlg.cpp \
		  ABSearchDlg.cpp \
		  ABSearchView.cpp \
		  AB2PaneView.cpp \
		  ABDirListView.cpp \
		  ABAddrSearchView.cpp \
		  ABAddresseeView.cpp \
		  ABAddressingDlg.cpp \
		  ABListSearchView.cpp\
		  ABMListDlg.cpp \
		  ABMListView.cpp \
		  ABNameCTalkTab.cpp \
		  ABNameConTab.cpp \
		  ABNameFolderDlg.cpp \
		  ABNameGenTab.cpp \
		  AddrBookFrame.cpp \
		  AddrBookView.cpp \
		  AdvSearchDialog.cpp \
		  EditHdrDialog.cpp \
		  FolderDropdown.cpp \
		  FolderFrame.cpp \
		  FolderPromptDialog.cpp \
		  FolderMenu.cpp \
		  FolderView.cpp \
		  MNBanner.cpp \
		  MNSearchFrame.cpp \
		  MNSearchView.cpp \
		  MailDownloadFrame.cpp \
		  MailFilterDlg.cpp \
		  MailFilterRulesDlg.cpp \
		  MailFilterRulesView.cpp \
		  MailFilterView.cpp \
		  MailFolderPropDialog.cpp \
		  MsgFrame.cpp \
		  MsgView.cpp \
		  NewsPromptDialog.cpp \
		  NewsServerDialog.cpp \
		  NewsServerPropDialog.cpp \
		  NewsgroupPropDialog.cpp \
		  PrefsDialogMServer.cpp \
		  PrefsDialogNServer.cpp \
		  PrefsMailFolderDlg.cpp \
		  PrefsPageAddress.cpp \
		  PrefsPageMessages.cpp \
		  PrefsPageNServer.cpp \
		  SubUpgradeDialog.cpp \
		  XmLFolderDialog.cpp \
		  XmLFolderView.cpp \
		  ViewDashBDlg.cpp \
		  PropertySheetDialog.cpp \
		  PropertySheetView.cpp \
		  ReadAttachDrag.cpp \
		  ReadAttachPanel.cpp \
		  SearchRuleView.cpp \
		  SubAllView.cpp \
		  SubNewView.cpp \
		  SubSearchView.cpp \
		  SubTabView.cpp \
		  SubscribeDialog.cpp \
		  SubscribeView.cpp \
		  ThreadFrame.cpp \
		  ThreadView.cpp \
		  $(NULL)

ifdef USE_3PANE
CPPSRCS		+= \
		ThreePaneView.cpp \
		$(NULL)
endif
endif

ifdef MOZ_EDITOR
CPPSRCS		+= \
		  EditorDrop.cpp \
		  EditorFrame.cpp \
		  EditorToolbar.cpp \
		  EditorView.cpp \
		  EditRecentMenu.cpp \
		  EditTableDialog.cpp \
		  EmbeddedEditor.cpp \
		  EmbeddedEditorView.cpp \
		  PrefsDialogEditor.cpp \
		  SpellHandler.cpp \
		  $(NULL)
endif

ifdef MOZ_LDAP
CPPSRCS		+= \
		  LdapSearchFrame.cpp \
		  LdapSearchView.cpp \
		  $(NULL)
endif

ifdef MOZ_TASKBAR
CPPSRCS		+= \
		  TaskBar.cpp \
		  TaskBarDrop.cpp \
		  $(NULL)

DEFINES += -DMOZ_TASKBAR
endif

ifdef MOZ_SELECTOR_BAR
DEFINES += -DMOZ_SELECTOR_BAR
endif

ifdef XFE_PREF_ADVANCED_PASSIVE_FTP
DEFINES		+= -DXFE_PREF_ADVANCED_PASSIVE_FTP
endif

ifdef XFE_FILE_BOOKMARK_IN_LINK_CONTEXT_MENU
DEFINES		+= -DXFE_FILE_BOOKMARK_IN_LINK_CONTEXT_MENU
endif

CSRCS		= commands.c

include $(DEPTH)/config/rules.mk

INCLUDES	+= -I$(OBJDIR) -I.. -I../DtWidgets -I$(DEPTH)/modules/libreg/include \
		-I$(DEPTH)/dist/public/security

ifdef MOZ_MAIL_NEWS
INCLUDES	+= -I$(DEPTH)/lib/libmsg  -I$(DEPTH)/dist/public/ldap
endif

DEFINES		+= -DNEW_DECODERS -DDELAYED_MENU_CREATION -DNETCASTER_ZAXIS_HACKERY
DEFINES		+= -DUSE_MAGIC_TOOLBAR

ifdef USE_3PANE
DEFINES		+= -DUSE_3PANE
endif

ifdef MOZ_MAIL_NEWS
ifdef USE_ABCOM
DEFINES		+= -DUSE_ABCOM
endif
endif

ifdef GLUE_COMPO_CONTEXT
DEFINES		+= -DGLUE_COMPO_CONTEXT
endif

ifdef USE_MOTIF_DND
DEFINES		+= -DUSE_MOTIF_DND
endif

$(LIBRARY): $(OBJS)

# note the header file is generated as a side effect here.
$(OBJDIR)/commands.c $(OBJDIR)/commands.h: $(OBJDIR)/mkcommands xfe_commands
	@echo Generating command table information... ; \
	$(OBJDIR)/mkcommands -table $(OBJDIR)/commands.c -header $(OBJDIR)/commands.h xfe_commands

$(OBJDIR)/commands.o: $(OBJDIR)/commands.c
	$(CC) -c -I. -o $@ $(OBJDIR)/commands.c

$(OBJDIR)/mkcommands: mkcommands.c
	@$(MAKE_OBJDIR)
	$(CCF) -o $@ $<


# This rule is needed for 'make -j' to work since just about everything
# is dependant on commands.h.
$(OBJS): $(OBJDIR)/commands.h

NetcasterIncluders:=Frame.o PrefsDialogGeneral.o Netcaster.o
$(foreach f,$(NetcasterIncluders),$(OBJDIR)/$(f)): Netcaster.h
