#Log is a flag to turn logging of two players on/off (default if on)
#Have to include -lbsd on SysV
OBJS= xtet42.o
LIBS= -lX11 #-lbsd
#CC=gcc
CC=cc
LIBDIR		= /store/lib/xtet42
_Ver		= 2.01
_Finger		= /usr/bin/finger
_Lock		= $(LIBDIR)/.xtet42.lock
_Unlock		= $(LIBDIR)/.xtet42.unlock
_Log		= $(LIBDIR)/.xtet42.log
_Hiscore	= $(LIBDIR)/.xtet42.hiscore
_Hione		= $(LIBDIR)/.xtet42.hiscore.single

DEFS = 	-D_Lock=\"$(_Lock)\" 		-D_Unlock=\"$(_Unlock)\" \
	-D_Hiscore=\"$(_Hiscore)\" 	-D_Hione=\"$(_Hione)\" \
	-D_Log=\"$(_Log)\" -DLog -DFINGER=\"$(_Finger)\" \
	-D_Ver=\"$(_Ver)\" # -DGNUFINGER
BINDIR = /store/bin
MANDIR = /store/man/man
MANEXT = 6
#The highscore file has to (should) be sgi, so that only one (few) can
#use it
GROUP  = store
CFLAGS =  -O $(DEFS) -I/store/include
#CFLAGS = -O $(DEFS) -I/local/include


.c.o:
	$(CC) -c $*.c $(CFLAGS)

xtet42: $(OBJS)
	$(CC) -o xtet42 $(OBJS) $(LIBS) -L/store/lib 

clean: 
	rm *.o xtet42 *~ core

install: xtet42
	-strip xtet42
	test -d $(BINDIR) || mkdir $(BINDIR)
	rm -f $(BINDIR)/xtet42
	cp xtet42 $(BINDIR)
	chgrp $(GROUP) $(BINDIR)/xtet42
	chmod 2755 $(BINDIR)/xtet42

	test -d $(LIBDIR) || mkdir $(LIBDIR)
	chgrp $(GROUP) $(LIBDIR)
	rm -f $(_Unlock)
	touch $(_Unlock)
	chgrp $(GROUP) $(_Unlock)
	chmod o-rwx $(_Unlock)
	chmod g+rw $(_Unlock)
	rm -f $(_Hiscore)
	cp xtet42.hiscore $(_Hiscore)
	chgrp $(GROUP) $(_Hiscore)
	chmod o-rwx $(_Hiscore)
	chmod g+rw $(_Hiscore)
	rm -f $(_Hione)
	cp xtet42.hiscore.single $(_Hione)
	chgrp $(GROUP) $(_Hione)
	chmod o-rwx $(_Hione)
	chmod g+rw $(_Hione)
	rm -f $(MANDIR)$(MANEXT)/xtet42.$(MANEXT)
	cp xtet42.$(MANEXT) $(MANDIR)$(MANEXT)
