#
# macport/Makefile.  Generated from Makefile.in by configure.
#
# macport/Makefile.in
# 
# This file is part of the Oxford Oberon-2 compiler
# Copyright (c) 2006 J. M. Spivey
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
#    this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
#    derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# $Id$
#

# Config stuff
prefix = /usr/local
exec_prefix = ${prefix}
srcdir = .
top_srcdir = ..
datarootdir = ${prefix}/share
abs_builddir = /home/mike/src/build/obc-2.9.1/macport
bindir = ${exec_prefix}/bin
libdir = ${exec_prefix}/lib
VERSION=2.9.1
SIG=0x00020901
subdir = macport
INSTALL = /usr/bin/install -c
INSTALL_PROG = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
RESDIR = $(top_srcdir)/resources
RESOURCES = blank.png breakpoint.png continue.png here.png   oberon.lang pause.png sober.xml stepinto.png stepout.png stepover.png   restart.png exit.png
GTKDIR = /usr
# End

all:

DEBUGAPP = Obdb.app

GTKTRG = $(DEBUGAPP)/Contents/Resources
GTKLIB = libatk-1.0.0 libcairo.2 libexpat.1.5.2 libfontconfig.1		\
	libfreetype.6 libgailutil.18 libgdk-quartz-2.0.0		\
	libgdk_pixbuf-2.0.0 libgettextlib-0.17 libgettextpo.0.4.0	\
	libgettextsrc-0.17 libgio-2.0.0 libglib-2.0.0 libgmodule-2.0.0	\
	libgobject-2.0.0 libgthread-2.0.0 libgtk-quartz-2.0.0		\
	libgtksourceview-2.0.0 libintl.8 libjpeg.7 libltdl.7		\
	libpango-1.0.0 libpangocairo-1.0.0 libpangoft2-1.0.0		\
	libpixman-1.0 libpng.3 libpng12.0 libtiff.3 libtiffxx.3		\
	libigemacintegration.0
GTKSO = libpixbufloader-png

GTKINST = $(INSTALL) -d $(GTKTRG)/$(2) && \
	$(INSTALL_$(1)) $(3:%=$(GTKDIR)/$(2)/%) $(GTKTRG)/$(2)

gtklib:
	mkdir -p $@
	cp $(GTKLIB:%=$(GTKDIR)/lib/%.dylib) $@
	cp $(GTKSO:%=$(GTKDIR)/lib/gtk-2.0/2.10.0/loaders/%.so) $@
	sh ./rename-libs $@ $(GTKDIR)/lib

debugger: Obdb.app

Obdb.app: obdb.script ../debugger/obdb1 gdk-pixbuf.loaders \
		$(RESOURCES:%=$(RESDIR)/%)
	rm -rf $(DEBUGAPP)
	$(INSTALL) -d $(DEBUGAPP)/Contents
	$(INSTALL_DATA) Info.plist $(DEBUGAPP)/Contents
	$(INSTALL) -d $(DEBUGAPP)/Contents/MacOS
	$(INSTALL_PROG) obdb.script $(DEBUGAPP)/Contents/MacOS/obdb
	$(INSTALL_PROG) ../debugger/obdb1 $(DEBUGAPP)/Contents/MacOS
	$(INSTALL) -d $(GTKTRG)/lib
	$(INSTALL_PROG) $(GTKLIB:%=gtklib/%.dylib) $(GTKSO:%=gtklib/%.so) \
		$(GTKTRG)/lib
	$(INSTALL_DATA) gdk-pixbuf.loaders $(RESOURCES:%=$(RESDIR)/%) $(GTKTRG)
	$(call GTKINST,DATA,share/gtksourceview-2.0/language-specs,\
		def.lang language.dtd language.rng language2.rng)
	$(call GTKINST,DATA,share/gtksourceview-2.0/styles,\
		classic.xml styles.rng)

PACKAGE = obc-mac-$(VERSION).pkg
VNUM := $(shell echo $(SIG) | sed 's/0x0*//')

package: tree force
	sudo chown -R root:wheel tree
	/Developer/usr/bin/packagemaker -v -b -m -w \
	    --root tree -o $(PACKAGE) \
	    --title 'Oxford Oberon-2 compiler' \
	    --id uk.ac.ox.oriel.spivey.obc \
	    --version $(VNUM) \
	    --target 10.5

tree: force
	if [ -r tree ]; then sudo rm -rf tree; fi
	$(MAKE) -C .. prefix=$(abs_builddir)/tree/usr/local install


# Clean-up

clean: force
	rm -rf $(PACKAGE) tree Obdb.app

quiteclean distclean realclean: clean
	rm -rf gtklib

# Configuration

Makefile: $(srcdir)/Makefile.in ../config.status
	cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status

force:
