# Makefile for top level of lmbench
# $Id: Makefile,v 1.13 1997/10/25 17:52:22 lm Exp $

# Possible things to $(MAKE):
#
# build		(default) go to the source directory and build the benchmark
# results	go to the source directory and build and run the benchmark
# rerun		run the benchmark again
# see		see the results that came with this release
#		Go to the results directory and read the Makefile.
# doc.lpr	print the documentation
# doc.x		preview the documentation (needs X, groff, pic, etc)
# clean		go to the subdirs and $(MAKE) clean
# get		$(MAKE) sure all files are checked out
# shar		build a shippable shar archive

SHELL=/bin/sh

build: rccs
	cd src && $(MAKE)

results: rccs
	cd src && $(MAKE) results

rerun: rccs
	cd src && $(MAKE) rerun

see:
	cd results && $(MAKE) summary percent 2>/dev/null | more

doc.lpr:
	cd doc && $(MAKE) PS && lpr *.PS

doc.x:
	cd doc && $(MAKE) x

clean: rccs
	for i in doc src results scripts; do \
		echo ===== $$i =====; \
		(cd $$i && if [ ! -f Makefile ]; then co -q Makefile; fi && $(MAKE) clean); \
	done
	/bin/rm -rf bin/*
	./rccs clean -s -e

get: rccs
	for i in doc src results scripts; do \
		echo ===== $$i =====; \
		(cd $$i && co -q RCS/*,v); \
	done
	./rccs get -s

info: rccs
	for i in doc src results scripts; do \
		echo ===== $$i =====; \
		(cd $$i && ./rccs info); \
	done

# XXX - . must be named lmbench for this to work
shar:
	$(MAKE) clean
	co -q Makefile
	$(MAKE) get
	cd .. && \
	find lmbench -type f -print  | egrep -v 'noship|RCS' > /tmp/FILES
	cd .. && shar -S -a -n lmbench1.0 -L 50K < /tmp/FILES 

rccs:
	co -p scripts/RCS/rccs,v > rccs
	chmod +x rccs
