# Generated automatically from Makefile.in by configure.
# DIST: This is the distribution Makefile for WILD Life.  configure
# DIST: can make most of the changes to this file you might want, so
# DIST: try that first.

SHELL		= /bin/sh

CC		= gcc
CFLAGS		= -g -O 
CPPFLAGS	= 
LDFLAGS		= 
LIBS		= -lm
DEFS		= -DX11=1 -DNEEDXLIBINT=1 -DGARBCOL=1 -DALLOC_WORDS=2097152 #-DNORAW
RANLIB		= ranlib
INSTALL		= /usr/local/bin/install -c
MKDIRHIER	= mkdirhier
prefix		= /usr/local
exec_prefix	= ${prefix}
bindir		= ${exec_prefix}/bin
libdir		= ${prefix}/Life
srcdir		= .
X_CFLAGS	= -I/usr/X11R6/include
X_LIBS		= -L/usr/X11R6/lib
X_EXTRA_LIBS	= 
X_PRE_LIBS	= -lSM -lICE
XLIBS		= ${X_PRE_LIBS} ${X_LIBS} -lX11 ${X_EXTRA_LIBS}
XLIBRARIES	= ${XLIBS}
MKDEP		= makedepend
SETUPDIR	= ${libdir}
SETUP		= ${SETUPDIR}/Source/.set_up
INCLUDE_PATHS	= /usr/X11R6/include
XSOURCE		= ${XSRC}
XOBJECT		= ${XOBJ}
XINCLUDE	= ${XINC}
DBMSOURCE	= 
DBMOBJECT	= 

#=====================================================================
# For Linux:
# The following variable should contain the pathname of the GCC include
# directory.  Run 'gcc -v' to find where gcc's directories are, then edit
# the sample pathname below to be correct.
#INCLUDE_PATHS	= -I/usr/lib/gcc-lib/i[34]86-linux/<version>/include
#
# For Linux (continued):
# This is an example of a definition that works on a Gateway 2000 machine:
#INCLUDE_PATHS = -I/usr/lib/gcc-lib/i486-linux/2.4.5/include -I/usr/include/bsd
#
# For Solaris
#INCLUDE_PATHS = -I/usr/openwin/include
#=====================================================================

#=====================================================================
# -DNORAW
# Add this if the low-level (unbuffered) terminal input file (raw.c) won't
# compile on your system.  On SunOS for some reason this file will include some
# library files twice. This does not seem to make any difference.
#
# -DNEED_TRUNC
# If defined, adds a definition of the 'trunc' function.
# 
# -DX11
# If defined, will cause the X interface to be linked in.  If it is not
# defined then the system will contain no X interface.  -lX11 should be
# removed from LOADFLAGS in that case (see below).
#
# -DGARBCOL
# If defined will cause the garbage collector to be called when memory is low.
#
# -DUNIF_DEBUG
# If defined causes the 'debug' mode to show matching and unification sub-goals.
#=====================================================================

COMPILE.c	= $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c
XCOMPILE.c	= $(CC) $(CFLAGS) $(X_CFLAGS) $(CPPFLAGS) $(DEFS) -c
.c.o:
	$(COMPILE.c) -o $@ $<

#=====================================================================
# MEMORY is the number of words that the system will allocate.
# Because of the half-space GC, Wild-LIFE will actually allocate twice that
# many words. So on a 32-bit system, multiply by 8 to obtain the real memory
# usage in bytes.  The default size results in about 17MB virtual memory size.
# If this is too big for your system then redefine MEMORY as suggested below.
#
# The memory size given by MEMORY is overridden by
# the command line argument: "-memoryNNNNNNNN"
#
# Normal version (totals about 17 MB virtual)
#MEMORY = 2097152
#
# Smaller versions--take your pick.
# The smallest totals about 5 MB virtual.
# Under Linux, one of the smaller versions may run better--it depends on
# how much RAM and swap space your machine has.
#MEMORY = 1048576
#MEMORY = 524288
#=====================================================================

PROGRAM = wild_life

XSRC = xpred.c xdisplaylist.c
XOBJ = xpred.o xdisplaylist.o
XINC = xpred.h xdisplaylist.h

LIBSOURCE = \
	arity.c bi_math.c bi_sys.c bi_type.c built_ins.c copy.c error.c \
	hash_table.c info.c interrupt.c lefun.c lib.c list.c login.c \
	lub.c memory.c modules.c parser.c print.c raw.c sys.c templates.c \
	token.c trees.c types.c $(XSOURCE) $(DBMSOURCE)

LIBOBJECT = \
	arity.o bi_math.o bi_sys.o bi_type.o built_ins.o copy.o error.o \
	hash_table.o StampedInfo.o interrupt.o lefun.o StampedLib.o list.o login.o \
	lub.o memory.o modules.o parser.o print.o raw.o sys.o templates.o \
	token.o trees.o types.o $(XOBJECT) $(DBMOBJECT)

LIBINCLUDE = \
	built_ins.h c_life.h copy.h error.h extern.h info.h interrupt.h \
	lefun.h list.h login.h memory.h modules.h parser.h print.h raw.h \
	templates.h token.h trees.h types.h $(XINCLUDE) \
	sys.h

REINCLUDE = regexp.h

PROGINCLUDE = $(LIBINCLUDE)
PROGSOURCE  = $(LIBSOURCE) life.c
PROGOBJECT  = $(LIBOBJECT) life.o

PROGSOURCELIFE = built_ins.lf term_expansion.lf onlinedoc.lf

MANPAGE = $(PROGRAM).1

LIBA = c_life.a

# Please don't change this so we can tell which release you are using.
DATE        = Fri Jul  7 13:57:49 PDT 1995
VERSION     = 1.02

all: $(LIBA) $(PROGRAM) .set_up Demo
	@echo
	@echo "Life generation done"
	@echo

	
	
Demo:
	cd ../Demo; $(MAKE) SETUPDIR="$(SETUPDIR)"


	
regexp/regexp.o regexp/regsub.o: 
	cd	regexp; $(MAKE)   CC="$(CC)" CFLAGS="$(CFLAGS)" ;
	@echo "Regular Expression Package: $@ done"


	



$(PROGRAM): $(LIBA) StampedLife.o
	$(CC) -o $(PROGRAM) StampedLife.o $(LIBA) $(LDFLAGS) $(LIBS) $(XLIBRARIES)

.set_up: .set_up_basis
	sed -e "s%+SETUPDIR+%$(SETUPDIR)%g" < .set_up_basis > .set_up

clean:
	-rm *~ *.o *.a .set_up Stamped*.c $(PROGRAM)
	cd regexp; $(MAKE) clean

veryclean: clean
	-rm *.cache *.status Makefile
	cd regexp; $(MAKE) veryclean

StampedLife.c: life.c Makefile
	sed -e "s%+SETUP+%$(SETUP)%" < life.c > StampedLife.c

StampedLib.c:	lib.c Makefile
	sed -e "s%+SETUP+%$(SETUP)%" < lib.c > StampedLib.c

StampedInfo.c: $(PROGSOURCE) $(PROGINCLUDE)
	@echo Don\'t be surprised, info is compiled "for ${DATE} because" something has changed
	sed -e "s/+VERSION+/$(VERSION)/" \
	    -e "s/+DATE+/$(DATE)/" < info.c > StampedInfo.c

$(LIBA): regexp/regexp.o regexp/regsub.o $(LIBOBJECT)

	-rm -f $(LIBA)
	ar cr $(LIBA) $(LIBOBJECT) regexp/regexp.o regexp/regsub.o
	$(RANLIB) $(LIBA)

xpred.o: xpred.c
	$(XCOMPILE.c) -o $@ $<

xdisplaylist.o: xdisplaylist.c
	$(XCOMPILE.c) -o $@ $<

MKINSTALL = $(MAKE) MKDIRHIER="$(MKDIRHIER)"\
 libdir="$(libdir)" INSTALL="$(INSTALL)" srcdir="$(srcdir)" install

install: $(PROGRAM) .set_up
#	test -d $(bindir)          || $(MKDIRHIER) $(bindir)
	$(INSTALL) -m 755 $(PROGRAM) $(bindir)/$(PROGRAM)
#	test -d $(libdir)          || $(MKDIRHIER) $(libdir)
#	test -d $(libdir)/Source   || $(MKDIRHIER) $(libdir)/Source
	$(INSTALL) -m 744 .set_up           $(libdir)/Source
	$(INSTALL) -m 744 built_ins.lf      $(libdir)/Source
	$(INSTALL) -m 744 onlinedoc.lf      $(libdir)/Source
	$(INSTALL) -m 744 term_expansion.lf $(libdir)/Source
	cd	regexp;	$(MAKE)	r	CC="$(CC)"	CFLAGS="$(CFLAGS)"	; 
	cd $(srcdir)/../Lib;      $(MKINSTALL)
	cd $(srcdir)/../Tools;    $(MKINSTALL)
	cd $(srcdir)/../Examples; $(MKINSTALL)
	cd $(srcdir)/../Doc;      $(MKINSTALL)
	cd $(srcdir)/../Demo;     $(MKINSTALL)
#=====================================================================
# Dependencies

depend:
	$(MKDEP) $(CPPFLAGS) $(DEFS) $(INCLUDE_PATHS) $(PROGSOURCE)
