CC = cc
PVM_INCLUDE = $(PVM_ROOT)/include
PVM_LIB = $(PVM_ROOT)/pvm3/lib/$(PVM_ARCH)
#MACHINE can be MAC, DOS, SGI, SUN, CRAY or RS6000
#use -DRS6000 if you have an ANSI-C compiler.
#use -DPVM for the parallel version.
#WARNING: there is a still unknown bug in the parallel version.
#(only if -DPVM)use -DHAS_TIMES if your machine has the times() call.
CFLAGS = -DMACHINE=RS6000 -g -I $(PVM_INCLUDE)
#CFLAGS = -DPVM -DHAS_TIMES -DMACHINE=RS6000 -O3 -I $(PVM_INCLUDE)
LFLAGS = 
#if -DPVM
#LFLAGS = -L$(PVM_LIB)
LIBS = -lm
#if -DPVM
#LIBS = -lm -lpvm

hello:
	@echo 'possible targets are progs, zzzzzz, book, pgn, check, try and clean'

progs: zzzzzz fin2tex fin2zzz
	touch progs

book:
	-rm dbase.txt dbase.bin dbase.key
	zzzzzz book book.txt >/dev/null
	zzzzzz dbase dbase.txt >book.out
	diff ORGbook.out book.out

pgn:
	-rm pgn.key pgn.bin keys.bin
	zzzzzz pgn <pgn.inp >pgn.out
	diff ORGpgn.out pgn.out

check:
	zzzzzz -DepthMax 4 -TimeLimit 300 solve win.txt >win.out
	diff ORGwin.out win.out

try:
	zzzzzz -NoBook -DepthMax 4 -TimeLimit 300 try >try.out
	cat results.txt

clean:
	-rm progs zzzzzz fin2tex fin2zzz
	-rm book.out dbase.txt pgn.out win.out game.txt
	-rm *.o *.bin *.key

zzzzzz: zzzzzz.o util.o pgn.o distrib.o
	$(CC) $(LFLAGS) -o zzzzzz zzzzzz.o util.o pgn.o distrib.o $(LIBS)

fin2tex: fin2tex.o
	$(CC) -o fin2tex fin2tex.o -lm

fin2zzz: fin2zzz.o
	$(CC) -o fin2zzz fin2zzz.o -lm

zzzzzz.o: zzzzzz.c zzzzzz.h 
util.o: util.c zzzzzz.h 
pgn.o: pgn.c zzzzzz.h
distrib.o: distrib.c zzzzzz.h

