Make Instructions

Make is the dominant build environment on Unix platforms. I find it more convenient than Ant. Make's primary disadvantage is, being written in C, it lacks Ant's pure-Java portability in non-unix environments.

Example

This Makefile fragment should help you get started.

build/myjar.jar: Makefile
  @java -cp build/java+.jar edu.virtualschool.javaplus.Make \
    -bundle bndl \
    -srcDir src \
    -dstDir build/dst \
    -binDir build/bin \
    -srcSuffix .java \
    -dstSuffix .java \
    -binSuffix .properties \
    -skipDir CVS \
    -skipDir FOO \
    -skipSuffix bak \
    -skipSuffix foo \
    -jikes \
      -d build/bin \
      -sourcepath build/dst \
      -classpath $(CP) \
      -bootclasspath /usr/java/jdk/jre/lib/rt.jar \
  @cd build/bin && \
    jar cf ../myjar.jar *

This excerpt follows the (recommended) Ant style of confining all non-source files to a build subdirectory. The backslash characters help Makefile readability by confining each option to its own line.

Reference

You convey your compilation process to java+ via the following Makefile parameters. All are optional if the default values (in parentheses) are acceptable:

[-v | -verbose]
Selects verbose logging, else only errors (unbalanced digraphs, etc) are reported. This generates about five lines per input file in the log.
[-f | -force]
Overrides the modification time checking logic. If not specified, Java+ skips inputs whose outputs are up to date.
[-d | -digraph] fourCharacters ({{}})
Specifies the digraph pair for this run as four characters, the first pair differing from the last pair. The first pair will be used as the opening digraph and the last two as the closing.
[-p | -project] projectDirectory (.)
Specifies the project directory, else the current directory (".") will be used.
-bundle javaVariableName
Enables redirection of strings to ResourceBundle files. The argument specifies the name of your program's resource bundle reference. Java+ will automatically define a final static variable with this name and initialize it to a ResourceBundle instance for this class. By default, Java+ strings will be converted to ordinary Java string syntax.
-srcDir directoryName (src)
-dstDir directoryName (dst)
-binDir directoryName (classes)
These identify the three project subdirectories shown as orange boxes in the figure. They may not be the same and will be created if they don't exist.
-srcSuffix suffix (.java)
-dstSuffix suffix (.java)
-binSuffix suffix (.properties)
These specify the file suffixes that java+ uses in its processing. Files in srcDir that end in srcSuffix will be pre-processed into dstDir with a dstSuffix suffix. All other files, except those exempted by the -skipDir and -skipSuffix options below, will be copied to corresponding -binDir subdirectories, which will be created if required. If the -bundle option is specified, java+ strings will be abstracted into a resource file in binDir with a binSuffix suffix. The period before each suffix is optional and will be added if not provided.
-skipDir directoryName
-skipSuffix suffix
These specify directory names and/or file suffixes that should be skipped altogether. Both can be specified multiple times in which case the settings accumulate. By default, only file and directory names beginning with '.' are skipped.
-jikes ...
-javac ...
If either option is specified, jikes or javac will be launched at the end of precompilations in which dstDir files were actually changed. The elipsis (...) indicates that all additional arguments are passed to the compiler along with the names of all dstDir files that were changed by the precompilation process. (Note: this feature is new and likely to change.)


Java+ Version 2.0 © Copyright 2003 by Brad Cox 12 Dec 2003
Served by John Companies, Inc.