Project1 Makefile

Change history

Updating the Makefile

We will occasionally have to modify the Makefile you use to compile the system. Whenver we do that, you will need to get the new version of the file and customize it (again) for your project. While we will do our best to minimize the number of times you do this, some changes are inevitable. Whenever you see in the Announcements page that the Makefile has been changed, do the following steps to bring your version up to date:
  1. Checkout the file Makefile.student from project1_base/Makefile.student.
  2. Put your home directory and group into the lines marked MODIFY. Also enter the directory where your copy of junit.jar is located.
  3. Add the names of any files you write into the appropriate list. There are lists of lawful players, miscreant (unlawful) players, model files, view files, and controller files. A complete set of lists might look like:
    
    LAWFUL_PLAYERS= Simple.class Medium.class Kasparov.class
    MISCREANT_PLAYERS= Nasty.class
    MODEL= GoMokuGameMaster.class GoMokuRules.class Board.class \
           Main.class
    VIEW= GameDisplayer.class GameContainer.class
    CONTROLLER= ControlPanel.class Loader.class
    
    and so forth. Note that you give the names of the .class files, not the .java files. Note also that you only separate the names by spaces, not commas. To continue the list on another line, end the current line with a backslash. The next line can begin with an arbitrary amount of whitespace.

    If you don't have any files in a given category (say, you haven't written any model files), simply leave that line blank.

    If you already have an older Makefile, you should be able to copy most of the changes you made to that file straight into thew new one.

  4. Copy the file into your working directory, usually ~/cis422/project1/422gX. (You might want to rename your old Makefile first, so that it's not overwritten by the new version.) Rename the file from Makefile.student to Makefile.
  5. Update the modified Makefile in your current CVS archive (or add it, if this is your first copy).
  6. Update your copy of the project1_base files by going to your local project1_base and issuing a cvs update command.
Now you're ready to use the make utility. While the syntax of makefiles is awkward and it can be tedious to create them, the effort is worthwhile. The Makefile serves as the master file for building your system. Most importantly, the make utility ensures that any changes you make to your source code are automatically recompiled. Whenever you've made some changes to one or more files and want to rebuild your system to test it, simply type
make
at the command line. This will rebuild your system.

Note: This Makefile works differently from our earlier recommendations: Using this file, your .class files will wind up in the same directory as your soure files rather than being put in a bin subdirectory. This is necessary for the make utility to work. Before you commit any changes back into your CVS archive, run make clean to clear out any .class files.

Other commands

This Makefile has been configured to support several other commands as well:

make jar
Build players.jar, model.jar, view.jar, controller.jar from your files.
make javadoc
Builds a complete set of javadoc files in the subdirectory javadocdir.
make junit
Runs a JUnit test on every file in the search path with "Test" in its name. Use this option to do a JUnit test on your entire system.
make clean
Cleans all object files, forcing a complete system rebuild the next time you do a regular "make".