#Imakefile for xlife 4.1

/* #define ManSuffix n /* For sites where administrators have messed with this */

PROGRAMS	= xlife lifeconv collect lifesearch lifesearchdumb

XLIFEPATSDIR	= /usr/local/lib/xlife/
CCOPTIONS=-DLIFEDIR=\"$(XLIFEPATSDIR)\"

SRCS1 =  \
	cell.c\
	data.c\
	file.c\
	file_misc.c \
	generate.c\
	gentab.c\
	help.c\
	key.c\
	main.c\
	tentative.c\
	tile.c\
	utils.c

OBJS1 =  \
	cell.o\
	data.o\
	file.o\
	file_misc.o \
	generate.o\
	gentab.o\
	help.o\
	key.o\
	main.o\
	tentative.o\
	tile.o\
	utils.o

SRCS2 = \
	lifeconv.c

OBJS2 = \
	lifeconv.o

SRCS3 = \
	collect.c

OBJS3 = \
	collect.o

SRCS4 = \
	search.c \
	interact.c \
	dumbtty.c

OBJS4 = \
	search.o \
	interact.o \
	dumbtty.o

SRCS5 = \
	search.c \
	interact.c \
	cursestty.c

OBJS5 = \
	search.o \
	interact.o \
	cursestty.o

HDRS = \
	cursor_data.h \
	data.h \
	help.h \
	lifesrc.h \
	macros.h \
	tab.h \
	cursor_mask.h \
	defs.h \
	icon.h \
	patchlevel.h \
	tile.h

AllTarget($(PROGRAMS))

ComplexProgramTarget_1(xlife, $(XLIB),)
ComplexProgramTarget_2(lifeconv,,)
ComplexProgramTarget_3(collect,,)
#ComplexProgramTarget_4(lifesearch,,)
#ComplexProgramTarget_5(lifesearchdumb,,)

install.patterns:
	@case '${MFLAGS}' in *[i]*) set +e;; esac; \
	-mkdir $(XLIFEPATSDIR)
	for i in patterns//**/* ; do \
		(set -x; $(INSTALL) -c $(INSTDATFLAGS) $$i $(XLIFEPATSDIR)); \
	done

# The help text is formatted to just fit in a 640x480 (VGA) window using a
# 9x16 font.  This is a useful property --- try to preserve it.
help.h: help.text
	sed <help.text -e '/\\[^n]/s//\\&/g' -e '/.*/s//"&",/' >help.h

# This should be generated!
lifesearchdumb:	search.o interact.o dumbtty.o
	$(CC) $(CFLAGS) -o lifesearchdumb search.o interact.o dumbtty.o
lifesearch:	search.o interact.o cursestty.o
	$(CC) $(CFLAGS) -o lifesearch search.o interact.o cursestty.o -L/usr/local/lib -lcurses -ltermcap

TAGS: $(SRCS)
	etags $(SRCS)

MISC = README CHANGES HACKING INSTALL Imakefile Makefile help.text
PATTERNS = life codd wireworld

MANIFEST:
	@(echo $(MISC) | tr ' ' "\012"; ls *.[ch] *.man; find doc $(PATTERNS) -type f -print | grep -v RCS) >MANIFEST

xlife.tar: MANIFEST
	tar -cvf xlife.tar `cat MANIFEST`
xlife.tar.gz: xlife.tar
	gzip xlife.tar 

xlife.shar: MANIFEST
	shar -n"xlife" -o"xlife" -L50 `cat MANIFEST` >xlife.shar

clean::
	$(RM) TAGS xlife.tar xlife.[0-9][0-9]
