:JAR: assertion builds and maintains jar files, with
support for viewpathing, index files, and manifest files. Multiple
:JAR: assertions are supported in a single Makefile.
:JAR: operator has the format:
name.jar :JAR: [manifest-file][JARROOT=root_dir] files...
File prerequisites are specified using full ksh-style shell patterns allowing directories to be recursively searched for matching files. If a manifest file is specified its contents is merged to the target jar file as one part of the internal manifest file.
When using jdk1.2 or higher jar files are generated by stepping through the viewpath and adding the necessary files from each node to the jar file. Jar files are updated incrementally with the new or modified files. Since the older jar command does not support the update feature, compatibility with jdk1.1 is preserved by using a temporary directory to collect the files from each node in the viewpath and generating the jar target file from the temporary directory.
The following example picks up all the
*.png files recursively under the
manifest.mf will be merged with the
internal manifest file. All the files in the jar will be specified
classes as defined by
$ cat jar.mk JARROOT = classes stc.jar :JAR: manifest.mf classes/*.(class|png) $ nmake -f jar.mk -- Making stc.jar -- + cd /home/richb/v2/classes + jar cf /home/richb/v1/stc.jar com/lucent/stc/C.class com/lucent/stc/im ages/logo.png + cd /home/richb/v1/classes + jar uf /home/richb/v1/stc.jar com/stc/A.class com/stc/B.class + jar umf /home/richb/v2/manifest.mf /home/richb/v1/stc.jar + jar i /home/richb/v1/stc.jar $ jar tvf stc.jar 98 Wed May 07 18:16:46 EDT 2003 META-INF/INDEX.LIST 0 Wed May 07 18:16:42 EDT 2003 META-INF/ 57 Wed May 07 18:16:44 EDT 2003 META-INF/MANIFEST.MF 0 Wed May 07 18:12:04 EDT 2003 com/lucent/stc/C.class 0 Wed May 07 18:12:40 EDT 2003 com/lucent/stc/images/logo.png 0 Wed May 07 10:18:26 EDT 2003 com/stc/A.class 0 Wed May 07 10:17:30 EDT 2003 com/stc/B.class
At this time the
cannot be used in the same makefile for building classes and generating
the corresponding jar file. Please see the man page,
included with the nmake package, for full details and options
for using the new
:JAR: operator has a different usage than the
jar rules from our newsletter.
Some makefile changes will be necessary if you are migrating to the new
See Changes Impacting lu3.4 Makefiles: Jar File Support for details.
Java files are optionally compiled in batches to minimize expensive
calls to javac. This performance enhancement feature is called
batched compilation. However, in previous releases, batched
compilation could not be used together with another performance
enhancing feature, concurrent compilation. In this release, batched
concurrent builds are now supported. This is enabled simply by
-j option. The following example will run up to
5 jobs concurrently while batching 10 java source files per compile.
$ nmake maxjavac=10 -j5 -f java.mk
.BATCH have been added to support batch
compilation. These special atoms are used in conjunction to allow safe
concurrent builds for batched file generation.
.BATCHis a dynmaic attribute used to mark jobs which compile a batch of files.
.BATCHEDis a dynamic attribute used to mark targets that are collected for batch compilation. When set it indicates the target has not been created and is just a false file. Targets that have
.BATCHEDprerequisites are blocked.
.BATCHis a dynamic list which contains the queued targets for batch job target. When a
.BATCHjob completes, nmake clears the
.BATCHattribute for target and clears the
.BATCHEDattribute for each prerequisite of target
.BATCH, which allows the blocked dependent jobs on the queue to run.