#
# Makefile for GNU othello
#
# Inge Wallin			ingwa@isy.liu.se
#

#
# Change the following variables to suit the situation at your own site.
#
# BINDIR is the directory where the executable will be placed on 
# `make install'.  MANDIR is the manual directory and MANEXT is the 
# extension the manual file name will have in MANDIR.
#

BINDIR = /usr/local/gnu/bin
MANDIR = /usr/local/man/man6
MANEXT = 6


# Choose a C compiler and the compilation flags.
CC = gcc -traditional
CFLAGS = -O -fstrength-reduce -fcombine-regs -fforce-mem \
	-fforce-addr -fomit-frame-pointer -finline-functions
#CFLAGS = -g -Wall


# Choose a C compiler to link with. Sometimes you want to use one
# compiler to compile with since it produces faster code and another
# to link with since the first one doesn't produce executables with
# shared libraries. This is the case with gcc and cc on the SUN.
LINKCC = cc


# *************************************************************
# ********   DON'T CHANGE ANYTHING BELOW THIS LINE     ********
# *************************************************************

VERSION = 1.0
DISTDIR = othello-$(VERSION)

DTOBJS = dumbterm.o
DTLIBS = 

SVOBJS = sunview.o textwindow.o
SVLIBS = -lsuntool -lsunwindow -lpixrect


SRCS =	sqlist.c global.c othello.c lowlevel.c highlevel.c \
	dumbterm.c sunview.c textwindow.c
SRC2 =	Makefile README TODO PORTING othello.man $(ICONS)
HDRS =	sqlist.h global.h othello.h textwindow.h io.h clib.h version.h
ICONS = blackpiece.icon whitepiece.icon nopiece.icon othellotool.icon


GAMEOBJS = sqlist.o global.o othello.o lowlevel.o highlevel.o



info:
	@echo
	@echo 'You can compile othello with the following interfaces using'
	@echo 'the following commands:'
	@echo
	@echo 'make sunview   - Interface for sunview'
	@echo 'make dumbterm  - Scrolling interface for a dumb terminal'
	@echo
	@echo 'The outfile will always be named othello.'
	@echo

sunview: $(GAMEOBJS) $(SVOBJS)
	$(LINKCC) -o svothello $(GAMEOBJS) $(SVOBJS) $(LIBS) $(SVLIBS)
	rm -f othello
	ln svothello othello

dumbterm:	$(GAMEOBJS) $(DTOBJS)
	$(LINKCC) -o dtothello $(GAMEOBJS) $(DTOBJS) $(LIBS) $(DTLIBS)
	rm -f othello
	ln dtothello othello


clean:
	rm -f  *.o *~ core othello svothello dtothello


install:	othello othello.man
	cp othello $(BINDIR)
	cp othello.man $(MANDIR)/othello.$(MANEXT)


tags:
	etags $(SRCS) $(HDRS)

lint:
	lint $(SRCS)


othello.o:	othello.h sqlist.h global.h io.h version.h
global.o:	othello.h sqlist.h
lowlevel.o:	othello.h sqlist.h global.h io.h
highlevel.o:	othello.h global.h
sqlist.o:	sqlist.h
dumbterm.o:	othello.h sqlist.h global.h io.h version.h
sunview.o:	textwindow.h othello.h global.h io.h $(ICONS) version.h
textwindow.o:	textwindow.h

