|
Makefiles
In keeping with its "simple as possible but no simpler" philosophy, Diva uses makefiles where there
can be used easily effectively, and not elsewhere. Basically, makefiles are used:
- In the source trees to build compile Java files
- In the top-level directory to compile files and to provide a single entry-point for other certain administration
scripts
- In the doc/ directory to provide an entry point for a couple of administrative tasks
Makefiles are not used in the main part of the documentation tree at all.
Contents
Package make rules
Each source directory, whether a package or a sub-package, supports these make rules:
- clean
- Remove class files, backup files, and core dumps from this directory and all subdirectories.
- classes
- Compile out-of-date class files in this directory only.
- package
- Compile out-of-date class files in this directory and all sub-package directories. The test/ directory
will not get compiled.
- all
- Compile out-of-date class files in this directory and all sub-directories, including the test/ directory.
- api
- Generate an
api/ subdirectory containing javadocs for this directory. This is intended only for
development use, so you can read the docs as you write code.
- install
- Same as
package.
Documentation directory make rules
The top-level documentation directory supports these make rules:
- clean
- Remove backup files, and core dumps from the whole documentation tree.
- install
- Build any documentation that needs to be built, such as the Javadoc APIs.
Top-level make rules
The top-level Diva directory supports these make rules:
- clean
- Remove class files, backup files, and core dumps from the whole Diva tree.
- packages
- Compile out-of-date class files in all packages, not including the test directories.
- all
- Compile out-of-date class files all packages, including the test/ directory of each package.
- install
- Compile out-of-date class files in all packages, not including the test directories, and build any documentation
that needs to be built.
Makefile checklists
Makefiles can be a pain to maintain. Here are some checklists to help.
- After adding a new top-level package, named say diva.foo:
-
foo/makefile exists and is checked into CVS.
mk/vars.mk has foo added to the PACKAGEDIRS variable.
mk/vars.mk has diva.foo added to the PACKAGES variable.
- Running make classes api in
foo does not fail and all javadocs are generated.
- After adding a new sub-package, named say diva.foo.bar:
-
foo/bar/makefile exists and is checked into CVS.
foo/makefile has bar added to the SUBPACKAGES variable.
mk/vars.mk has diva.foo.bar added to the PACKAGES variable.
- Running make classes api in
foo/bar does not fail and all javadocs are generated.
Sample makefile
Here is a sample makefile, for a top-level package.
#
# $Id: make.html 3136 2001-07-22 22:02:27Z johnr $
#
# Makefile for diva.foo
#
DIVA = ..
include $(DIVA)/mk/vars.mk
# Subpackage directories -- demo last so it compiles last!
SUBPACKAGES = bas raz demo
# Java files in this directory
JSRCS = \
Foo.java \
Bar.java
# Include the compilation rules
include $(DIVA)/mk/compile.mk
|