#
# Makefile for the CacheBuild package.
#

# Where to put things
DEST=/nau/share
BIN=$(DEST)/bin
LIB=$(DEST)/lib

# Name of output file that cachebuild should write to
CACHEFILE=root.cache

# Where is your BSD-style install?
INSTALL=install			# BSD, SunOS 4.x
#INSTALL=/usr/ucb/install	# SysV, Solaris 2.x

# Don't change this.  Thanks.
VERSION=1.2


# NOTE: Fix PATH variable in cachebuild.SH script before building!


all:	cachebuild

cachebuild:	cachebuild.SH
	echo "s,BINDIR,$(BIN),g" > fix.sed
	echo "s,LIBDIR,$(LIB),g" >> fix.sed
	echo "s,CACHEFILE,$(CACHEFILE),g" >> fix.sed
	sed -f fix.sed < cachebuild.SH > cachebuild
	rm -f fix.sed
	chmod 755 cachebuild

install:	all
	$(INSTALL) -c -m 755 -o bin -g bin cachebuild $(BIN)
	$(INSTALL) -c -m 644 -o bin -g bin cachebuild.awk $(LIB)

clean:
	-rm -f cachebuild root.cache* fix.sed core

dist:
	cd ..; tar cvf /tmp/cachebuild.tar \
		CacheBuild$(VERSION)/README \
		CacheBuild$(VERSION)/Makefile \
		CacheBuild$(VERSION)/cachebuild.SH \
		CacheBuild$(VERSION)/cachebuild.awk
	gzip /tmp/cachebuild.tar
