# zeal - A portable Glk-based Z-code interpreter
# Copyright (C) 2000 Jeremy Condit <jcondit@eecs.harvard.edu>
# 
# 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.

#############################################################################

# Definitions for where the Glk lib and include directories are.
# The following are defaults that might work.
# Based loosely on glkzip's Makefile system.

GLKLIB = glkterm

# for XGlk
ifeq ($(GLKLIB), xglk)
GLKDIR = ../xglk
GLKINCLUDEDIR = -I$(GLKDIR)
GLKLIBDIR = -L$(GLKDIR)
GLKMAKEFILE = $(GLKDIR)/Make.xglk
GLKEXTSRCS = unix.cc
TARGET = xzeal
endif

# for GlkTerm
ifeq ($(GLKLIB), glkterm)
GLKDIR = ../glkterm
GLKINCLUDEDIR = -I$(GLKDIR)
GLKLIBDIR = -L$(GLKDIR)
GLKMAKEFILE = $(GLKDIR)/Make.glkterm
GLKEXTSRCS = unix.cc
TARGET = zeal
endif

#############################################################################

include $(GLKMAKEFILE)

CXX		= g++
CXXFLAGS	= -g -ansi -Wall -pedantic $(GLKINCLUDEDIR)

SOURCES		= alpha.cc \
		  bfish.cc \
		  dict.cc \
		  error.cc \
		  iface.cc \
		  inst.cc \
		  machine.cc \
		  obj.cc \
		  prop.cc \
		  quetzal.cc \
		  random.cc \
		  stdlite.cc \
		  zeal.cc \
		  $(GLKEXTSRCS)

INCLUDES	= alpha.h \
		  bfish.h \
		  dict.h \
		  iface.h \
		  inst.h \
		  machine.h \
		  obj.h \
		  prop.h \
		  osdep.h \
		  random.h \
		  stdlite.h \
		  zeal.h

OBJECTS		= $(SOURCES:.cc=.o)

$(TARGET):	$(OBJECTS)
		$(CXX) -o $@ $(OBJECTS) $(GLKLIBDIR) $(GLKLIB) $(LINKLIBS)
		chmod a+rx $(TARGET)

tidy:
		rm -f $(OBJECTS)

clean:
		rm -f $(OBJECTS) $(TARGET)

depend:         $(SOURCES) $(INCLUDES)
		$(CXX) $(CXXFLAGS) -M $(SOURCES) > makedep
		echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
		echo '$$r makedep' >>eddep
		echo 'w' >>eddep
		ed - Makefile < eddep
		rm eddep makedep
		echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
		echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
		echo '# see make depend above' >> Makefile

#-----------------------------------------------------------------
# DO NOT DELETE THIS LINE -- make depend uses it


