#
# Makefile for CHESS
#
# Copyright (C) 1986, 1987, 1988, 1989, 1990 Free Software Foundation, Inc.
#
# This file is part of CHESS.
#
# CHESS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY.  No author or distributor
# accepts responsibility to anyone for the consequences of using it
# or for whether it serves any particular purpose or works at all,
# unless he says so in writing.  Refer to the CHESS General Public
# License for full details.
#
# Everyone is granted permission to copy, modify and redistribute
# CHESS, but only under the conditions described in the
# CHESS General Public License.   A copy of this license is
# supposed to have been given to you along with CHESS so you
# can know your rights and responsibilities.  It should be in a
# file named COPYING.  Among other things, the copyright notice
# and this notice must be preserved on all copies.
#
# gnuchess  will be the curses-based chess.
# gnuchessn will be the fancy-display-curses-based chess.
# gnuchessr will be the xchess/chesstool based chess.
#		(/usr/games/chesstool gnuchessr)
#    for use with SUN's chesstool and X-window's xchess.
#    To use with latter, add -DCHESSTOOL to the nondsp.o
#    compilation lines (e.g. cc -O -DCHESSTOOL ...)
# If you want to use the persistent transpositon table add
# -DHASHFILE=\"$(LIBDIR)/gnuchess.hash\"
# to the gnuchess.o compilation line. You also have to run gnuchess -t
# To actually create the file. -t can also be used to report
# statistics about the file or to resize it.
#
VERS=	3.1
DIST=	README DOCUMENTATION Makefile version.h gnuchess.h gnuchess.c\
	uxdsp.c nondsp.c nuxdsp.c gnuchess.book Xchess
BINDIR= /user/tcollins/sources/gnuchess3.1
#BINDIR= /user/gnu/bin
LIBDIR= /user/tcollins/sources/gnuchess3.1
#LIBDIR= /user/gnu/lib
CC= cc
#CC=	 gcc -W -finline-functions -fstrength-reduce
CFLAGS=	-O -A cpu,$(TARGET) -A sys,bsd4.3
TARGET = 3000
all : gnuchess gnuchessr gnuchessn gnuan

gnuchess: gnuchess.o uxdsp.o
	$(CC) $(CFLAGS) -o gnuchess gnuchess.o uxdsp.o -lcurses -ltermlib

gnuchessr: gnuchess.o nondsp.o
	$(CC) $(CFLAGS) -o gnuchessr gnuchess.o nondsp.o

gnuchessn: gnuchess.o nuxdsp.o
	$(CC) $(CFLAGS) -o gnuchessn gnuchess.o nuxdsp.o -lcurses -ltermlib

gnuan: gnuchess.o gnuan.o
	$(CC) $(CFLAGS) -o gnuan gnuchess.o gnuan.o

gnuchess.o: gnuchess.c gnuchess.h
	$(CC) $(CFLAGS) -DBOOK=\"$(LIBDIR)/gnuchess.book\" -c gnuchess.c

#gnuchess.o: gnuchess.c gnuchess.h
#	$(CC) $(CFLAGS) -DBOOK=\"$(LIBDIR)/gnuchess.book\" -DHASHFILE=\"$(LIBDIR)/gnuchess.hash\" -c gnuchess.c
#
uxdsp.o: uxdsp.c gnuchess.h
	$(CC) $(CFLAGS) -c uxdsp.c

nuxdsp.o: nuxdsp.c gnuchess.h
	$(CC) $(CFLAGS) -c nuxdsp.c

#nondsp.o: nondsp.c gnuchess.h
#	$(CC) $(CFLAGS) -DCHESSTOOL -c nondsp.c
#
nondsp.o: nondsp.c gnuchess.h
	$(CC) $(CFLAGS) -c nondsp.c

gnuan.o: gnuan.c gnuchess.h
	$(CC) $(CFLAGS) -c gnuan.c

lint:
	lint gnuchess.c uxdsp.c nondsp.c nuxdsp.c

unprotoize:
	unprotoize -c -DHASHFILE gnuchess.c uxdsp.c nondsp.c nuxdsp.c

protoize:
	protoize -c -DHASHFILE gnuchess.c uxdsp.c nondsp.c nuxdsp.c

distribution:
	tar cf - $(DIST) > gnuchess.tar
	compress gnuchess.tar
	mv gnuchess.tar.Z gnuchess-$(VERS).tar.Z

install:
	cp gnuchessr $(BINDIR)/gnuchess.chesstool
	cp gnuchess $(BINDIR)/gnuchess
	cp gnuchess.book $(LIBDIR)/gnuchess.book

clean:
	-rm gnuchess gnuchessr gnuchessn *.o