common/makefiles/JavaCompilation.gmk

changeset 478
2ba6f4da4bf3
parent 458
c8d320b48626
child 494
e64f2cb57d05
equal deleted inserted replaced
476:76844579fa4b 478:2ba6f4da4bf3
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any 22 # or visit www.oracle.com if you need additional information or have any
23 # questions. 23 # questions.
24 # 24 #
25 25
26 # The complexity of this makefile is not the fault of make, but the fault 26 # This makefile is much simpler now that it can use the smart javac wrapper
27 # of javac and javah. The basic problems are: 27 # for dependency tracking between java packages and incremental compiles.
28 # 28 # It could be even more simple if we added support for incremental jar updates
29 # 1) Compiling a single Java source file unpredictably generates anything 29 # directly from the smart javac wrapper.
30 # between zero (0!) and an infinite number of .class files! 30
31 # 2) There is no hint, for which classes javah needs to be run, 31 # Cleaning/copying properties here is not a good solution. The properties
32 # and it happily generates .h files for classes with no native methods. 32 # should be cleaned/copied by a annotation processor in sjavac.
33 # 3) javac and javah do not cleanup anything, for example if an internal 33
34 # class (potentially with native methods) is removed from a Java source file.
35 #
36 # This makefile is a tribute to GNU make. And yes, it was harder to write than it is
37 # to read. The include/excludes of directories and files are only a temporary measure
38 # to work around the messy jdk sources that put platform specific code in src/share/classes.
39 #
40 # We should move most of the functionality of this makefile into a
41 # smart javac/javah/javadoc/jar combo tool. sjavac ?
42 #
43 # I.e. 1) It always generates a single output, a zip-file from a number of source roots.
44 # The zip file contains information that enable incremental builds with full
45 # dependency tracking between packages.
46 # 2) It automatically generates the right .h files.
47 # 3) It keeps its house clean.
48 # *) Generates intermediate files to be used for javadoc generation later.
49 # and does all the other useful things that this makefile does, such as:
50 # use all cores for compilation, reuse the running JVM for all compilations,
51 # and has pubapi dependency tracking to minimize the number of files
52 # that need to be recompiled during an incremental build.
53 #
54 # A zip file, or several zip files combined, can then be converted to a .jar file, or to a .jmod file.
55 #
56 # This would make this makefile much much simpler. I.e. make can be used
57 # for its real purpose, track dependencies and trigger a recompile if a
58 # dependency has changed.
59 #
60 # When you read this source. Remember that $(sort ...) has the side effect 34 # When you read this source. Remember that $(sort ...) has the side effect
61 # of removing duplicates. It is actually this side effect that is 35 # of removing duplicates. It is actually this side effect that is
62 # desired whenever sort is used below! 36 # desired whenever sort is used below!
63 37
64 ifeq (,$(_MAKEBASE_GMK)) 38 ifeq (,$(_MAKEBASE_GMK))
65 $(error You must include MakeBase.gmk prior to including JavaCompilation.gmk) 39 $(error You must include MakeBase.gmk prior to including JavaCompilation.gmk)
66 endif 40 endif
67 41
68 FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST 42 FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST
69
70 # If compilation of java package fails, then the public api file for that
71 # package will not be genereated. We add this fallback rule to generate
72 # an empty pubapi file.
73 %.api:
74 if test ! -f $@; then $(MKDIR) -p $(@D); $(TOUCH) $@; fi
75 43
76 define SetupJavaCompiler 44 define SetupJavaCompiler
77 # param 1 is for example BOOT_JAVAC or NEW_JAVAC 45 # param 1 is for example BOOT_JAVAC or NEW_JAVAC
78 # This is the name later used to decide which java compiler to use. 46 # This is the name later used to decide which java compiler to use.
79 # param 2-9 are named args. 47 # param 2-9 are named args.
80 # JVM:=The jvm used to run the javac/javah command 48 # JVM:=The jvm used to run the javac/javah command
81 # JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out 49 # JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out
82 # JAVAH:=The javah jar and bootstrap classpath changes, or just bin/javah if JVM is left out
83 # FLAGS:=Flags to be supplied to javac 50 # FLAGS:=Flags to be supplied to javac
84 # MODE:=SINGLE_THREADED_BATCH (primarily for old javac) or MULTI_CORE_CONCURRENT
85 # only for MULTI_CORE_CONCURRENT are the options below relevant:
86 # SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here 51 # SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
87 # SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above. 52 # SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above.
88 # USE_DEPS:=true means use -XDdeps,-XDpubapi and -XDnativeapi to track java dependencies
89 $(if $2,$1_$(strip $2)) 53 $(if $2,$1_$(strip $2))
90 $(if $3,$1_$(strip $3)) 54 $(if $3,$1_$(strip $3))
91 $(if $4,$1_$(strip $4)) 55 $(if $4,$1_$(strip $4))
92 $(if $5,$1_$(strip $5)) 56 $(if $5,$1_$(strip $5))
93 $(if $6,$1_$(strip $6)) 57 $(if $6,$1_$(strip $6))
94 $(if $7,$1_$(strip $7)) 58 $(if $7,$1_$(strip $7))
95 $(if $8,$1_$(strip $8)) 59 $(if $8,$1_$(strip $8))
96 $(if $9,$1_$(strip $9)) 60 $(if $9,$1_$(strip $9))
97 $(if $(10),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk)) 61 $(if $(10),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
98 62
99 ifeq ($$($1_MODE),MULTI_CORE_CONCURRENT) 63 ifeq ($$(ENABLE_SJAVAC),yes)
100 ifneq (,$$($1_SERVER_DIR)) 64 # The port file contains the tcp/ip on which the server listens
101 # A javac server has been requested. 65 # and the cookie necessary to talk to the server.
102 # The port file contains the tcp/ip on which the server listens 66 $1_JAVAC_PORTFILE:=$$($1_SERVER_DIR)/server.port
103 # and the cookie necessary to talk to the server. 67 # You can use a different JVM to run the background javac server.
104 $1_JAVAC_PORTFILE:=$$($1_SERVER_DIR)/$1.port 68 ifeq ($$($1_SERVER_JVM),)
105 ifeq ($$($1_SERVER_JVM),) 69 # It defaults to the same JVM that is used to start the javac command.
106 # You can use a different JVM to run the background javac server. 70 $1_SERVER_JVM:=$$($1_JVM)
107 # But if not set, it defaults to the same JVM that is used to start 71 endif
108 # the javac command. 72 # Set the $1_REMOTE to spawn a background javac server.
109 $1_SERVER_JVM:=$$($1_JVM) 73 $1_REMOTE:=-XDserver:portfile=$$($1_JAVAC_PORTFILE),poolsize=$(SJAVAC_SERVER_CORES),id=$1,javac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_JAVAC))))
110 endif
111 # Set the $1_REMOTE to spawn a background javac server.
112 $1_REMOTE:=-XDserver:portfile=$$($1_JAVAC_PORTFILE),poolsize=$(JAVAC_SERVER_CORES),javac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_JAVAC))))
113 endif
114 endif 74 endif
115 endef 75 endef
116 76
117 define SetupArchive 77 define SetupArchive
118 # param 1 is for example ARCHIVE_MYPACKAGE 78 # param 1 is for example ARCHIVE_MYPACKAGE
125 # EXCLUDE_FILES:=List of files in SRCS that should be excluded 85 # EXCLUDE_FILES:=List of files in SRCS that should be excluded
126 # EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match. 86 # EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match.
127 # JAR:=Jar file to create 87 # JAR:=Jar file to create
128 # MANIFEST:=Optional manifest file template. 88 # MANIFEST:=Optional manifest file template.
129 # JARMAIN:=Optional main class to add to manifest 89 # JARMAIN:=Optional main class to add to manifest
130 # JARINDEX := 90 # JARINDEX:=true means generate the index in the jar file.
131 # SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically 91 # SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically
132 # added to the archive. 92 # added to the archive.
133 # EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest. 93 # EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
134 # CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable 94 # CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable
135 $(if $3,$1_$(strip $3)) 95 $(if $3,$1_$(strip $3))
150 $1_JARMAIN:=$(strip $$($1_JARMAIN)) 110 $1_JARMAIN:=$(strip $$($1_JARMAIN))
151 $1_JARNAME:=$$(notdir $$($1_JAR)) 111 $1_JARNAME:=$$(notdir $$($1_JAR))
152 $1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest 112 $1_MANIFEST_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_manifest
153 $1_DELETESS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletess 113 $1_DELETESS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletess
154 $1_DELETES_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletes 114 $1_DELETES_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_deletes
155 $1_PUBAPI_NOTIFICATIONS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_pubapi_notifications
156 $1_NATIVEAPI_NOTIFICATIONS_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_native_notifications
157 $1_NATIVEAPI_FILE:=$$(dir $$($1_JAR))_the.$$($1_JARNAME)_native
158 $1_BIN:=$$(dir $$($1_JAR)) 115 $1_BIN:=$$(dir $$($1_JAR))
159 116
160 ifeq (,$$($1_SUFFIXES)) 117 ifeq (,$$($1_SUFFIXES))
161 # No suffix was set, default to classes. 118 # No suffix was set, default to classes.
162 $1_SUFFIXES:=.class 119 $1_SUFFIXES:=.class
178 $$(eval $$(call ListPathsSafelyNow,$1_GREP_EXCLUDE_PATTERNS,\n, \ 135 $$(eval $$(call ListPathsSafelyNow,$1_GREP_EXCLUDE_PATTERNS,\n, \
179 >> $$($1_BIN)/_the.$$($1_JARNAME)_exclude)) 136 >> $$($1_BIN)/_the.$$($1_JARNAME)_exclude))
180 $1_GREP_EXCLUDES:=| $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude 137 $1_GREP_EXCLUDES:=| $(GREP) -v -f $$($1_BIN)/_the.$$($1_JARNAME)_exclude
181 endif 138 endif
182 139
140 # Check if this jar needs to have its index generated.
183 ifneq (,$$($1_JARINDEX)) 141 ifneq (,$$($1_JARINDEX))
184 $1_JARINDEX = (cd $$(dir $$@) && $(JAR) -i $$(notdir $$@)) 142 $1_JARINDEX = (cd $$(dir $$@) && $(JAR) -i $$(notdir $$@))
185 else 143 else
186 $1_JARINDEX = true 144 $1_JARINDEX = true
187 endif 145 endif
188 # When this macro is run in the same makefile as the java compilation, dependencies are transfered 146 # When this macro is run in the same makefile as the java compilation, dependencies are transfered
189 # in make variables. When the macro is run in a different makefile than the java compilation, the 147 # in make variables. When the macro is run in a different makefile than the java compilation, the
190 # dependencies need to be found in the filesystem. 148 # dependencies need to be found in the filesystem.
191 $1_ALL_SRCS:=$$(foreach src,$$($1_SRCS),$$(shell ($(FIND) $$(src) -type f \ 149 ifneq (,$2)
150 $1_DEPS:=$2
151 else
152 $1_DEPS:=$$(foreach src,$$($1_SRCS),$$(shell ($(FIND) $$(src) -type f \
192 -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \ 153 -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
193 $$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)))) 154 $$($1_GREP_EXCLUDES) && $(ECHO) $$(addprefix $$(src)/,$$($1_EXTRA_FILES)))))
194 ifeq (,$$($1_SKIP_METAINF)) 155 ifeq (,$$($1_SKIP_METAINF))
195 $1_ALL_SRCS+=$$(foreach src,$$($1_SRCS),$$(shell $(FIND) $$(src)/META-INF -type f 2> /dev/null)) 156 $1_DEPS+=$$(foreach src,$$($1_SRCS),$$(shell $(FIND) $$(src)/META-INF -type f 2> /dev/null))
196 endif 157 endif
197 158 endif
198 159
199 # Utility macros, to make the shell script receipt somewhat easier to dechipher. 160 # Utility macros, to make the shell script receipt somewhat easier to dechipher.
200 161
201 # The capture contents macro finds all files (matching the patterns, typically 162 # The capture contents macro finds all files (matching the patterns, typically
202 # .class and .prp) that are newer than the jar-file, ie the new content to be put into the jar. 163 # .class and .prp) that are newer than the jar-file, ie the new content to be put into the jar.
206 $1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS),($(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents ) && ) 167 $1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS),($(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents ) && )
207 endif 168 endif
208 # The capture deletes macro finds all deleted files and concatenates them. The resulting file 169 # The capture deletes macro finds all deleted files and concatenates them. The resulting file
209 # tells us what to remove from the jar-file. 170 # tells us what to remove from the jar-file.
210 $1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ -exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) &&) 171 $1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ -exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) &&)
211 # The capture pubapi notifications scans for pubapi change notifications. If such notifications are
212 # found, then we will build the classes leading up to the jar again, to take into account the new timestamps
213 # on the changed pubapi files.
214 $1_CAPTURE_PUBAPI_NOTIFICATIONS=$$(foreach src,$$($1_SRCS),\
215 (cd $$(src) && \
216 $(FIND) . -name _the.package.api.notify -exec dirname \{\} \; >> $$($1_PUBAPI_NOTIFICATIONS_FILE) ; \
217 true) &&)
218 # The update contents macro updates the jar file with the previously capture contents. 172 # The update contents macro updates the jar file with the previously capture contents.
219 $1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\ 173 $1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
220 (cd $$(src) && \ 174 (cd $$(src) && \
221 if [ -s _the.$$($1_JARNAME)_contents ]; then \ 175 if [ -s _the.$$($1_JARNAME)_contents ]; then \
222 $(ECHO) " updating" `$(WC) -l _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \ 176 $(ECHO) " updating" `$(WC) -l _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
223 $(JAR) uf $$@ @_the.$$($1_JARNAME)_contents; \ 177 $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @_the.$$($1_JARNAME)_contents; \
224 fi) &&) 178 fi) &&)
225 # The s-variants of the above macros are used when the jar is created from scratch. 179 # The s-variants of the above macros are used when the jar is created from scratch.
226 $1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\ 180 $1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS),\
227 (($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \ 181 (($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
228 $$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)) | $(SED) 's|$$(src)/||g' > \ 182 $$($1_GREP_EXCLUDES) && $(ECHO) $$($1_EXTRA_FILES)) | $(SED) 's|$$(src)/||g' > \
232 $1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS),\ 186 $1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS),\
233 ($(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/||g' >> \ 187 ($(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/||g' >> \
234 $$(src)/_the.$$($1_JARNAME)_contents) && ) 188 $$(src)/_the.$$($1_JARNAME)_contents) && )
235 endif 189 endif
236 $1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\ 190 $1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS),\
237 (cd $$(src) && $(JAR) uf $$@ @$$(src)/_the.$$($1_JARNAME)_contents) &&) 191 (cd $$(src) && $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$(src)/_the.$$($1_JARNAME)_contents) &&)
238 192
239 # The TOUCH macro is used to make sure all timestamps are identical for package files and the pubapi files.
240 # If we do not do this, we get random recompilations, the next time we run make, since the order of package building is random,
241 # ie independent of package --dependes on-> public api of another package. This is of course
242 # due to the fact that Java source often (always?) has circular dependencies. (Thus there is no correct order
243 # to compile packages, and we can just as well do them in a random order. Which we do.)
244 $1_TOUCH_API_FILES=$$(foreach src,$$($1_SRCS),\
245 ($(FIND) $$(src) -name _the.package.api -exec $(TOUCH) -r $$($1_JAR) \{\} \; ; true) && \
246 ($(FIND) $$(src) -name _the.package -exec $(TOUCH) -r $$($1_JAR) \{\} \; ; true) &&)
247 # Use a slightly shorter name for logging, but with enough path to identify this jar. 193 # Use a slightly shorter name for logging, but with enough path to identify this jar.
248 $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR)) 194 $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
249 195
250 ifneq (,$$($1_CHECK_COMPRESS_JAR)) 196 ifneq (,$$($1_CHECK_COMPRESS_JAR))
251 $1_JAR_CREATE_OPTIONS := c0fm 197 $1_JAR_CREATE_OPTIONS := c0fm
198 $1_JAR_UPDATE_OPTIONS := u0f
252 ifeq ($(COMPRESS_JARS), true) 199 ifeq ($(COMPRESS_JARS), true)
253 $1_JAR_CREATE_OPTIONS := cfm 200 $1_JAR_CREATE_OPTIONS := cfm
201 $1_JAR_UPDATE_OPTIONS := uf
254 endif 202 endif
255 else 203 else
256 $1_JAR_CREATE_OPTIONS := cfm 204 $1_JAR_CREATE_OPTIONS := cfm
205 $1_JAR_UPDATE_OPTIONS := uf
257 endif 206 endif
258 207
259 # Here is the rule that creates/updates the jar file. 208 # Here is the rule that creates/updates the jar file.
260 $$($1_JAR) : $2 $$($1_ALL_SRC) 209 $$($1_JAR) : $$($1_DEPS)
261 $(MKDIR) -p $$($1_BIN) 210 $(MKDIR) -p $$($1_BIN)
262 if [ -n "$$($1_MANIFEST)" ]; then \ 211 if [ -n "$$($1_MANIFEST)" ]; then \
263 $(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \ 212 $(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \
264 -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" $$($1_MANIFEST) > $$($1_MANIFEST_FILE); \ 213 -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" $$($1_MANIFEST) > $$($1_MANIFEST_FILE); \
265 else \ 214 else \
270 fi 219 fi
271 if [ -n "$$($1_EXTRA_MANIFEST_ATTR)" ]; then \ 220 if [ -n "$$($1_EXTRA_MANIFEST_ATTR)" ]; then \
272 $(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE); \ 221 $(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE); \
273 fi 222 fi
274 +if [ -s $$@ ]; then \ 223 +if [ -s $$@ ]; then \
275 $(RM) -r $$($1_PUBAPI_NOTIFICATIONS_FILE) && \ 224 $(ECHO) Modifying $$($1_NAME) && \
276 $$($1_CAPTURE_PUBAPI_NOTIFICATIONS) \ 225 $$($1_CAPTURE_CONTENTS) \
277 if [ -s $$($1_PUBAPI_NOTIFICATIONS_FILE) ]; then \ 226 $$($1_CAPTURE_METAINF) \
278 $(ECHO) Public api change detected in: && \ 227 $(RM) $$($1_DELETES_FILE) && \
279 $(CAT) $$($1_PUBAPI_NOTIFICATIONS_FILE) | $(TR) '/' '.' | $(SED) 's|^..||g' | $(SED) 's|\.$$$$||g' | $(AWK) '{print " "$$$$1}' && \ 228 $$($1_CAPTURE_DELETES) \
280 $$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.api.notify $(FIND_DELETE); true) &&) \ 229 $(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) && \
281 $(MAKE) -f $(word 1,$(MAKEFILE_LIST)) $$($1_JAR) ; \ 230 if [ -s $$($1_DELETESS_FILE) ]; then \
282 else \ 231 $(ECHO) " deleting" `$(WC) -l $$($1_DELETESS_FILE) | $(AWK) '{ print $$$$1 }'` files && \
283 $(ECHO) Modifying $$($1_NAME) && \ 232 $(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \
284 $$($1_CAPTURE_CONTENTS) \ 233 fi && \
285 $$($1_CAPTURE_METAINF) \ 234 $$($1_UPDATE_CONTENTS) true && \
286 $(RM) $$($1_DELETES_FILE) && \ 235 $$($1_JARINDEX) && true ; \
287 $$($1_CAPTURE_DELETES) \
288 $(CAT) $$($1_DELETES_FILE) > $$($1_DELETESS_FILE) && \
289 if [ -s $$($1_DELETESS_FILE) ]; then \
290 $(ECHO) " deleting" `$(WC) -l $$($1_DELETESS_FILE) | $(AWK) '{ print $$$$1 }'` files && \
291 $(ZIP) -q -d $$@ `$(CAT) $$($1_DELETESS_FILE)` ; \
292 fi && \
293 $$($1_UPDATE_CONTENTS) true && \
294 $$($1_JARINDEX) && \
295 $$($1_TOUCH_API_FILES) true && \
296 $$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.api.notify $(FIND_DELETE); true) &&) true ; \
297 fi ; \
298 else \ 236 else \
299 $(ECHO) Creating $$($1_NAME) && $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) && \ 237 $(ECHO) Creating $$($1_NAME) && $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) && \
300 $$($1_SCAPTURE_CONTENTS) \ 238 $$($1_SCAPTURE_CONTENTS) \
301 $$($1_SCAPTURE_METAINF) \ 239 $$($1_SCAPTURE_METAINF) \
302 $$($1_SUPDATE_CONTENTS) \ 240 $$($1_SUPDATE_CONTENTS) \
303 $$($1_JARINDEX) && \ 241 $$($1_JARINDEX) && true ; \
304 $$($1_TOUCH_API_FILES) true && \
305 $(RM) -r $$($1_NATIVEAPI_NOTIFICATIONS_FILE) $$($1_NATIVEAPI_FILE) && \
306 $$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name "*.notify" $(FIND_DELETE); true) &&) true ; \
307 fi; 242 fi;
308 243
309 endef
310
311 define append_to
312 $(ECHO) "$1" >> $2
313 endef 244 endef
314 245
315 define SetupZipArchive 246 define SetupZipArchive
316 # param 1 is for example ZIP_MYSOURCE 247 # param 1 is for example ZIP_MYSOURCE
317 # param 2,3,4,5,6,7,8,9 are named args. 248 # param 2,3,4,5,6,7,8,9 are named args.
341 $1_ALL_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_SRCS)) 272 $1_ALL_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_SRCS))
342 endif 273 endif
343 ifneq ($$($1_EXCLUDES),) 274 ifneq ($$($1_EXCLUDES),)
344 $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES)))) 275 $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
345 $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES))) 276 $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
346 $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS)) 277 $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRC))
347 endif 278 endif
348 279
349 # Use a slightly shorter name for logging, but with enough path to identify this zip. 280 # Use a slightly shorter name for logging, but with enough path to identify this zip.
350 $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP)) 281 $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
351 282
379 310
380 311
381 # This macro is used only for properties files that are to be 312 # This macro is used only for properties files that are to be
382 # copied over to the classes directory in cleaned form: 313 # copied over to the classes directory in cleaned form:
383 # Previously this was inconsistently done in different repositories. 314 # Previously this was inconsistently done in different repositories.
384 # This is the new clean standard. 315 # This is the new clean standard. Though it is to be superseded by
316 # a standard annotation processor from with sjavac.
385 define add_file_to_copy_and_clean 317 define add_file_to_copy_and_clean
386 # param 1 = BUILD_MYPACKAGE 318 # param 1 = BUILD_MYPACKAGE
387 # parma 2 = The source file to copy and clean. 319 # parma 2 = The source file to copy and clean.
388 $2_TARGET:=$2 320 $2_TARGET:=$2
389 # Remove the source prefix. 321 # Remove the source prefix.
390 $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET))) 322 $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET)))
391 # Now we can setup the depency that will trigger the copying. 323 # Now we can setup the depency that will trigger the copying.
392 $$($1_BIN)$$($2_TARGET) : $2 324 $$($1_BIN)$$($2_TARGET) : $2
393 $(MKDIR) -p $$(@D) 325 $(MKDIR) -p $$(@D)
394 $(ECHO) Cleaning $$($2_TARGET)
395 $(CAT) $$< | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \ 326 $(CAT) $$< | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
396 | $(SED) \ 327 | $(SED) -f "$(SRC_ROOT)/common/bin/unicode2x.sed" \
397 -e 's/\\u0020/\x20/g' \
398 -e 's/\\u003A/\x3A/g' \
399 -e 's/\\u006B/\x6B/g' \
400 -e 's/\\u0075/\x75/g' \
401 -e 's/\\u00A0/\xA0/g' \
402 -e 's/\\u00A3/\xA3/g' \
403 -e 's/\\u00B0/\xB0/g' \
404 -e 's/\\u00B7/\xB7/g' \
405 -e 's/\\u00BA/\xBA/g' \
406 -e 's/\\u00BF/\xBF/g' \
407 -e 's/\\u00C0/\xC0/g' \
408 -e 's/\\u00C1/\xC1/g' \
409 -e 's/\\u00C2/\xC2/g' \
410 -e 's/\\u00C4/\xC4/g' \
411 -e 's/\\u00C5/\xC5/g' \
412 -e 's/\\u00C8/\xC8/g' \
413 -e 's/\\u00C9/\xC9/g' \
414 -e 's/\\u00CA/\xCA/g' \
415 -e 's/\\u00CD/\xCD/g' \
416 -e 's/\\u00CE/\xCE/g' \
417 -e 's/\\u00D3/\xD3/g' \
418 -e 's/\\u00D4/\xD4/g' \
419 -e 's/\\u00D6/\xD6/g' \
420 -e 's/\\u00DA/\xDA/g' \
421 -e 's/\\u00DC/\xDC/g' \
422 -e 's/\\u00DD/\xDD/g' \
423 -e 's/\\u00DF/\xDF/g' \
424 -e 's/\\u00E0/\xE0/g' \
425 -e 's/\\u00E1/\xE1/g' \
426 -e 's/\\u00E2/\xE2/g' \
427 -e 's/\\u00E3/\xE3/g' \
428 -e 's/\\u00E4/\xE4/g' \
429 -e 's/\\u00E5/\xE5/g' \
430 -e 's/\\u00E6/\xE6/g' \
431 -e 's/\\u00E7/\xE7/g' \
432 -e 's/\\u00E8/\xE8/g' \
433 -e 's/\\u00E9/\xE9/g' \
434 -e 's/\\u00EA/\xEA/g' \
435 -e 's/\\u00EB/\xEB/g' \
436 -e 's/\\u00EC/\xEC/g' \
437 -e 's/\\u00ED/\xED/g' \
438 -e 's/\\u00EE/\xEE/g' \
439 -e 's/\\u00EF/\xEF/g' \
440 -e 's/\\u00F1/\xF1/g' \
441 -e 's/\\u00F2/\xF2/g' \
442 -e 's/\\u00F3/\xF3/g' \
443 -e 's/\\u00F4/\xF4/g' \
444 -e 's/\\u00F5/\xF5/g' \
445 -e 's/\\u00F6/\xF6/g' \
446 -e 's/\\u00F9/\xF9/g' \
447 -e 's/\\u00FA/\xFA/g' \
448 -e 's/\\u00FC/\xFC/g' \
449 -e 's/\\u0020/\x20/g' \
450 -e 's/\\u003f/\x3f/g' \
451 -e 's/\\u006f/\x6f/g' \
452 -e 's/\\u0075/\x75/g' \
453 -e 's/\\u00a0/\xa0/g' \
454 -e 's/\\u00a3/\xa3/g' \
455 -e 's/\\u00b0/\xb0/g' \
456 -e 's/\\u00ba/\xba/g' \
457 -e 's/\\u00bf/\xbf/g' \
458 -e 's/\\u00c1/\xc1/g' \
459 -e 's/\\u00c4/\xc4/g' \
460 -e 's/\\u00c5/\xc5/g' \
461 -e 's/\\u00c8/\xc8/g' \
462 -e 's/\\u00c9/\xc9/g' \
463 -e 's/\\u00ca/\xca/g' \
464 -e 's/\\u00cd/\xcd/g' \
465 -e 's/\\u00d6/\xd6/g' \
466 -e 's/\\u00dc/\xdc/g' \
467 -e 's/\\u00dd/\xdd/g' \
468 -e 's/\\u00df/\xdf/g' \
469 -e 's/\\u00e0/\xe0/g' \
470 -e 's/\\u00e1/\xe1/g' \
471 -e 's/\\u00e2/\xe2/g' \
472 -e 's/\\u00e3/\xe3/g' \
473 -e 's/\\u00e4/\xe4/g' \
474 -e 's/\\u00e5/\xe5/g' \
475 -e 's/\\u00e7/\xe7/g' \
476 -e 's/\\u00e8/\xe8/g' \
477 -e 's/\\u00e9/\xe9/g' \
478 -e 's/\\u00ea/\xea/g' \
479 -e 's/\\u00eb/\xeb/g' \
480 -e 's/\\u00ec/\xec/g' \
481 -e 's/\\u00ed/\xed/g' \
482 -e 's/\\u00ee/\xee/g' \
483 -e 's/\\u00ef/\xef/g' \
484 -e 's/\\u00f0/\xf0/g' \
485 -e 's/\\u00f1/\xf1/g' \
486 -e 's/\\u00f2/\xf2/g' \
487 -e 's/\\u00f3/\xf3/g' \
488 -e 's/\\u00f4/\xf4/g' \
489 -e 's/\\u00f5/\xf5/g' \
490 -e 's/\\u00f6/\xf6/g' \
491 -e 's/\\u00f7/\xf7/g' \
492 -e 's/\\u00f8/\xf8/g' \
493 -e 's/\\u00f9/\xf9/g' \
494 -e 's/\\u00fa/\xfa/g' \
495 -e 's/\\u00fc/\xfc/g' \
496 -e 's/\\u00ff/\xff/g' \
497 | $(SED) -e '/^#/d' -e '/^$$$$/d' \ 328 | $(SED) -e '/^#/d' -e '/^$$$$/d' \
498 -e :a -e '/\\$$$$/N; s/\\\n//; ta' \ 329 -e :a -e '/\\$$$$/N; s/\\\n//; ta' \
499 -e 's/^[ \t]*//;s/[ \t]*$$$$//' \ 330 -e 's/^[ \t]*//;s/[ \t]*$$$$//' \
500 -e 's/\\=/=/' | LANG=C $(SORT) > $$@ 331 -e 's/\\=/=/' | LANG=C $(SORT) > $$@
501 $(CHMOD) -f ug+w $$@ 332 $(CHMOD) -f ug+w $$@
502 333
503 # And do not forget this target 334 # And do not forget this target
504 $1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($2_TARGET) 335 $1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($2_TARGET)
505 endef
506
507 define add_java_package
508 # param 1 = BUILD_MYPACKAGE
509 # param 2 = the package target file (_the.package)
510 # param 3 = src roots, all of them, separated with space
511 # param 4 = bin root
512 # param 5 = include these dependecies
513 # param 6 = not used
514 # param 7 = if non-empty, then use -Xdeps and -Xpubapi
515 # param 8 = xremote configuration, or empty.
516 # param 9 = javac command
517 # param 10 = javac flags
518 # param 11 = exclude these files!
519 # param 12 = only include these files!
520 # param 13 = javah command
521 # param 14 = override src roots to be passed into -sourcepath, ugly ugly ugly, do not use this!
522 # it is only here to workaround ugly things in the source code in the jdk that ought
523 # to be fixed instead!
524 ifdef $2_USED_BY
525 $$(error Attempting to add the package $2 from $3 which is already added with sources from $$($2_USED_BY))
526 endif
527 $2_USED_BY:=$3
528 # Remove the _the.package file to get the target bin dir for the classes in this package.
529 $2_PACKAGE_BDIR:=$(dir $2)
530 # The source roots separated with a path separator (: or ; depending on os)
531 # (The patsubst is necessary to trim away unnecessary spaces.)
532 ifneq ($(14),)
533 $2_SRCROOTSC:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$(14))))
534 else
535 $2_SRCROOTSC:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$3)))
536 endif
537 # Suffix the package path to the src roots, to get a list of all possible source locations
538 # for this package.
539 $2_PACKAGE_SDIRS:=$$(foreach i,$3,$$(subst $4,$$i,$$($2_PACKAGE_BDIR)))
540 # Use wildcard in all potential source locations to find the actual sources.
541 $2_PACKAGE_SRCS:=$$(filter-out $(11),$$(wildcard $$(addsuffix *.java,$$($2_PACKAGE_SDIRS))))
542 ifneq ($(12),)
543 # Filter on include file filter if set.
544 $2_PACKAGE_SRCS:=$$(filter $(12),$$($2_PACKAGE_SRCS))
545 endif
546 # Generate a proper package name from the file name.
547 $2_PACKAGE:=$(patsubst .%.,%,$(subst /,.,$(subst $4,,$(dir $2))))
548 # Use a javac server for this package?
549 $2_REMOTE:=$8
550
551 # Include previously generated information about what classes are output by this package
552 # and what sources were used for the compile.
553 -include $$($2_PACKAGE_BDIR)_the.package.d
554
555 # Include the notify, file, that exists if the package has been compiled during a previous make round.
556 # I.e. we are now dealing with a compile triggered by a pubapi change.
557 -include $$($2_PACKAGE_BDIR)_the.package.notify
558
559 # If the notify file existed, then $$($2_NOTIFIED) will be equal to true.
560 # Use this information to block dependency tracking for this package.
561 # This is necessary to cut the circular dependency chains that are so common in Java sources.
562
563 ifneq ($$($2_NOTIFIED),true)
564 # No need to block, since this package has not yet been recompiled.
565 # Thus include previously generated dependency information. (if it exists)
566 -include $$($2_PACKAGE_BDIR)_the.package.dddd
567 # else
568 # $$(info WAS NOTIFIED $2)
569 endif
570
571 # Should we create proper dependencies between packages?
572 ifneq ($7,)
573 # The flag: -XDpubapi:file=foo,package=mypack,notify writes a file foo that contains a
574 # database of the public api of the classes supplied on the command line and are
575 # inside the package mypack. If foo already exists, javac will only write to foo,
576 # if there is a change in the pubapi. I.e. we can use the timestamp of this file
577 # for triggering dependencies. "notify" means create a "file" suffixed with notify
578 # if the pubapi really changed.
579 $2_PUBAPI=-XDpubapi=file=$$($2_PACKAGE_BDIR)_the.package.api,notify,package=$$($2_PACKAGE)
580 # The flag: -XDnativeapi:file=foo,package=mypack,notify works similar to pubabi, but
581 # instead tracks native methods. This file can be used to trigger dependencies for
582 # native compilations.
583 $2_NATIVEAPI=-XDnativeapi=file=$$($2_PACKAGE_BDIR)_the.package.native,notify,package=$$($2_PACKAGE)
584 # The flag -XDdeps:file=foo.deps,groupon=package writes a foo.deps file containing packages dependencies:
585 # java.net : java.io java.lang
586 # I.e. the classes in .net depend on the public apis of java.io and java.lang
587 # The dependencies can be grouped on classes instead (groupon=class)
588 # java.net.Bar : java.io.Socket java.lang.String
589 $2_DEPS:=-XDdeps=file=$$($2_PACKAGE_BDIR)_the.package.deps,groupon=package
590 # The next command rewrites the deps output from javac into a proper makefile dependency.
591 # The dependencies are always to an .api file generated by the pubapi option above.
592 # This is necessary since java package dependencies are almost always circular.
593 $2_APPEND_DEPS:=($(CAT) $$($2_PACKAGE_BDIR)_the.package.deps | $(TR) '.' '/' | $(AWK) '{ print "$4/" $$$$3 }' | sort > $$($2_PACKAGE_BDIR)_the.package.ddd && $(GREP) -f $$($2_PACKAGE_BDIR)_the.package.ddd $5 | $(AWK) '{ print "$(dir $2)_the.package : " $$$$1 "_the.package.api" }' > $$($2_PACKAGE_BDIR)_the.package.dddd ; true)
594 else
595 # If not using dependencies, use $2 as fallback to trigger regeneration of javah header files.
596 # This will generate a surplus of header files, but this does not hurt compilation.
597 $2_NATIVEAPICHANGE_TRIGGER:=$2
598 $2_FETCH_NATIVEAPICHANGE_CLASSES:=$(CAT) $$($2_PACKAGE_BDIR)_the.package.now|$(GREP) -v '\$$$$'|$(SED) -e 's|$4/||g'|$(SED) 's|.class||g'| $(TR) '/' '.'
599 endif
600
601 # The _the.package file is dependent on the java files inside the package.
602 # Fill the _the.package file with a list of the java files and compile them
603 # to class files.
604 $2 : $$($2_PACKAGE_SRCS)
605 $(MKDIR) -p $$($2_PACKAGE_BDIR)
606 $(RM) $2.tmp
607 $$(call ListPathsSafely,$2_PACKAGE_SRCS,\n, >> $2.tmp)
608 $(ECHO) $$($2_PACKAGE_BDIR)*.class | $(GREP) -v \*.class | $(TR) ' ' '\n' > $$($2_PACKAGE_BDIR)_the.package.prev
609 $(RM) $$($2_PACKAGE_BDIR)*.class $$($2_PACKAGE_BDIR)*.notify $$($2_PACKAGE_BDIR)*.deleted
610 $(ECHO) Compiling `$(WC) $2.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files in package $(patsubst $4/%/,%,$(dir $2.tmp))
611 $9 $$($2_REMOTE) $$($2_DEPS) $$($2_PUBAPI) $$($2_NATIVEAPI) $(10) -implicit:none -sourcepath "$$($2_SRCROOTSC)" -d $4 @$2.tmp
612 $(ECHO) $$($2_PACKAGE_BDIR)*.class | $(GREP) -v \*.class | $(TR) ' ' '\n' > $$($2_PACKAGE_BDIR)_the.package.now
613 ($(GREP) -xvf $$($2_PACKAGE_BDIR)_the.package.now $$($2_PACKAGE_BDIR)_the.package.prev > $$($2_PACKAGE_BDIR)_the.package.deleted;true)
614 $(ECHO) $1_CLASSES += `$(CAT) $$($2_PACKAGE_BDIR)_the.package.now` | \
615 $(SED) 's/\$$$$/\$$$$\$$$$/g' > $$($2_PACKAGE_BDIR)_the.package.d
616 $(ECHO) $1_JAVAS += $$($2_PACKAGE_SRCS) >> $$($2_PACKAGE_BDIR)_the.package.d
617 $(ECHO) $2_NOTIFIED:=true > $$($2_PACKAGE_BDIR)_the.package.notify
618 $$($2_APPEND_DEPS)
619 $$($2_COPY_FILES)
620 $(MV) -f $2.tmp $2
621 endef 336 endef
622 337
623 define remove_string 338 define remove_string
624 $2 := $$(subst $1,,$$($2)) 339 $2 := $$(subst $1,,$$($2))
625 endef 340 endef
662 $(if $(12),$1_$(strip $(12))) 377 $(if $(12),$1_$(strip $(12)))
663 $(if $(13),$1_$(strip $(13))) 378 $(if $(13),$1_$(strip $(13)))
664 $(if $(14),$1_$(strip $(14))) 379 $(if $(14),$1_$(strip $(14)))
665 $(if $(15),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk)) 380 $(if $(15),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
666 381
667 # Extract the info from the java compiler setup. 382 # Extract the info from the java compiler setup.
668 $1_MODE := $$($$($1_SETUP)_MODE) 383 $1_REMOTE := $$($$($1_SETUP)_REMOTE)
669 ifneq (SINGLE_THREADED_BATCH,$$($1_MODE)) 384 $1_JVM := $$($$($1_SETUP)_JVM)
670 ifneq (MULTI_CORE_CONCURRENT,$$($1_MODE)) 385 $1_JAVAC := $$($$($1_SETUP)_JAVAC)
386 $1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS)
387 ifeq ($$($1_JAVAC),)
671 $$(error The Java compilation $1 refers to a non-existant java compiler setup $$($1_SETUP)) 388 $$(error The Java compilation $1 refers to a non-existant java compiler setup $$($1_SETUP))
672 endif 389 endif
673 endif 390
674 $1_USE_DEPS := $$($$($1_SETUP)_USE_DEPS) 391 # Handle addons and overrides.
675 $1_REMOTE := $$($$($1_SETUP)_REMOTE) 392 $1_SRC:=$$(call ADD_SRCS,$$($1_SRC))
676 $1_JVM := $$($$($1_SETUP)_JVM) 393 # Make sure the dirs exist.
677 $1_JAVAC := $$($$($1_SETUP)_JAVAC) 394 $$(shell $(MKDIR) -p $$($1_SRC) $$($1_BIN))
678 $1_JAVAH := $$($$($1_SETUP)_JAVAH) 395 # Find all files in the source trees.
679 $1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS) 396 $1_ALL_SRCS := $$(filter-out $(OVR_SRCS),$$(foreach i,$$($1_SRC),$$(shell $(FIND) $$i -type f)))
680 397 # Extract the java files.
681 # Handle addons and overrides. 398 ifneq ($$($1_EXCLUDE_FILES),)
682 $1_SRC:=$$(call ADD_SRCS,$$($1_SRC)) 399 $1_EXCLUDE_FILES_PATTERN:=$$(addprefix %,$$($1_EXCLUDE_FILES))
683 # Make sure the dirs exist. 400 endif
684 $$(shell $(MKDIR) -p $$($1_SRC) $$($1_BIN)) 401 $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$(filter %.java,$$($1_ALL_SRCS)))
685 # Find all files in the source trees. 402 ifneq ($$($1_INCLUDE_FILES),)
686 $1_ALL_SRCS := $$(filter-out $(OVR_SRCS),$$(foreach i,$$($1_SRC),$$(shell $(FIND) $$i -type f))) 403 $1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
687 # Extract the java files. 404 $1_SRCS := $$(filter $$($1_INCLUDE_FILES), $$($1_SRCS))
688 ifneq ($$($1_EXCLUDE_FILES),) 405 endif
689 $1_EXCLUDE_FILES_PATTERN:=$$(addprefix %,$$($1_EXCLUDE_FILES)) 406
690 endif 407 # Now we have a list of all java files to compile: $$($1_SRCS)
691 $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$(filter %.java,$$($1_ALL_SRCS))) 408
692 ifneq ($$($1_INCLUDE_FILES),) 409 # Create the corresponding smart javac wrapper command line.
693 $1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES))) 410 $1_SJAVAC_ARGS:=$$(addprefix -x ,$$(addsuffix .*,$$(subst /,.,$$($1_EXCLUDES)))) \
694 $1_SRCS := $$(filter $$($1_INCLUDE_FILES), $$($1_SRCS)) 411 $$(addprefix -i ,$$(addsuffix .*,$$(subst /,.,$$($1_INCLUDES)))) \
695 endif 412 $$(addprefix -xf *,$$(strip $$($1_EXCLUDE_FILES))) \
696 $1_PKGS := $$(sort $$(dir $$($1_SRCS))) 413 $$(addprefix -if *,$$(strip $$($1_INCLUDE_FILES))) \
697 # Remove the source root from each found path. 414 -src "$$(subst $$(SPACE),$$(PATH_SEP),$$(strip $$($1_SRC)))"
698 $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$1_PKGS))) 415
699 $1_PKGS := $$(sort $$($1_PKGS)) 416 # Prepend the source/bin path to the filter expressions.
700 # There can be only a single bin dir root, no need to foreach over the roots. 417 ifneq ($$($1_INCLUDES),)
701 $1_BINS := $$(shell $(FIND) $$($1_BIN) -name "*.class") 418 $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
702 419 $1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
703 # Now we have a list of all java files to compile: $$($1_SRCS) 420 endif
704 # and we have a list of all existing class files: $$($1_BINS) 421 ifneq ($$($1_EXCLUDES),)
705 422 $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
706 # Create the corresponding smart javac wrapper command line. 423 $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
707 $1_SJAVAC_ARGS:=$$(addprefix -x ,$$(addsuffix .*,$$(subst /,.,$$($1_EXCLUDES)))) \ 424 endif
708 $$(addprefix -i ,$$(addsuffix .*,$$(subst /,.,$$($1_INCLUDES)))) \ 425
709 $$(addprefix -xf *,$$(strip $$($1_EXCLUDE_FILES))) \ 426 # Find all files to be copied from source to bin.
710 $$(addprefix -if *,$$(strip $$($1_INCLUDE_FILES))) -src $$(subst $$(SPACE),$$(PATH_SEP),$$(strip $$($1_SRC))) 427 ifneq (,$$($1_COPY))
711 428 # Rewrite list of patterns into a find statement.
712 # Prepend the source/bin path to the filter expressions. 429 $1_COPY_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_COPY))
713 ifneq ($$($1_INCLUDES),) 430 # Search for all files to be copied.
714 $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES)))) 431 $1_ALL_COPIES := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_COPY_PATTERN) \) -a -type f))
715 $1_PKG_INCLUDES := $$(addprefix /,$$(addsuffix /%,$$($1_INCLUDES))) 432 # Copy these explicitly
716 $1_BIN_INCLUDES := $$(addprefix $$($1_BIN)/,$$(addsuffix /%,$$($1_INCLUDES))) 433 $1_ALL_COPIES += $$($1_COPY_FILES)
717 $1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS)) 434 # Copy must also respect filters.
718 $1_PKGS := $$(filter $$($1_PKG_INCLUDES),$$($1_PKGS)) 435 ifneq (,$$($1_INCLUDES))
719 $1_BINS := $$(filter $$($1_BIN_INCLUDES),$$($1_BINS)) 436 $1_ALL_COPIES := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_COPIES))
720 endif 437 endif
721 ifneq ($$($1_EXCLUDES),) 438 ifneq (,$$($1_EXCLUDES))
722 $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES)))) 439 $1_ALL_COPIES := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_COPIES))
723 $1_PKG_EXCLUDES := $$(addprefix /,$$(addsuffix /%,$$($1_EXCLUDES))) 440 endif
724 $1_BIN_EXCLUDES := $$(addprefix $$($1_BIN)/,$$(addsuffix /%,$$($1_EXCLUDES))) 441 ifneq (,$$($1_EXCLUDE_FILES))
725 $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS)) 442 $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_COPIES))
726 $1_PKGS := $$(filter-out $$($1_PKG_EXCLUDES),$$($1_PKGS)) 443 endif
727 $1_BINS := $$(filter-out $$($1_BIN_EXCLUDES),$$($1_BINS)) 444 # All files below META-INF are always copied.
728 endif 445 $1_ALL_COPIES += $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i/META-INF -type f 2> /dev/null))
729 446 ifneq (,$$($1_ALL_COPIES))
730 # Find all files to be copied from source to bin. 447 # Yep, there are files to be copied!
731 ifneq (,$$($1_COPY)) 448 $1_ALL_COPY_TARGETS:=
732 # Rewrite list of patterns into a find statement. 449 $$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i)))
733 $1_COPY_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_COPY)) 450 # Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files!
734 # Search for all files to be copied. 451 endif
735 $1_ALL_COPIES := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_COPY_PATTERN) \) -a -type f)) 452 endif
736 # Copy these explicitly 453
737 $1_ALL_COPIES += $$($1_COPY_FILES) 454 # Find all property files to be copied and cleaned from source to bin.
738 # Copy must also respect filters. 455 ifneq (,$$($1_CLEAN))
739 ifneq (,$$($1_INCLUDES)) 456 # Rewrite list of patterns into a find statement.
740 $1_ALL_COPIES := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_COPIES)) 457 $1_CLEAN_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_CLEAN))
741 endif 458 # Search for all files to be copied.
742 ifneq (,$$($1_EXCLUDES)) 459 $1_ALL_CLEANS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_CLEAN_PATTERN) \) -a -type f))
743 $1_ALL_COPIES := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_COPIES)) 460 # Copy and clean must also respect filters.
744 endif 461 ifneq (,$$($1_INCLUDES))
745 ifneq (,$$($1_EXCLUDE_FILES)) 462 $1_ALL_CLEANS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_CLEANS))
746 $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_COPIES)) 463 endif
747 endif 464 ifneq (,$$($1_EXCLUDES))
748 # All files below META-INF are always copied. 465 $1_ALL_CLEANS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_CLEANS))
749 $1_ALL_COPIES += $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i/META-INF -type f 2> /dev/null)) 466 endif
750 ifneq (,$$($1_ALL_COPIES)) 467 ifneq (,$$($1_EXCLUDE_FILES))
751 # Yep, there are files to be copied! 468 $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_CLEANS))
752 $1_ALL_COPY_TARGETS:= 469 endif
753 $$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i))) 470 ifneq (,$$($1_ALL_CLEANS))
754 # Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files! 471 # Yep, there are files to be copied and cleaned!
755 endif 472 $1_ALL_COPY_CLEAN_TARGETS:=
756 endif 473 $$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_copy_and_clean,$1,$$i)))
757 474 # Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
758 # Find all property files to be copied and cleaned from source to bin. 475 endif
759 ifneq (,$$($1_CLEAN)) 476 endif
760 # Rewrite list of patterns into a find statement.
761 $1_CLEAN_PATTERN:=$(FALSE_FIND_PATTERN) $$(patsubst %,$(SPACE)-o$(SPACE)-name$(SPACE)$(DQUOTE)*%$(DQUOTE),$$($1_CLEAN))
762 # Search for all files to be copied.
763 $1_ALL_CLEANS := $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i \( $$($1_CLEAN_PATTERN) \) -a -type f))
764 # Copy and clean must also respect filters.
765 ifneq (,$$($1_INCLUDES))
766 $1_ALL_CLEANS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_CLEANS))
767 endif
768 ifneq (,$$($1_EXCLUDES))
769 $1_ALL_CLEANS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_CLEANS))
770 endif
771 ifneq (,$$($1_EXCLUDE_FILES))
772 $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_CLEANS))
773 endif
774 ifneq (,$$($1_ALL_CLEANS))
775 # Yep, there are files to be copied and cleaned!
776 $1_ALL_COPY_CLEAN_TARGETS:=
777 $$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_copy_and_clean,$1,$$i)))
778 # Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
779 endif
780 endif
781
782 # Find all the directories that contain java sources, each directory
783 # corresponds to a package because we expect the source
784 # code to be organized in this standardized way!
785 $1_SDIRS := $$(sort $$(dir $$($1_SRCS)))
786 # Now prefix each package with the bin root.
787 $1_BDIRS := $$(foreach i,$$($1_PKGS),$$(addprefix $$($1_BIN),$$i))
788 # Now create a list of the packages that are about to compile. This list is
789 # later used to filter out dependencies that point outside of this set.
790 $$(shell $(RM) $$($1_BIN)/_the.list_of_packages)
791 $$(eval $$(call ListPathsSafelyNow,$1_BDIRS,\n, >> $$($1_BIN)/_the.list_of_packages))
792
793 ifeq ($$($1_MODE),SINGLE_THREADED_BATCH)
794 # Ok, we will feed all the found java files into a single javac invocation.
795 # There can be no dependency checking, nor incremental builds. It is
796 # the best we can do with the old javac. If the javac supports a javac server
797 # then we can use the javac server.
798
799 # We can depend on this target file to trigger a regeneration of all the sources
800 $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/_the.batch
801 477
802 # Prep the source paths. 478 # Prep the source paths.
803 ifneq ($$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE),) 479 ifneq ($$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE),)
804 $$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE))) 480 $$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE)))
805 else 481 else
806 $$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_SRC))) 482 $$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_SRC)))
807 endif 483 endif
808 484
809 ifneq (,$$($1_HEADERS)) 485 ifneq (,$$($1_HEADERS))
810 $1_HEADERS_ARG := -h $$($1_HEADERS) 486 $1_HEADERS_ARG := -h $$($1_HEADERS)
811 endif 487 endif
812 488
813 # Create a sed expression to remove the source roots and to replace / with . 489 # Create a sed expression to remove the source roots and to replace / with .
814 # and remove .java at the end. 490 # and remove .java at the end.
815 $1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g' 491 $1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g'
816 492
817 # Here is the batch rules that depends on all the sources. 493 ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
818 $$($1_BIN)/_the.batch: $$($1_SRCS) $$($1_DEPENDS) 494 # Using sjavac to compile.
819 $(MKDIR) -p $$(@D) 495 $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/javac_state
820 $(RM) $$($1_BIN)/_the.batch $$($1_BIN)/_the.batch.tmp 496
821 $$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp) 497 $$($1_BIN)/javac_state: $$($1_SRCS) $$($1_DEPENDS)
822 $(ECHO) Compiling `$(WC) $$($1_BIN)/_the.batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files in batch $1 498 $(MKDIR) -p $$(@D)
823 ifeq ($$($1_NOSJAVAC),) 499 $$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp)
824 ifeq ($$(ENABLE_SJAVAC),yes) 500 $(ECHO) Compiling $1
825 mkdir -p $$($1_BIN)_sjavac 501 $$($1_JVM) $$(word 1,$$($1_JAVAC)) com.sun.tools.sjavac.Main \
826 $$($1_JVM) $$(word 1,$$($1_JAVAC)) com.sun.tools.javac.smart.Main $$($1_SJAVAC_ARGS) -mfl $$($1_BIN)/_the.batch.tmp -d $$($1_BIN)_sjavac 502 $$($1_REMOTE) $$($1_SJAVAC_ARGS) --permit-unidentified-artifacts -mfl $$($1_BIN)/_the.batch.tmp \
827 endif 503 $$($1_FLAGS) \
828 endif 504 -implicit:none -d $$($1_BIN) $$($1_HEADERS_ARG)
829 ($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) -implicit:none -sourcepath "$$($1_SRCROOTSC)" -d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.batch.tmp && \ 505 else
830 $(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch) 506 # Using plain javac to batch compile everything.
831 else 507 $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/_the.batch
832 # Ok, we have a modern javac server running! 508
833 # Since a single Java file can generate zero to an infinity number of .class files 509 # When not using sjavac, pass along all sources to javac using an @file.
834 # the exact number and names of the .class files will only be known after the compile. 510 $$($1_BIN)/_the.batch: $$($1_SRCS) $$($1_DEPENDS)
835 # Thus after the compile, a list of the generated classes will be stored in _the.package.d 511 $(MKDIR) -p $$(@D)
836 # which is included by the makefile during the next compile. These .d files will 512 $(RM) $$($1_BIN)/_the.batch $$($1_BIN)/_the.batch.tmp
837 # add the generated class names to the BUILD_MYPACKAGE_CLASSES variable and used java file names 513 $$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.batch.tmp)
838 # to the BUILD_MYPACKAGE_JAVAS variable. 514 $(ECHO) Compiling `$(WC) $$($1_BIN)/_the.batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files for $1
839 $1_CLASSES := 515 ($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) \
840 $1_JAVAS := 516 -implicit:none -sourcepath "$$($1_SRCROOTSC)" \
841 # Create a file in each package that represents the package dependency. 517 -d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.batch.tmp && \
842 # This file (_the.package) will also contain a list of the source files 518 $(MV) $$($1_BIN)/_the.batch.tmp $$($1_BIN)/_the.batch)
843 # to be compiled for this package. 519 endif
844 $1 := $$(sort $$(patsubst %,%_the.package,$$($1_BDIRS))) 520
845 # Now call add_java_package for each package to create the dependencies. 521 # Check if a jar file was specified, then setup the rules for the jar.
846 $$(foreach p,$$($1),$$(eval $$(call add_java_package,$1,$$p,$$($1_SRC),$$($1_BIN),$$($1_BIN)/_the.list_of_packages,NOTUSED,$$($1_USE_DEPS),$$($1_REMOTE),$$($1_JVM) $$($1_JAVAC),$$($1_FLAGS),$$($1_EXCLUDE_FILES_PATTERN) $(OVR_SRCS),$$($1_INCLUDE_FILES),$$($1_JVM) $$($1_JAVAH),$$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE)))) 522 ifneq (,$$($1_JAR))
847 # All dependencies are setup, now we only need to depend on $1 (aka $(BUILD_MYPACKAGE)) 523 # If no suffixes was explicitly set for this jar file.
848 # and they will automatically be built! 524 # Use class and the cleaned/copied properties file suffixes as the default
849 525 # for the types of files to be put into the jar.
850 # Now add on any files to copy targets 526 ifeq (,$$($1_SUFFIXES))
851 $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1) 527 $1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY)
852 # Remove the set of found classes from the set of all previously known classes 528 endif
853 # and the remainder is the set of missing classes. 529
854 $1_MISSING_CLASSES:=$$(filter-out $$($1_BINS),$$($1_CLASSES)) 530 $$(eval $$(call SetupArchive,ARCHIVE_$1,$$($1),\
855 $1_PKGS_MISSING_CLASSES:=$$(sort $$(dir $$($1_MISSING_CLASSES))) 531 SRCS:=$$($1_BIN),\
856 # Remove the set of found java files from the set of all previously known java files 532 SUFFIXES:=$$($1_SUFFIXES),\
857 # the remainder is Java files that have gone missing. 533 EXCLUDE:=$$($1_EXCLUDES),\
858 $1_MISSING_JAVAS:=$$(filter-out $$($1_SRCS),$$($1_JAVAS)) 534 INCLUDES:=$$($1_INCLUDES),\
859 $1_PKGS_MISSING_JAVAS:=$$(sort $$(dir $$($1_MISSING_JAVAS))) 535 EXTRA_FILES:=$$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS),\
860 # Remove each source root from the found paths. 536 JAR:=$$($1_JAR),\
861 $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$1_PKGS_MISSING_JAVAS))) 537 JARMAIN:=$$($1_JARMAIN),\
862 # Finally remove duplicates and prefix with the binary path instead. 538 MANIFEST:=$$($1_MANIFEST),\
863 $1_PKGS_MISSING_JAVAS:= $$(addprefix $$($1_BIN),$$(sort $$($1_PKGS_MISSING_JAVAS))) 539 EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR),\
864 540 JARINDEX:=$$($1_JARINDEX),\
865 # Remove the set of all theoretical classes from the set of found classes. 541 HEADERS:=$$($1_HEADERS),\
866 # the remainder is the set of superfluous classes. 542 SETUP:=$$($1_SETUP)))
867 $1_SUPERFLUOUS_CLASSES:=$$(sort $$(filter-out $$($1_CLASSES),$$($1_BINS))) 543 endif
868 $1_PKGS_SUPERFLUOUS_CLASSES:=$$(sort $$(dir $$($1_SUPERFLUOUS_CLASSES))) 544
869 545 # Check if a srczip was specified, then setup the rules for the srczip.
870 # Now delete the _the.package files inside the problematic dirs. 546 ifneq (,$$($1_SRCZIP))
871 # This will force a rebuild of these packages! 547 $$(eval $$(call SetupZipArchive,ARCHIVE_$1,\
872 $1_FOO:=$$(sort $$($1_PKGS_MISSING_CLASSES) \
873 $$($1_PKGS_SUPERFLUOUS_CLASSES) \
874 $$($1_PKGS_MISSING_JAVAS))
875 # ifneq (,$$($1_FOO))
876 # $$(info MESSED UP PACKAGES $$($1_FOO))
877 # endif
878
879 $$(shell $(RM) $$(addsuffix _the.package,$$(sort $$($1_PKGS_MISSING_CLASSES) \
880 $$($1_PKGS_SUPERFLUOUS_CLASSES) \
881 $$($1_PKGS_MISSING_JAVAS))))
882
883 # Normal makefile dependencies based on timestamps will detect the normal use case
884 # when Java files are simply added or modified.
885 endif
886
887 ifneq (,$$($1_JAR))
888
889 ifeq (,$$($1_SUFFIXES))
890 $1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY)
891 endif
892
893 # A jar file was specified. Set it up.
894 $$(eval $$(call SetupArchive,ARCHIVE_$1,$$($1),\
895 SRCS:=$$($1_BIN),\
896 SUFFIXES:=$$($1_SUFFIXES),\
897 EXCLUDE:=$$($1_EXCLUDES),\
898 INCLUDES:=$$($1_INCLUDES),\
899 EXTRA_FILES:=$$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS),\
900 JAR:=$$($1_JAR),\
901 JARMAIN:=$$($1_JARMAIN),\
902 MANIFEST:=$$($1_MANIFEST),\
903 EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR),\
904 JARINDEX:=$$($1_JARINDEX),\
905 HEADERS:=$$($1_HEADERS),\
906 SETUP:=$$($1_SETUP)))
907 endif
908
909 ifneq (,$$($1_SRCZIP))
910 # A srczip file was specified. Set it up.
911 $$(eval $$(call SetupZipArchive,ARCHIVE_$1,\
912 SRC:=$$($1_SRC),\ 548 SRC:=$$($1_SRC),\
913 ZIP:=$$($1_SRCZIP),\ 549 ZIP:=$$($1_SRCZIP),\
914 INCLUDES:=$$($1_INCLUDES),\ 550 INCLUDES:=$$($1_INCLUDES),\
915 EXCLUDES:=$$($1_EXCLUDES),\ 551 EXCLUDES:=$$($1_EXCLUDES),\
916 EXCLUDE_FILES:=$$($1_EXCLUDE_FILES))) 552 EXCLUDE_FILES:=$$($1_EXCLUDE_FILES)))
917 endif 553 endif
918 554
919 endef 555 endef

mercurial