#
# Makefile for testing and timing programs
# things to make:
#	all		same as recommend and testall
#	testall		a program to test, and time, all configurations
#			of the library
#	recommend	a program to recommend a particular configuration
#			for the library
#	genpwd		a program to generate a list of random passwords,
#			salts, and corresponding hashes
#	tsttim		a program to test, time des library functions
#	debug		a primitive des debugging utility
#	debuga		like debug, but uses system library functions
#	Makefile	this Makefile
#	clean		to delete intermediate files
#	clobber		to delete all files except the original sources
#			and the Makefile
#	clobberall	to delete all files except the original sources
#
#################################################################
# Copyright notice.						#
# This software is copyrighted (c) 1991 by Matt Bishop and the	#
# Trustees of Dartmouth College.  All rights reserved.		#
# 								#
# Author:	Matt Bishop					#
# Address:	Department of Mathematics and Computer Science	#
#	 	Dartmouth College				#
# 		Hanover, NH  03755-1831				#
# 		USA						#
# telephone:	+1 603 646 3267					#
# fax:		+1 603 646 1312					#
# internet:	Matt.Bishop@dartmouth.edu			#
# usenet:	...!decvax!dartvax!Matt.Bishop			#
#################################################################
#
VERSION="Version GAMMA 6/31/91 Matt.Bishop@dartmouth.edu"	# version

# the M4 configuration file
include(../../config/config.m4)
#
# the internal defines
#
LIB	= ../$(VERSION)/libdes.a
SEDSH	= $(SED) $(SED_RE) 's/%%SYSTYPE%%/$(SYSTYPE)/g' \
		 $(SED_RE) 's/%%HOSTTYPE%%/$(HOSTTYPE)/g' \
		 $(SED_RE) 's/%%VERSION%%/$(VERSION)/g' \
		 $(SED_RE) 's,%%LIBDIR%%,$(LIBTOP),g'   \
		 $(SED_RE) 's,%%INCDIR%%,$(LIBINC),g' \
		 $(SED_RE) 's,%%TSTDIR%%,$(LIBTST),g'
CFLAGS	= $(C_OPTS) -I$(LIBINC) -I../../include

#
# the main executables
#
EXEC = testall recommend

# make all the cookies
all:	$(EXEC)

# make the main programs (shell scripts)
testall:	testall.sh
	$(SEDSH) testall.sh > $@; $(CHMOD) $(CHMOD_RWEOEA) $@

recommend:	recommend.sh
	$(SEDSH) recommend.sh > $@; $(CHMOD) $(CHMOD_RWEOEA) $@

# make the pasword generator
genpwd:	genpwd.o
	$(CC) $(CFLAGS) -o genpwd genpwd.o $(STDCRYPTLIB)

# make the tester/timer
tsttim:	tsttim.o $(LIB)
	$(CC) $(CFLAGS) -o tsttim tsttim.o $(LIB) $(STDCRYPTLIB)

# these are useful for debugging the des stuff
debug:	debug.o $(LIB)
	$(CC) $(CFLAGS) -o debug debug.o $(LIB)

debuga: debuga.o $(LIB)
	$(CC) $(CFLAGS) -o debuga debuga.o $(LIB)

debuga.o:	$(LIB)
	$(CC) $(CFLAGS) -DALONE debug.c; mv debug.o debuga.o


# generate the Makefile
Makefile:
	$(M4) Makefile.m4 > Makefile

# clean up
clean:
	$(RM) $(RM_FORCE) tsttim.o genpwd.o debug.o debuga.o

# really clean up
clobber:
	$(RM) $(RM_FORCE) *.o debug testall tsttim recommend *.out

# restore to original condition
clobberall:
	$(RM) $(RM_FORCE) *.o debug testall tsttim recommend *.out makefile
