
#
# klondike Makefile
#
# Copyright (C) 1993 by John Heidemann <johnh@ficus.cs.ucla.edu>
# All rights reserved.
#
# $Id: Makefile,v 1.8 1994/01/27 18:57:23 johnh Exp $
#
# $Log: Makefile,v $
# Revision 1.8  1994/01/27  18:57:23  johnh
# files in shar are re-ordered
#
# Revision 1.7  1994/01/13  04:04:28  johnh
# install_release
#
# Revision 1.6  1994/01/09  22:44:06  johnh
# install no longer used
#
# Revision 1.5  1994/01/09  05:28:07  johnh
# man page installation done
#
# Revision 1.4  1994/01/06  18:20:37  johnh
# 0.1 distribution
#
# Revision 1.3  1993/06/06  06:13:16  johnh
# now reads resource database for options
#
# Revision 1.2  1993/04/13  04:47:01  johnh
# a first crack at installation
#
# Revision 1.1  1993/04/12  08:12:35  johnh
# Initial revision
#
#



######################################################################
# Customize here.

WISHXPATH = /usr/dist/bin/wishx

BASEDIR = /usr/dist
BINDIR = $(BASEDIR)/games
LIBDIR = $(BASEDIR)/games/lib/klondike
MANEXT=6
MANDIR = $(BASEDIR)/man/man$(MANEXT)

#
# Scores require a world-writable SCORES directory
# (until we get a setuid-able tcl).
# If this violates your security principles,
# change WRITE_SCORES to 0 to disable permanent score-keeping.
#
WRITE_SCORES=1

# If your mkdir doesn't support "-p", define the next string as ""
# and make sure the directories are created by hand.
MKDIR_FLAGS=-p

# No further customization should be required beyond here.
######################################################################



# where wish is in the distributed sources
MYWISHXPATH=/usr/dist/bin/wishx
MYLIBDIR=/global/us/edu/ucla/cs/ficus/users/johnh/EXPERIMENTS/CARDS

TCL_FILES=klondike klondikeMenus.tcl klondikeRules.tcl klondikeScore.tcl table.tcl
BITMAP_FILES=CARDS/*.xbm

#
# default target
#
all:
	@echo "Klondike is ready for installation."

#
# administrativia
#

install: install_dirs install_progs install_bitmaps install_scores install_man install_release
	@echo Installation of klondike is complete.

install_dirs:
	test -d $(BINDIR) || mkdir $(MKDIR_FLAGS) $(BINDIR)
	test -d $(LIBDIR) || mkdir $(MKDIR_FLAGS) $(LIBDIR)
	test -d $(LIBDIR)/CARDS || mkdir $(MKDIR_FLAGS) $(LIBDIR)/CARDS
	test -d $(LIBDIR)/SCORES || mkdir $(MKDIR_FLAGS) $(LIBDIR)/SCORES

install_progs:
	for i in $(TCL_FILES); \
	do \
		echo "Installing $$i..."; \
		sed -e s#$(MYWISHXPATH)#$(WISHXPATH)# \
			-e s#$(MYLIBDIR)#$(LIBDIR)# \
			-e 's#set score(writeScores) .#set score(writeScores) $(WRITE_SCORES)#'<$$i >t; \
		cp t $(LIBDIR)/$$i; \
		chmod 0755 $(LIBDIR)/$$i; \
	done
	mv $(LIBDIR)/klondike $(BINDIR)

install_bitmaps:
	cp $(BITMAP_FILES) $(LIBDIR)/CARDS
	chmod 0644 $(LIBDIR)/CARDS/*.xbm

install_release:
	cp release $(LIBDIR)
	chmod 0644 $(LIBDIR)/release

#
# To mitigate the effects of a world-writable directory,
# we deny read (list) permission on the directory.
# If your file system doesn't support UFS-semantics for a 0733 mode
# you may need to chane its permission.
#
install_scores:
	test -d $(LIBDIR)/SCORES || mkdir $(MKDIR_FLAGS) $(LIBDIR)/scores
	test $(WRITE_SCORES) -ne 0 && chmod 0733 $(LIBDIR)/SCORES

# to be like normal X programs
install.man: install_man

install_man:
	test -d $(MANDIR) || mkdir $(MKDIR_FLAGS) $(MANDIR)
	cp klondike.man $(MANDIR)/klondike.$(MANEXT)
	chmod 0644 $(MANDIR)/klondike.$(MANEXT)


#
# distribution stuff
#

TOSHAR=README release klondike.man Makefile $(TCL_FILES) $(BITMAP_FILES)

shar:
	shar $(TOSHAR) >klondike.`cat release`.shar

shar.gz:
	shar $(TOSHAR) |gzip >klondike.`cat release`.shar.gz

tar:
	tar cvf - $(TOSHAR) >klondike.`cat release`.tar

tar.gz:
	tar cvf - $(TOSHAR) |gzip >klondike.`cat release`.tar.gz



