Download skeleton.zip. Extract the archive into the top-level directory of your project.
Note: the top-level directory is not the directory that contains your java files (since they should be in the package Iota), but rather it is a directory that contains a folder called Iota which, in turn, contains your java files.
Before you can use the skeleton Makefile, you must set up a few environment variables. To do this on the NT machines in CSUGLab, right click on the My Computer icon and choose Properties.
Select the tab labeled Environment.
Add the directories containing the Cygnus GNU tools and the 1.2.2 JDK to your PATH variable. (By default these are c:\cygnus\cygwin-b20\H-i586-cygwin32\bin;g:\jdk1.2.2\bin in CSUGLab)
After you are sure the environment variables are configured properly, you can use the Makefile to compile your project by executing:
make
This will run JLex on the file Iota\Lexer and CUP on the file Iota\Parser.cup, and then try to compile the Java file Iota\Compiler.java. If any of these steps fail, the build process will abort, and inform you of any errors that you should fix.
Note that there are several caveats to this procedure that are documented in the Makefile itself, open it in a text editor, such as GNU Emacs or VIM (or Notepad) to find out what they are.
A note on editing Makefiles. For hysterical reasons (to be bug-for-bug compatible with AT&T Unix from the early 70's, probably), some lines in the Makefile must begin with a TAB character, rather than some number of spaces. If for some reason it appears that the Makefile is refusing to work correctly, edit the file with a good text editor, and make sure that all the indented lines have tabs and not spaces at the beginning.
In the skeleton file, you will find JAR files compiled from the latest versions of JLex and CUP (as of this writing, these were 1.2.4 and 0.10j, respectively). By default the Makefile will use the JAR files when invoking JLex and CUP. But you can do it yourself too, here is how to do it using a 1.2 JDK:
java -cp JLex.jar JLex.Main <jlex options>
java -cp java_cup.jar java_cup.Main <CUP options>
If you're using an older JDK (tested only with 1.1.x, 1.0.x does something completely different), the java command did not take a -cp option. You should do the following, instead:
jre -cp JLex.jar JLex.Main <jlex options>
jre -cp java_cup.jar java_cup.Main <CUP options>
One final note, when compiling your java program, if it uses a CUP-generated grammar file, the java_cup.jar file should be in your classpath. With a 1.2.x JDK, you should do something like the following:
javac -classpath java_cup.jar <your java files>
If you're using a 1.1.x JDK, it's a little trickier:
jre -cp java_cup.jar sun.tools.javac.Main -depend <your java files>
The best place for more information is the info manual for GNU Make, available here as hypertext.
You can also learn about the entire suite of GNU Cygwin utilities, although we will not be using any of them in class.