## AbiSource Applications
## Copyright (C) 2001 Sam Tobin-Hochstadt
## Copyright (C) 2001 Hubert Figuiere
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
## 
## 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 for more details.
## 
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
## 02111-1307, USA.

include $(top_srcdir)/includes.mk

bin_PROGRAMS = AbiWord

INCLUDES=\
	 -DABIWORD_APP_NAME="\"$(ABIWORD_APP_NAME)\"" \
	$(AF_INCLUDES) $(WP_INCLUDES) $(OTHER_INCLUDES) \
	$(TEXT_INCLUDES) 

AbiWord_SOURCES = abi_ver.cpp CocoaMain.mm

REPEAT_LIBS = $(ABI_LIBS) 

AbiWord_LDADD = $(REPEAT_LIBS) $(REPEAT_LIBS) @PLATFORM_LIBS@ $(REPEAT_LIBS) $(OTHER_LIBS) 

#RESOURCES=$(top_srcdir)/src/af/util/mac/ut_MacAssert.rsrc \
#	$(top_srcdir)/src/af/xap/mac/xap_MacDlg_MessageBox.rsrc \
#	$(top_srcdir)/src/af/xap/mac/xap_MacResources.rsrc

NIBS=$(top_srcdir)/src/af/xap/cocoa/xap_CocoaToolbarWindow.nip \
	$(top_srcdir)/src/wp/ap/cocoa/ap_CocoaFrame.nib \
	$(top_srcdir)/src/wp/ap/cocoa/ap_CocoaSplash.nib

PROGRAM_BUNDLE=AbiWord.app/Contents
PROGRAM_BUNDLE_BIN=$(PROGRAM_BUNDLE)/MacOS
PROGRAM_BUNDLE_RES=$(PROGRAM_BUNDLE)/Resources


#$(PROGRAM_BUNDLE_RES)/AbiWord.rsrc: $(RESOURCES)
#	@mkdir -p $(PROGRAM_BUNDLE_RES)
#	@mkdir -p $(PROGRAM_BUNDLE_BIN)
#	$(RESMERGER) -srcIs DF -dstIs DF $(RESOURCES) -o $@

$(PROGRAM_BUNDLE_BIN)/AbiWord: AbiWord
	@mkdir -p $(PROGRAM_BUNDLE_RES)
	@mkdir -p $(PROGRAM_BUNDLE_BIN)
	(cd $(top_srcdir)/src/af/xap/cocoa/ ; tar cf - xap_CocoaToolbarWindow.nib) | (cd $(PROGRAM_BUNDLE_RES) ; tar xf -) 
	(cd $(top_srcdir)/src/wp/ap/cocoa/ ; tar cf - ap_CocoaFrame.nib) | (cd $(PROGRAM_BUNDLE_RES) ; tar xf -) 
	(cd $(top_srcdir)/src/wp/ap/cocoa/ ; tar cf - ap_CocoaSplash.nib) | (cd $(PROGRAM_BUNDLE_RES) ; tar xf -) 
	cp bundle/PkgInfo $(PROGRAM_BUNDLE)
	cp bundle/Info.plist $(PROGRAM_BUNDLE)
	cp bundle/AbiWord.icns $(PROGRAM_BUNDLE_RES)
	cp bundle/abiword_48.tif $(PROGRAM_BUNDLE_RES)
	cp $< $@

all: $(PROGRAM_BUNDLE_BIN)/AbiWord


abi_ver.cpp:
	cp $(srcdir)/../xp/abi_ver.cpp .

