#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser 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
#

ROOT    = ..
SHELL   = /bin/sh

#
# Gtoolbar code and Icon image locations.
#
GTBICONS	= ../Gtbicons.zip
GTBINCLUDE	= ../Gtoolbar.inf

#
# Standard method to compile .inf files.
#
GLULX_INFORM	= ../../informg621/inform +../../libg610 $(INFORM_OPTS)
GLULX_FLAGS	= -~S
#GLULX_FLAGS	= -D
.SUFFIXES:
.SUFFIXES:	.inf .ulx
.inf.ulx:
	$(GLULX_INFORM) $(GLULX_FLAGS) $<

#
# List of all image resources required.
#
IMAGES	=  PIC1  PIC2  PIC3  PIC4  PIC5					\
	   PIC6  PIC7  PIC8  PIC9  PIC10 PIC11 PIC12 PIC13		\
	   PIC14 PIC15 PIC16 PIC17					\
	   PIC18 PIC19 PIC20 PIC21					\
	   PIC22 PIC23 PIC24 PIC25 PIC26 PIC27				\
	   PIC28 PIC29 PIC30 PIC31

#
# Default make target.
#
default:	all

#
# Unpack icon images, and copy toolbar include file.
#
$(IMAGES):	$(GTBICONS)
	unzip -qquoL $(GTBICONS) $@
Gtoolbar.h:	$(GTBINCLUDE)
	cp -f $? $@

#
# Build blorbtar if needed.
#
blorbtar:	blorbtar-0.1.pl blorbtar-0.1.patch
	cp blorbtar-0.1.pl blorbtar
	patch -Np0 blorbtar <blorbtar-0.1.patch
	chmod u+x blorbtar 

#
# Targets.
#
all:	advent.blb

Advent.ulx:	Gtoolbar.h Advent.inf

advent.blb:	STORY0 $(IMAGES) blorbtar
	./blorbtar c $@ STORY0 $(IMAGES)

STORY0:	Advent.ulx
	cp $< $@

clean:
	rm -f STORY0 PIC*
	rm -f blorbtar Gtoolbar.h
	rm -f *.ulx *.blb

distclean:	clean

maintainer-clean:	distclean
