:JAR: Assertion Operator:JAR: - build and maintain jar files
The :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.
name
.jar:JAR:[manifest-file][JARROOT=root_dir] files…
where:
- name
.jar- The target jar file to be created.
- files
- Files to include in the jar, typically class files, specified using full ksh-style shell patterns. Non-absolute paths are relative to the current directory and must begin with a prefix of
$(JARROOT). Paths in the resulting jar file are relative to$(JARROOT).- manifest-file
- The name of manifest file, used to merge its contents to the target jar file as one part of the internal manifest file. By default, filenames with suffix
.mfare automatically recognized as manifest files. In general, filenames marked with the.JARMANIFESTattribute are taken as manifest files.JARROOT- The root of the package of prerequisite files for the jar archive specified relative to the current directory. The default is the current directory.
Similar to :JAVA:, java source files containing the string
``#empty'' outside of comment sections and as the first item on a line
are excluded from jar archives when archiving source files. Changing a
file to ``#empty'' masks old versions of the file in the viewpath. See
the :JAVA:
manual page
for more information.
By default class files are not affected. To exclude ``#empty'' class files include the following in the makefiles:
.ATTRIBUTE.%.class : .SCAN.java
If a member of a jar archive is changed to ``#empty'' in an incremental build then it is removed from the target jar file. If all members become ``#empty'' then a zero sized file is created for the target jar to mask out old versions of the jar in the viewpath.
The following user-settable variables may be used:
JAR- Jar tool. Defaults to
jar.JARFLAGS- Extra flags for jar command. Defaults to null.
jarappend- Controls whether an existing jar file will be replaced or appended. Setting this to
1will append to an existing jar file that is out of sync with the current state file thus allowing multiple makefiles to maintain members in the same jar. Setting to0or null will clobber an existing jar file that is out of sync with the current state file and remake it. Defaults to null.
The following attribute may be used:
.JARMANIFEST- Attribute to identify jar manifest file defined by user.
$echo $VPATH /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar:/home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar2:/home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar3 $pwd /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test $cat Makefile :ALL: stc0.jar :JAR: testclass/*.class JARROOT=$(VROOT)/test/testclass stc1.jar :JAR: testclass/com/lucent/$(ns)/$(ns).class wang.mf stc2.jar :JAR: testclass/(com|com1)/*.(class|gif) stc3.jar :JAR: testclass/com/lucent/p[12]/*.@(class|gif) stc4.jar :JAR: testclass/com/lucent/p?/*.class image/*/*.gif $nmake -- Making stc0.jar -- + cd /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar2/test/testclass + jar cf /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc0.jar com/lucent/p2/CC.class com/lucent/p2/DD.class com/lucent/p2/pkg21/E.class com/lucent/p2/pkg21/F.class com/lucent/p2/pkg22/G.class com/lucent/p2/pkg22/H.class + cd /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/testclass + jar uf /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc0.jar com/AAAA.class com/BBBB.class com/lucent/AAA.class com/lucent/BBB.class com/lucent/p1/AA.class com/lucent/p1/BB.class com/lucent/p1/pkg11/A.class com/lucent/p1/pkg11/B.class com/lucent/p1/pkg12/C.class com/lucent/p1/pkg12/D.class + jar i /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc0.jar -- Making stc1.jar -- + cd /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar2/test + jar cf /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc1.jar testclass/com/lucent/p2/CC.class testclass/com/lucent/p2/DD.class + cd /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test + jar uf /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc1.jar testclass/com/lucent/p1/AA.class testclass/com/lucent/p1/BB.class + jar umf wang.mf /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc1.jar + jar i /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc1.jar -- Making stc2.jar -- + cd /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar2/test + jar cf /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc2.jar testclass/com/lucent/p2/CC.class testclass/com/lucent/p2/DD.class testclass/com/lucent/p2/pkg21/E.class testclass/com/lucent/p2/pkg21/F.class testclass/com/lucent/p2/pkg22/G.class testclass/com/lucent/p2/pkg22/H.class + cd /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test + jar uf /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc2.jar testclass/com/AAAA.class testclass/com/BBBB.class testclass/com/lucent/AAA.class testclass/com/lucent/BBB.class testclass/com/lucent/p1/AA.class testclass/com/lucent/p1/BB.class testclass/com/lucent/p1/pkg11/A.class testclass/com/lucent/p1/pkg11/B.class testclass/com/lucent/p1/pkg12/C.class testclass/com/lucent/p1/pkg12/D.class + jar i /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc2.jar -- Making stc3.jar -- + cd /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar2/test + jar cf /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc3.jar testclass/com/lucent/p2/CC.class testclass/com/lucent/p2/DD.class testclass/com/lucent/p2/pkg21/E.class testclass/com/lucent/p2/pkg21/F.class testclass/com/lucent/p2/pkg22/G.class testclass/com/lucent/p2/pkg22/H.class + cd /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test + jar uf /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc3.jar testclass/com/lucent/p1/AA.class testclass/com/lucent/p1/BB.class testclass/com/lucent/p1/pkg11/A.class testclass/com/lucent/p1/pkg11/B.class testclass/com/lucent/p1/pkg12/C.class testclass/com/lucent/p1/pkg12/D.class + jar i /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc3.jar -- Making stc4.jar -- + cd /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar3/test + jar cf /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc4.jar image/com1/CCCC.gif image/com1/lucent/CCC.gif image/com1/lucent/p1/CC.gif image/com1/lucent/p1/pkg11/C1.gif image/com1/lucent/p1/pkg11/C2.gif image/com1/lucent/p1/pkg12/C3.gif image/com1/lucent/p1/pkg12/C4.gif + cd /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar2/test + jar uf /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc4.jar testclass/com/lucent/p2/CC.class testclass/com/lucent/p2/DD.class testclass/com/lucent/p2/pkg21/E.class testclass/com/lucent/p2/pkg21/F.class testclass/com/lucent/p2/pkg22/G.class testclass/com/lucent/p2/pkg22/H.class + cd /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test + jar uf /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc4.jar testclass/com/lucent/p1/AA.class testclass/com/lucent/p1/BB.class test-class/com/lucent/p1/pkg11/A.class testclass/com/lucent/p1/pkg11/B.class testclass/com/lucent/p1/pkg12/C.class testclass/com/lucent/p1/pkg12/D.class + jar i /home/hqwang/nmake/MR/lu3.6/jdeps010013/mr_jar/test/stc4.jar
JARROOT is set to their parent
directory.* rhs pattern matches /. Thus,
dir/*.class matches all class files recursively under
dir. The shell pattern *([!/]) matches the
maximum length character string not containing a /. For
convenience, the nmake variable ns is set to this pattern.
For example, dir/$(ns).class matches all classes directly
contained in dir.JARROOT can be set as a standard variable in the Makefile,
thus, it will be in effect for all :JAR: assertions. If put
in the prerequisite list of a :JAR: assertion, it will be
used solely for that assertion.JARMANIFEST can be used flexibly in user Makefiles.
common usage: manifest file :
.JARMANIFEST
extended usage:.ATTRIBUTE.%.pattern: .JARMANIFEST
For.mffiles,.JARMANIFESThas already been set by default, as
.ATTRIBUTE.%.mf : .JARMANIFEST
:ALL: can build all targets of
:JAR: assertions automatically, if not specified, the first
target will be taken as the main target by default.:JAVA: should first be used in a different makefile to build
them. Currently, :JAR: and :JAVA: assertions
can’t be used in the same Makefile.:JAVA: manual page for more information.Copyright 2004 Alcatel-Lucent. All Rights Reserved.
See http://www.bell-labs.com/project/nmake/licenseagreement.html
for terms of use.
:JAR: - build and maintain jar files
Release lu3.8 @(#)jarman.html 8.1.2.1 05/04/06