# Top level Makefile for GB by Bill Randle (billr@saab.cna.tek.com)
MAKE = /bin/make

# destination directories
# GLIB should match the directory in the PATH macro of server/files.h
GBIN = /usr/net/games
GLIB = /usr/net/games/lib/GB

# host and port definitions for network connection. If not defined,
# defaults in client/GB_client.c and server/config.h will be used.
HOST = \\\"saab.cna.tek.com\\\"
PORT = 2010
HP = -DGB_HOST=$(HOST) -DGB_PORT=$(PORT)

# set UV to -DBSD4_2 for BSD 4.2 derived systems (e.g. SunOS 3.X) that
# don't have tm_zone as a member of the "tm" struct (see <time.h>),
# otherwise leave blank.
UV = -DBSD4_2

all: GB_client GB_server

GB_client:
	@echo "cd client; make HP="$(HP)" UV="$(UV)" all"
	@(cd client; $(MAKE) HP="$(HP)" UV="$(UV)" all)

GB_server:
	@echo "cd server; make HP="$(HP)" UV="$(UV)" all"
	@(cd server; $(MAKE) HP="$(HP)" UV="$(UV)" all)

install:
	$(MAKE) all
	cp client/GB_client server/GB_enroll $(GBIN)
	-mkdir $(GLIB) $(GLIB)/Docs
	cp server/GB_server server/GB_daemon server/mor \
		server/trav server/fix $(GLIB)
	cp server/*.dat server/welcome.txt $(GLIB)
	-cp Docs/* $(GLIB)/Docs
	-compress $(GLIB)/Docs/*
	#make clear
	@echo 'cd server; makeuniv'
	@(cd server; makeuniv)
	make chmod

chmod:
	cd $(GLIB)
	chmod ag+xs GB_server GB_daemon
	chmod g+rw Data/* Data/Tele/*
	chmod a+r Docs/*
	chmod g+r *.dat*
	chmod a+x mor

clear:
	@echo "cd client\; make clear"
	@(cd client; $(MAKE) clear)
	@echo "cd server\; make clear"
	@(cd server; $(MAKE) clear)
