#
# This file is part of "The Java Telnet Applet".
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# "The Java Telnet Applet" is distributed in the hope that it will be 
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with The JAVA Telnet Applet; see the file COPYING.  If not, write to 
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
# $Id: Makefile,v 1.8 1997/03/14 21:20:57 leo Exp $

OPT	= -O
DEBUG	= -g

.SUFFIXES: .java .class .html

.java.class:
	javac $(OPT) $(DEBUG) $<

.class.html:	
	appletviewer $@

HELP:
	@echo 'To compile "The Java Telnet Applet" do one of the following:'
	@echo '------------------------------------------------------------'
	@echo 'make all          - compile all files to classes'
	@echo 'make test         - compile applet and run appletviewer'
	@echo 'make telnet       - compile standalone and run telnet'
	@echo 'make chartest     - compile character display test and run'
	@echo 'make proxy        - compile proxy server'
	@echo 'make doc          - create documentation'
	@echo 'make clean        - delete backup files'
	@echo 'make realclean    - make clean and delete .class files'

all: appWrapper.class telnet.class modules tools
	@echo All classes created.

test: appWrapper.class telnet.class
	appletviewer index.test.html

telnet:	appWrapper.class telnet.class
	java telnet localhost	

chartest: CharDisplayTest.class
	appletviewer CharDisplay.html

doc:
	javadoc -author -version display socket modules \
	        telnet.java appWrapper.java \
                tools/proxy.java CharDisplayTest.java IOtest.java \
                TelnetWrapper.java
	-rm Documentation/Source/*.html
	mv display.*.html socket.*.html modules.*.html telnet.html \
	   CharDisplayTest.html IOtest.html TelnetWrapper.html appWrapper.html \
	   proxy.html redirector.html \
	   Package-*.html packages.html AllNames.html tree.html \
	   Documentation/Source

tar:	
	rm -f ../telnet.tgz ../telnet.zip
	(cd ..; tar cvf - Telnet | gzip - > telnet.tgz)
	(cd ..; zip -r telnet.zip Telnet)

bin-tar: all
	tar cvf - *.class */*.class | gzip - > classes.tgz

revision: 
	grep @version *.java */*.java|awk '{split($$6,rev,".");printf("%-26.26s %2.2s.%-2.2s (%s)\n",$$1,rev[1],rev[2],$$7);}' > REVISION
	rcs2log *.java */*.java > CHANGES

dist:	realclean all doc revision tar 
	@echo DONE.

clean:	
	rm -f *~ */*~

realclean:	clean
	rm -f *.class */*.class

# dependencies

appWrapper.class: appWrapper.java

telnet.class: display socket modules \
              telnet.java 

# display classes and terminal emulation
display: display/vt320.class 


display/vt320.class: display/CharDisplay.java \
                     display/Terminal.java \
                     display/TerminalHost.class \
                     display/vt320.java

display/TerminalHost.class: display/TerminalHost.java

# socket io classes
socket: socket/TelnetIO.class

socket/TelnetIO.class: socket/StatusPeer.java \
                       socket/TelnetIO.java

# dynamical loaded modules
modules: modules/ButtonBar.class \
         modules/Script.class

modules/ButtonBar.class: modules/Module.java modules/ButtonBar.java

modules/Script.class: modules/Module.java modules/Script.java

# tools
tools: tools/proxy.class CharDisplayTest.class \
       IOtest.class TelnetWrapper.class

tools/proxy.class: tools/proxy.java
CharDisplayTest.class: CharDisplayTest.java display/CharDisplay.java
IOtest.class: IOtest.java socket/TelnetIO.java
TelnetWrapper.class: TelnetWrapper.java socket/TelnetIO.java

