comparison make/common/JarArchive.gmk @ 48426:1c1118deeedb

Automatic merge with default
author mcimadamore
date Thu, 07 Dec 2017 22:05:06 +0100
parents b90a1b5b8142 a358ebcfacfb
children c5905f5d6d45
comparison
equal deleted inserted replaced
5:64bc33def1a0 7:9dc5741984f1
54 # JARINDEX:=true means generate the index in the jar file. 54 # JARINDEX:=true means generate the index in the jar file.
55 # SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically 55 # SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically
56 # added to the archive. 56 # added to the archive.
57 # EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest. 57 # EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
58 # CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable 58 # CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable
59 # JAR_CMD:=Optionally override the jar command to use when creating the archive.
59 SetupJarArchive = $(NamedParamsMacroTemplate) 60 SetupJarArchive = $(NamedParamsMacroTemplate)
60 define SetupJarArchiveBody 61 define SetupJarArchiveBody
61 62
62 $1_JARMAIN:=$(strip $$($1_JARMAIN)) 63 $1_JARMAIN:=$(strip $$($1_JARMAIN))
63 $1_JARNAME:=$$(notdir $$($1_JAR)) 64 $1_JARNAME:=$$(notdir $$($1_JAR))
64 $1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest 65 $1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest
65 $1_DELETESS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletess 66 $1_DELETESS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletess
66 $1_DELETES_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletes 67 $1_DELETES_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletes
67 $1_BIN:=$$(dir $$($1_JAR)) 68 $1_BIN:=$$(dir $$($1_JAR))
69 $$(call SetIfEmpty, $1_JAR_CMD, $$(JAR))
68 70
69 ifeq (,$$($1_SUFFIXES)) 71 ifeq (,$$($1_SUFFIXES))
70 # No suffix was set, default to classes. 72 # No suffix was set, default to classes.
71 $1_SUFFIXES:=.class 73 $1_SUFFIXES:=.class
72 endif 74 endif
107 endif 109 endif
108 endif 110 endif
109 111
110 # Check if this jar needs to have its index generated. 112 # Check if this jar needs to have its index generated.
111 ifneq (,$$($1_JARINDEX)) 113 ifneq (,$$($1_JARINDEX))
112 $1_JARINDEX = (cd $$(dir $$@) && $(JAR) -i $$(notdir $$@)) 114 $1_JARINDEX = (cd $$(dir $$@) && $$($1_JAR_CMD) -i $$(notdir $$@))
113 else 115 else
114 $1_JARINDEX = true 116 $1_JARINDEX = true
115 endif 117 endif
116 # When this macro is run in the same makefile as the java compilation, dependencies are 118 # When this macro is run in the same makefile as the java compilation, dependencies are
117 # transfered in make variables. When the macro is run in a different makefile than the 119 # transfered in make variables. When the macro is run in a different makefile than the
187 # The update contents macro updates the jar file with the previously capture contents. 189 # The update contents macro updates the jar file with the previously capture contents.
188 # Use 'wc -w' to see if the contents file is empty. 190 # Use 'wc -w' to see if the contents file is empty.
189 $1_UPDATE_CONTENTS=\ 191 $1_UPDATE_CONTENTS=\
190 if [ "`$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'`" -gt "0" ]; then \ 192 if [ "`$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'`" -gt "0" ]; then \
191 $(ECHO) " updating" `$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \ 193 $(ECHO) " updating" `$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
192 $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents; \ 194 $$($1_JAR_CMD) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents; \
193 fi $$(NEWLINE) 195 fi $$(NEWLINE)
194 # The s-variants of the above macros are used when the jar is created from scratch. 196 # The s-variants of the above macros are used when the jar is created from scratch.
195 # NOTICE: please leave the parentheses space separated otherwise the AIX build will break! 197 # NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
196 $1_SCAPTURE_CONTENTS=\ 198 $1_SCAPTURE_CONTENTS=\
197 $(RM) $$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE) \ 199 $(RM) $$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE) \
206 $1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS), \ 208 $1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS), \
207 ( ( $(FIND) $$(src)/META-INF -type f 2> /dev/null || true ) \ 209 ( ( $(FIND) $$(src)/META-INF -type f 2> /dev/null || true ) \
208 | $(SED) 's|$$(src)/|-C $$(src) |g' >> \ 210 | $(SED) 's|$$(src)/|-C $$(src) |g' >> \
209 $$($1_BIN)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) ) 211 $$($1_BIN)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
210 endif 212 endif
211 $1_SUPDATE_CONTENTS=$(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE) 213 $1_SUPDATE_CONTENTS=$$($1_JAR_CMD) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE)
212 214
213 # Use a slightly shorter name for logging, but with enough path to identify this jar. 215 # Use a slightly shorter name for logging, but with enough path to identify this jar.
214 $1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_JAR)) 216 $1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_JAR))
215 217
216 ifneq (,$$($1_CHECK_COMPRESS_JAR)) 218 ifneq (,$$($1_CHECK_COMPRESS_JAR))
224 $1_JAR_CREATE_OPTIONS := cfm 226 $1_JAR_CREATE_OPTIONS := cfm
225 $1_JAR_UPDATE_OPTIONS := uf 227 $1_JAR_UPDATE_OPTIONS := uf
226 endif 228 endif
227 229
228 # Include all variables of significance in the vardeps file 230 # Include all variables of significance in the vardeps file
229 $1_VARDEPS := $(JAR) $$($1_JAR_CREATE_OPTIONS) $$($1_MANIFEST) \ 231 $1_VARDEPS := $$($1_JAR_CMD) $$($1_JAR_CREATE_OPTIONS) $$($1_MANIFEST) \
230 $$($1_JARMAIN) $$($1_EXTRA_MANIFEST_ATTR) $$($1_ORIG_DEPS) $$($1_SRCS) \ 232 $$($1_JARMAIN) $$($1_EXTRA_MANIFEST_ATTR) $$($1_ORIG_DEPS) $$($1_SRCS) \
231 $$($1_INCLUDES) $$($1_EXCLUDES) $$($1_EXCLUDE_FILES) $$($1_EXTRA_FILES) 233 $$($1_INCLUDES) $$($1_EXCLUDES) $$($1_EXCLUDE_FILES) $$($1_EXTRA_FILES)
232 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$(dir $$($1_JAR))_the.$$($1_JARNAME).vardeps) 234 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$(dir $$($1_JAR))_the.$$($1_JARNAME).vardeps)
233 235
234 # Here is the rule that creates/updates the jar file. 236 # Here is the rule that creates/updates the jar file.
248 $$(if $$($1_JARMAIN), \ 250 $$(if $$($1_JARMAIN), \
249 $(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE) $$(NEWLINE)) \ 251 $(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE) $$(NEWLINE)) \
250 $$(if $$($1_EXTRA_MANIFEST_ATTR), \ 252 $$(if $$($1_EXTRA_MANIFEST_ATTR), \
251 $(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE) $$(NEWLINE)) \ 253 $(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE) $$(NEWLINE)) \
252 $(ECHO) Creating $$($1_NAME) $$(NEWLINE) \ 254 $(ECHO) Creating $$($1_NAME) $$(NEWLINE) \
253 $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) $$(NEWLINE) \ 255 $$($1_JAR_CMD) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) $$(NEWLINE) \
254 $$($1_SCAPTURE_CONTENTS) \ 256 $$($1_SCAPTURE_CONTENTS) \
255 $$($1_SCAPTURE_METAINF) \ 257 $$($1_SCAPTURE_METAINF) \
256 $$($1_SUPDATE_CONTENTS) \ 258 $$($1_SUPDATE_CONTENTS) \
257 $$($1_JARINDEX) && true \ 259 $$($1_JARINDEX) && true \
258 , \ 260 , \