#
# @(#)Makefile	1.28 97/03/03
#
# Makefile for building and running security tests
#
# Modify these next five variables to suit your environment
#
#      BIN: location of java, javac, appletviewer
#  INSTALL: complete path name of the preferred version of install(1M)
#  DESTDIR: where the compiled security test classes (and the html test harness) end up
#      URL: the URL that is used to invoke the securityTest.html test harness
#      TMP: a directory from which the security tests are run
#
BIN 	= /home/mrm/ws/JDK1.1.1/build/bin
INSTALL = /usr/sbin/install
DESTDIR = /home/mrm/public_html
URL 	= http://grinder.eng/~mrm/securityTest.html
TMP 	= /tmp

#
# You shouldn't need to modify anything after this.
#
TESTS	=\
	ClassLoaderTest.java \
	ExecTest.java \
	ExitTest.java \
	FactoryTest.java \
	FileTest.java \
	FinalCheck.java \
	FinalMethodCheck.java \
	GetImageTest.java \
	GetAudioTest.java \
	getLocalHostTest.java \
	GetRedirectTest.java \
	GetResourceTest.java \
	ImageTest.java \
	LoadLibraryTest.java \
	NetworkTest.java \
	PackageImportTest.java \
	PrivateCheck.java \
	PrivateStaticCheck.java \
	PropertiesTest.java \
	SecurityTest.java \
	SecurityTestApplet.java \
	ThreadGroupTest.java \
	URLTest.java \
	VerifierTest.java \
	WindowTest.java \
	ClipboardAccessTest.java \
	Patricide.java \
	GetenvTest.java \
	OverflowTest.java \
	SecurityManagerTest.java \
	SecurityExceptionTest.java \
	AddProviderTest.java \
	RemoveProviderTest.java \
	SetIdentityScopeTest.java

IO	=\
	java/io/DataInputStream.java	

NET	=\
	java/net/HackedNetClass.java \
	java/net/Socket.java \
	java/net/URL.java

APPLET =\
	sun/applet/AppletSecurityException.java

TESTCLASS=\
	ClassLoaderTest.class \
	CrackerLoader.class \
	ExecTest.class \
	EvilProvider.class \
	EvilScope.class \
	ExitTest.class \
	FactoryTest.class \
	FileTest.class \
	FinalCheck.class \
	FinalMethodCheck.class \
	GetImageTest.class \
	GetAudioTest.class \
	getLocalHostTest.class \
	GetRedirectTest.class \
	GetResourceTest.class \
	ImageTest.class \
	LoadLibraryTest.class \
	MySocketImpl.class \
	MySocketImplFactory.class \
	NetworkTest.class \
	PackageImportTest.class \
	PrivateCheck.class \
	PrivateStaticCheck.class \
	PropertiesTest.class \
	SecurityTest.class \
	SecurityTestApplet.class \
	ThreadGroupTest.class \
	URLTest.class \
	VerifierTest.class \
	WindowTest.class \
	ClipboardAccessTest.class \
	Patricide.class \
	GetenvTest.class \
	OverflowTest.class \
	SecurityManagerTest.class \
	SecurityExceptionTest.class \
	AddProviderTest.class \
	RemoveProviderTest.class \
	SetIdentityScopeTest.class

IOCLASS= java/io/DataInputStream.class	

NETCLASS= java/net/HackedNetClass.class \
	java/net/Socket.class \
	java/net/URL.class

APPCLASS= sun/applet/AppletSecurityException.class

all: compile install run

#
# Be sure to run the security tests from a directory 
# other than the CLASSDIR.  The directory named by TMP
# is where the tests are run
#
run: 
	(cd ${TMP}; \
	echo `date` `/usr/ucb/whoami` `uname -p` `pwd` > log; \
	${BIN}/appletviewer ${URL} >log 2>log)
	echo "Ran security tests" 

install: 
# make sure directories exist
	${INSTALL} -d ${DESTDIR}
	${INSTALL} -d ${DESTDIR}/java
	${INSTALL} -d ${DESTDIR}/java/io
	${INSTALL} -d ${DESTDIR}/java/net
	${INSTALL} -d ${DESTDIR}/sun
	${INSTALL} -d ${DESTDIR}/sun/applet
# move the .class files into the DESTDIR area
	for i in ${TESTCLASS} ; do \
		${INSTALL} -f ${DESTDIR} $$i ; \
		done
	for i in ${IOCLASS}; do \
		${INSTALL} -f ${DESTDIR}/java/io $$i ; \
		done
	for i in ${NETCLASS}; do \
		${INSTALL} -f ${DESTDIR}/java/net $$i ; \
		done
	for i in ${APPCLASS}; do \
		${INSTALL} -f ${DESTDIR}/sun/applet $$i ; \
		done
# move the html file into the HTMLDIR area
	${INSTALL} -f ${DESTDIR} securityTest.html

compile:
	${BIN}/javac ${NET}
	${BIN}/javac ${IO}
	${BIN}/javac ${APPLET}
	${BIN}/javac ${TESTS}

clobber: clean
	for i in ${TESTCLASS} ${IOCLASS} ${NETCLASS} ${APPCLASS}; do \
		rm -f ${DESTDIR}/$$i ; \
		done

clean: 
	rm -f *.class java/io/*.class java/net/*.class sun/applet/*.class


