@echo off

REM
REM DOS batch file for building Calendar Tool jar files, including notes on executing
REM compiled Java programs.  Also some notes at the bottom regarding debugging
REM compiled Java programs in Emacs.
REM

REM CSC 206 java lib directory
set LIB206=z:\classes\206\lib\JVM


REM
REM NOTES ABOUT EXECUTING COMPILED JAVA PROGRAMS.
REM

REM The compilation rule in the implementation\source\java\Makefile results in an
REM executable program that consists of .class files stored in this directory --
REM implementation\executables\JVM.  The program can be invoked as follows from
REM this directory:
REM
REM     java caltool.Main
REM
REM where "caltool" is the name of the top-level project package, and Main is the
REM name of the class that contains the definition of the program's main method.
REM Executing in this way assumes that the CLASSPATH environment variable
REM includes the path of the CSC 206 library directory, which on waldorf is
REM
REM     \users\faculty\gfisher\classes\206\lib\JVM
REM
REM If CLASSPATH does not include this path, then the program can be invoked by
REM specifying the CLASSPATH as a command-line argument as follows:
REM
REM     java -classpath \users\gfisher\classes\206\lib\JVM:. caltool.Main
REM
REM Per standard Java invocation conventions, the preceding invocations assume
REM that the current working directory is the executables\JVM directory in which
REM the .class files reside.  If this is not the case, then the classpath must be
REM extended with the directory in which the compiled package resides.
REM Specifically, to run caltool.Main from some directory other than JVM,
REM invoke it as follows:
REM
REM     java -classpath \users\gfisher\classes\206\lib\JVM:\users\gfisher\work\calendar\caltool\implementation\executables\JVM caltool.Main
REM
REM
REM The following make rules use the jar utility (the Java archiver) to build two
REM other forms of executable programs -- one a transportable version and another
REM that is a stand-alone executable version.  These rules should be run after
REM the compilation has been performed in the implementation-Makefile in
REM ..\..\source\java\Makefile.
REM


REM Run the Jar utility on all of the files to build a stand-alone executable
REM .jar file that includes .class files, 206 library .class files, and a
REM MANIFEST file that defines the Main-Class attribute as the Main class.  The
REM MANIFEST contains the following single line:
REM
REM	Main-Class: caltool.Main
REM
REM This rule builds a jar file that can be invoked stand-alone, without
REM unpacking it and without linking to the external 206 library.  It is invoked
REM as follows:
REM
REM     java -jar caltool.jar
REM
REM This invocation can be performed in any working directory that contains a
REM copy of caltool.exe, with no required settings of the CLASSPATH
REM environment variable.  The stand-alone .jar file can also be invoked from any
REM other working directory simply by specifying the full path to the location of
REM the .jar file.
REM
		jar cmf MANIFEST caltool.jar caltool -C %LIB206% mvp -C %LIB206% lib206
REM		chmod a+x caltool.jar

REM Run the Jar utility on all of the files to build a transportable program
REM archive file.
REM The .jar can be invoked if desired as follows:
REM
REM    java -classpath \users\gfisher\classes\206\lib\JVM:caltool.jar caltool.Main