#
#  Makefile for the Motif version of reve.
#
#  @(#)Makefile 1.3 94/01/27
#
#  Copyright (C) 1990 - 1994 - Rich Burridge & Yves Gallot.
#  All rights reserved.
#
#  Permission is granted to copy this source, for redistribution
#  in source form only, provided the news headers in "substantially
#  unaltered format" are retained, the introductory messages are not
#  removed, and no monies are exchanged.
#
#  Permission is also granted to copy this source, without the
#  news headers, for the purposes of making an executable copy by
#  means of compilation, provided that such copy will not be used
#  for the purposes of competition in any othello tournaments, without
#  prior permission from the authors.
#
#  No responsibility is taken for any errors inherent either
#  to the comments or the code of this program, but if reported
#  (see README file), then an attempt will be made to fix them.
#
#=====================================================================
#
#  There are various small changes needed when compiling reve on
#  different systems. These have been isolated here, and should be
#  uncommented if needed.
#
#=======================================================================
#  In order to get reve to link successfully on your system, you might
#  need to define extra libraries to link against. If this is the case,
#  then the following entry should be uncommented and set appropriately.
#
#  For Solaris 2.x, this option needed to be set to:
#    EXTRALIBS = -lsocket -lnsl -lgen
#
#EXTRALIBS       = -lsocket -lnsl -lgen
#-----------------------------------------------------------------------
#  If you want the computer moves to be played by a separate program,
#  started by reve and connected to reve by a pair of pipes, then
#  uncomment this definition.
#
#HASREVEPROC     = -DHASREVEPROC
#-----------------------------------------------------------------------
#  If you are compiling the Motif version of reve, you will need to
#  uncomment the following two lines and set appropriately.
#
MOTIFINCDIR     = -I$(MOTIFHOME)/include
MOTIFLIBDIR     = -L$(MOTIFHOME)/lib
#-----------------------------------------------------------------------
#  If you don't want to compile in the networking code to allow reve to be
#  able to handle -opponent user@host, then uncomment the following
#  definition.
#
#NO_NETWORK      = -DNO_NETWORK
#-----------------------------------------------------------------------
#  If you are building reve on an SVR4 machine, then you should also
#  uncomment this definition.
#
#  If you are running on a 80286 machine, Microport's 5.2 port of SYSV,
#  SVAT, or Xenix286, then you will need to uncomment this definition.
#  This ought to work under 5.3 as well.
#
#SVR4  = -DSVR4
#-----------------------------------------------------------------------
#  If you are compiling the X11 version and the X11 include and
#  library files are not in a standard place, then the following
#  two lines should be uncommented, and set appropriately.
#
X11INCDIR         = -I$(OPENWINHOME)/include
X11LIBDIR         = -L$(OPENWINHOME)/lib
#===========================================================================
#  Compilation flags and standard macro definitions.
#
CDEFS    = $(HASREVEPROC) $(MOTIFINCDIR) $(NO_NETWORK) $(SVR4) \
	   $(X11INCDIR) -I../common
CCOMP    = -O

CC       = gcc

CFLAGS   = $(CCOMP) $(CDEFS)
CCFLAGS  = $(CCOMP) $(CDEFS)

LDFLAGS  = $(X11LIBDIR)
LIBS     = -lXm -lXt -lXmu -lX11 $(EXTRALIBS)

#===========================================================================

.KEEP_STATE:

COMMONDIR     = ../common
COMMONSRCS    = $(COMMONDIR)/boardstuff.c $(COMMONDIR)/get.c \
		$(COMMONDIR)/procs.c $(COMMONDIR)/rev_eval.c \
		$(COMMONDIR)/rev_ip.c $(COMMONDIR)/rev_iycp.c \
		$(COMMONDIR)/socket.c $(COMPSRCS)
COMMONOBJS    = $(COMMONDIR)/boardstuff.o $(COMMONDIR)/get.o \
		$(COMMONDIR)/procs.o $(COMMONDIR)/rev_eval.o \
		$(COMMONDIR)/rev_ip.o $(COMMONDIR)/rev_iycp.o \
		$(COMMONDIR)/socket.o $(COMPSRCS)
SRCS = callbacks.c main.c reve_ui.c tu_runtime.c motif.c
OBJS = callbacks.o main.o reve_ui.o tu_runtime.o motif.o

motif:  $(OBJS)
	$(CC) -o mreve $(X11LIBDIR) $(MOTIFLIBDIR) $(CFLAGS) $(COMMONOBJS) \
			$(OBJS) $(LIBS)
	-cp mreve ../reve

tu_runtime.o: tu_runtime.c tu_runtime.h
	$(CC) -c  $(CFLAGS) -DSYSV -g -I. tu_runtime.c

clean:
	rm -f *.o mreve core

lint:
	lint $(CDEFS) $(COMMONSRCS) motif.c $(LIBS) 

saber:	$(COMMONSRCS) motif.c
	#load $(LDFLAGS) $(CDEFS) $(COMMONSRCS) motif.c $(LIBS)

create: SCCS
	-sccs create motif.c Makefile

SCCS:
	mkdir SCCS
	chmod 755 SCCS

callbacks.o: tu_runtime.h widgetindex.h xdefs.h
main.o:      tu_runtime.h
motif.o:     tu_runtime.h widgetindex.h xdefs.h $(COMMONDIR)/reve.h
reve_ui.o:   tu_runtime.h widgetindex.h
