JavaCompilation.gmk revision 1790:b2a9c5ef147e
1# 2# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. 3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4# 5# This code is free software; you can redistribute it and/or modify it 6# under the terms of the GNU General Public License version 2 only, as 7# published by the Free Software Foundation. Oracle designates this 8# particular file as subject to the "Classpath" exception as provided 9# by Oracle in the LICENSE file that accompanied this code. 10# 11# This code is distributed in the hope that it will be useful, but WITHOUT 12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14# version 2 for more details (a copy is included in the LICENSE file that 15# accompanied this code). 16# 17# You should have received a copy of the GNU General Public License version 18# 2 along with this work; if not, write to the Free Software Foundation, 19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20# 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 23# questions. 24# 25 26# When you read this source. Remember that $(sort ...) has the side effect 27# of removing duplicates. It is actually this side effect that is 28# desired whenever sort is used below! 29 30ifndef _JAVA_COMPILATION_GMK 31_JAVA_COMPILATION_GMK := 1 32 33ifeq (,$(_MAKEBASE_GMK)) 34 $(error You must include MakeBase.gmk prior to including JavaCompilation.gmk) 35endif 36 37# Java compilation needs SetupJarArchive and/or SetupZipArchive, if we're 38# generating a jar file or a source zip. 39include JarArchive.gmk 40include ZipArchive.gmk 41 42# Setup make rules for defining a Java compiler, which is needed to compile 43# Java code. This rule generates no output. 44# 45# Parameter 1 is the name of the compiler definition. This name needs to be 46# passed to SetupJavaCompilation. This name is used as variable prefix. 47# 48# Remaining parameters are named arguments. These include: 49# JVM:=The jvm used to run the javac/javah command 50# JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out 51# FLAGS:=Flags to be supplied to javac 52# SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here 53# SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above. 54# DISABLE_SJAVAC:=Set to true if this setup does not support sjavac 55SetupJavaCompiler = $(NamedParamsMacroTemplate) 56define SetupJavaCompilerBody 57 # The port file contains the tcp/ip on which the server listens 58 # and the cookie necessary to talk to the server. 59 $1_SJAVAC_PORTFILE:=$$($1_SERVER_DIR)/server.port 60 # You can use a different JVM to run the background javac server. 61 ifeq ($$($1_SERVER_JVM),) 62 # It defaults to the same JVM that is used to start the javac command. 63 $1_SERVER_JVM:=$$($1_JVM) 64 endif 65endef 66 67define add_file_to_copy 68 # param 1 = BUILD_MYPACKAGE 69 # parma 2 = The source file to copy. 70 $2_TARGET:=$2 71 # Remove the source prefix. 72 $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET))) 73 # To allow for automatic overrides, do not create a rule for a target file that 74 # already has one 75 ifneq ($$($1_COPY_$$($2_TARGET)), 1) 76 $1_COPY_$$($2_TARGET) := 1 77 # Now we can setup the dependency that will trigger the copying. 78 $$($1_BIN)$$($2_TARGET) : $2 79 $(MKDIR) -p $$(@D) 80 $(CP) $$< $$@ 81 $(CHMOD) -f ug+w $$@ 82 83 # And do not forget this target 84 $1_ALL_COPY_TARGETS += $$($1_BIN)$$($2_TARGET) 85 endif 86endef 87 88# This macro is used only for properties files that are to be 89# copied over to the classes directory in cleaned form: 90# Previously this was inconsistently done in different repositories. 91# This is the new clean standard. Though it is to be superseded by 92# a standard annotation processor from with sjavac. 93# 94# An empty echo ensures that the input to sed always ends with a newline. 95# Certain implementations (e.g. Solaris) will skip the last line without 96# it. 97# 98# The sed expression does this: 99# 1. Add a backslash before any :, = or ! that do not have a backslash already. 100# 2. Apply the file unicode2x.sed which does a whole bunch of \u00XX to \xXX 101# conversions. 102# 3. Delete all lines starting with #. 103# 4. Delete empty lines. 104# 5. Append lines ending with \ with the next line. 105# 6. Remove leading and trailing white space. Note that tabs must be explicit 106# as sed on macosx does not understand '\t'. 107# 7. Replace the first \= with just =. 108# 8. Finally it's all sorted to create a stable output. 109# 110# It is assumed that = is the character used for separating names and values. 111define add_file_to_clean 112 # param 1 = BUILD_MYPACKAGE 113 # parma 2 = The source file to copy and clean. 114 $2_TARGET:=$2 115 # Remove the source prefix. 116 $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET))) 117 # Now we can setup the depency that will trigger the copying. 118 # To allow for automatic overrides, do not create a rule for a target file that 119 # already has one 120 ifneq ($$($1_CLEAN_$$($2_TARGET)), 1) 121 $1_CLEAN_$$($2_TARGET) := 1 122 $$($1_BIN)$$($1_MODULE_SUBDIR)$$($2_TARGET) : $2 123 $(MKDIR) -p $$(@D) 124 export LC_ALL=C ; ( $(CAT) $$< && $(ECHO) "" ) \ 125 | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \ 126 -e 's/\([^\\]\)!/\1\\!/g' -e 's/^[ ]*#.*/#/g' \ 127 | $(SED) -f "$(SRC_ROOT)/make/common/support/unicode2x.sed" \ 128 | $(SED) -e '/^#/d' -e '/^$$$$/d' \ 129 -e :a -e '/\\$$$$/N; s/\\\n//; ta' \ 130 -e 's/^[ ]*//;s/[ ]*$$$$//' \ 131 -e 's/\\=/=/' \ 132 | $(SORT) > $$@ 133 $(CHMOD) -f ug+w $$@ 134 135 # And do not forget this target 136 $1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($2_TARGET) 137 endif 138endef 139 140define remove_string 141 $2 := $$(subst $1,,$$($2)) 142endef 143 144# Setup make rules for compiling Java source code to class files and/or a 145# resulting jar file. 146# 147# Parameter 1 is the name of the rule. This name is used as variable prefix, 148# and the targets generated are listed in a variable by that name. 149# 150# Remaining parameters are named arguments. These include: 151# SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC 152# JVM:=path to ..bin/java 153# ADD_JAVAC_FLAGS:=javac flags to append to the default ones. 154# SRC:=one or more directories to search for sources. The order of the source roots 155# is significant. The first found file of a certain name has priority. 156# BIN:=store classes here 157# CLASSPATH:=a list of additional entries to set as classpath to javac 158# INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages. 159# EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages. 160# COPY:=.prp means copy all prp files to the corresponding package in BIN. 161# COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo 162# CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN. 163# CLEAN_FILES:=myapp/foo/setting.txt means clean this file over to the package myapp/foo 164# SRCZIP:=Create a src.zip based on the found sources and copied files. 165# INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file! 166# EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file! 167# "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found. 168# HEADERS:=path to directory where all generated c-headers are written. 169# DEPENDS:=Extra dependecy 170# DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit. 171# KEEP_DUPS:=Do not remove duplicate file names from different source roots. 172SetupJavaCompilation = $(NamedParamsMacroTemplate) 173define SetupJavaCompilationBody 174 175 # Verify arguments 176 ifeq ($$($1_BIN),) 177 $$(error Must specify BIN (in $1)) 178 endif 179 180 # Extract the info from the java compiler setup. 181 $1_JVM := $$($$($1_SETUP)_JVM) 182 $1_JAVAC := $$($$($1_SETUP)_JAVAC) 183 $1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS) 184 ifneq ($$($1_CLASSPATH), ) 185 $1_FLAGS += -cp $$(call PathList, $$($1_CLASSPATH)) 186 endif 187 ifeq ($$($1_JAVAC),) 188 $$(error The Java compilation $1 refers to a non-existant java compiler setup $$($1_SETUP)) 189 endif 190 $1_SJAVAC_PORTFILE := $$($$($1_SETUP)_SJAVAC_PORTFILE) 191 $1_SERVER_JVM := $$($$($1_SETUP)_SERVER_JVM) 192 $1_DISABLE_SJAVAC := $$($$($1_SETUP)_DISABLE_SJAVAC) 193 194 # Make sure the dirs exist. 195 $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupJavaCompilation $1 contains missing directory >$$d<))) 196 $$(call MakeDir,$$($1_BIN)) 197 # Add all source roots to the find cache since we are likely going to run find 198 # on these more than once. The cache will only be updated if necessary. 199 $$(eval $$(call FillCacheFind,$$($1_SRC))) 200 # Find all files in the source trees. Preserve order of source roots so that 201 # the first version in case of multiple instances of the same file is selected. 202 # CacheFind does not preserve order so need to call it for each root. 203 $1_ALL_SRCS += $$(foreach s, $$($1_SRC), $$(call CacheFind, $$(s))) 204 # Extract the java files. 205 ifneq ($$($1_EXCLUDE_FILES),) 206 $1_EXCLUDE_FILES_PATTERN:=$$(addprefix %,$$($1_EXCLUDE_FILES)) 207 endif 208 $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$(filter %.java,$$($1_ALL_SRCS))) 209 ifneq ($$($1_INCLUDE_FILES),) 210 $1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES))) 211 $1_SRCS := $$(filter $$($1_INCLUDE_FILES), $$($1_SRCS)) 212 endif 213 214 # Prepend the source/bin path to the filter expressions. 215 ifneq ($$($1_INCLUDES),) 216 $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES)))) 217 $1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS)) 218 endif 219 ifneq ($$($1_EXCLUDES),) 220 $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES)))) 221 $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS)) 222 endif 223 224 ifneq ($$($1_KEEP_DUPS), true) 225 # Remove duplicate source files by keeping the first found of each duplicate. 226 # This allows for automatic overrides with custom or platform specific versions 227 # source files. 228 # 229 # For the smart javac wrapper case, add each removed file to an extra exclude 230 # file list to prevent sjavac from finding duplicate sources. 231 $1_SRCS := $$(strip $$(foreach s, $$($1_SRCS), \ 232 $$(eval relative_src := $$(call remove-prefixes, $$($1_SRC), $$(s))) \ 233 $$(if $$($1_$$(relative_src)), \ 234 $$(eval $1_SJAVAC_EXCLUDE_FILES += $$(s)), \ 235 $$(eval $1_$$(relative_src) := 1) $$(s)))) 236 endif 237 238 ifeq ($$(strip $$($1_SRCS)), ) 239 $$(error No source files found for $1) 240 endif 241 242 $1_SAFE_NAME := $$(strip $$(subst /,_, $1)) 243 244 # Create the corresponding smart javac wrapper command line. 245 $1_SJAVAC_ARGS:=$$(addprefix -x ,$$(addsuffix /*,$$($1_EXCLUDES))) \ 246 $$(addprefix -i ,$$(addsuffix /*,$$($1_INCLUDES))) \ 247 $$(addprefix -xf *,$$(strip $$($1_EXCLUDE_FILES) $$($1_SJAVAC_EXCLUDE_FILES))) \ 248 $$(addprefix -if *,$$(strip $$($1_INCLUDE_FILES))) \ 249 -src $$(call PathList, $$($1_SRC)) 250 251 # All files below META-INF are always copied. 252 $1_ALL_COPIES := $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS)) 253 # Find all files to be copied from source to bin. 254 ifneq (,$$($1_COPY)$$($1_COPY_FILES)) 255 # Search for all files to be copied. 256 $1_ALL_COPIES += $$(filter $$(addprefix %,$$($1_COPY)),$$($1_ALL_SRCS)) 257 # Copy these explicitly 258 $1_ALL_COPIES += $$($1_COPY_FILES) 259 endif 260 # Copy must also respect filters. 261 ifneq (,$$($1_INCLUDES)) 262 $1_ALL_COPIES := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_COPIES)) 263 endif 264 ifneq (,$$($1_EXCLUDES)) 265 $1_ALL_COPIES := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_COPIES)) 266 endif 267 ifneq (,$$($1_EXCLUDE_FILES)) 268 $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_COPIES)) 269 endif 270 ifneq (,$$($1_ALL_COPIES)) 271 # Yep, there are files to be copied! 272 $1_ALL_COPY_TARGETS:= 273 $$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i))) 274 # Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files! 275 endif 276 277 # Find all property files to be copied and cleaned from source to bin. 278 ifneq (,$$($1_CLEAN)$$($1_CLEAN_FILES)) 279 # Search for all files to be copied. 280 $1_ALL_CLEANS := $$(filter $$(addprefix %,$$($1_CLEAN)),$$($1_ALL_SRCS)) 281 # Clean these explicitly 282 $1_ALL_CLEANS += $$($1_CLEAN_FILES) 283 # Copy and clean must also respect filters. 284 ifneq (,$$($1_INCLUDES)) 285 $1_ALL_CLEANS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_CLEANS)) 286 endif 287 ifneq (,$$($1_EXCLUDES)) 288 $1_ALL_CLEANS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_CLEANS)) 289 endif 290 ifneq (,$$($1_EXCLUDE_FILES)) 291 $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_CLEANS)) 292 endif 293 ifneq (,$$($1_ALL_CLEANS)) 294 # Yep, there are files to be copied and cleaned! 295 $1_ALL_COPY_CLEAN_TARGETS:= 296 $$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_clean,$1,$$i))) 297 # Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files! 298 endif 299 endif 300 301 # Create a sed expression to remove the source roots and to replace / with . 302 # and remove .java at the end. 303 $1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g' 304 305 # Create SJAVAC variable from JAVAC variable. Expects $1_JAVAC to be 306 # "bootclasspathprepend -cp .../javac.jar com.sun.tools.javac.Main" 307 # and javac is simply replaced with sjavac. 308 $1_SJAVAC:=$$(subst com.sun.tools.javac.Main,com.sun.tools.sjavac.Main,$$($1_JAVAC)) 309 310 # Set the $1_REMOTE to spawn a background javac server. 311 $1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst \ 312 $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC)))) 313 314 $1_COMPILE_TARGET := $$($1_BIN)/_the.$1_batch 315 316 ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes) 317 # Using sjavac to compile. 318 319 ifneq (,$$($1_HEADERS)) 320 $1_HEADERS_ARG := -h $$($1_HEADERS) 321 endif 322 323 $1_VARDEPS := $$($1_JVM) $$($1_SJAVAC) $$($1_SJAVAC_ARGS) $$($1_FLAGS) \ 324 $$($1_HEADERS_ARG) $$($1_BIN) $$($1_EXCLUDES) $$($1_INCLUDES) \ 325 $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES) 326 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_BIN)/_the.$1.vardeps) 327 328 $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE) 329 $(MKDIR) -p $$(@D) $$(dir $$($1_SJAVAC_PORTFILE)) 330 $$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp)) 331 $(ECHO) Compiling $1 332 $(call LogFailures, $$($1_BIN)/_the.$$($1_SAFE_NAME)_batch.log, $$($1_SAFE_NAME), \ 333 $$($1_JVM) $$($1_SJAVAC) \ 334 $$($1_REMOTE) \ 335 -j 1 \ 336 --permit-unidentified-artifacts \ 337 --permit-sources-without-package \ 338 --compare-found-sources $$@.tmp \ 339 --log=$(LOG_LEVEL) \ 340 --state-dir=$$($1_BIN) \ 341 $$($1_SJAVAC_ARGS) \ 342 $$($1_FLAGS) \ 343 $$($1_HEADERS_ARG) \ 344 -d $$($1_BIN)) && \ 345 $(MV) $$@.tmp $$@ 346 # Create a pubapi file that only changes when the pubapi changes. Dependent 347 # compilations can use this file to only get recompiled when pubapi has changed. 348 # Grep returns 1 if no matching lines are found. Do not fail for this. 349 $(GREP) -e "^I" $$($1_BIN)/javac_state > $$($1_BIN)/_the.$1_pubapi.tmp \ 350 || test "$$$$?" = "1" 351 if [ ! -f $$($1_BIN)/_the.$1_pubapi ] \ 352 || [ "`$(DIFF) $$($1_BIN)/_the.$1_pubapi $$($1_BIN)/_the.$1_pubapi.tmp`" != "" ]; then \ 353 $(MV) $$($1_BIN)/_the.$1_pubapi.tmp $$($1_BIN)/_the.$1_pubapi; \ 354 fi 355 356 else 357 # Using plain javac to batch compile everything. 358 359 # When building in batch, put headers in a temp dir to filter out those that actually 360 # changed before copying them to the real header dir. 361 ifneq (,$$($1_HEADERS)) 362 $1_HEADERS_ARG := -h $$($1_HEADERS).$1.tmp 363 364 $$($1_HEADERS)/_the.$1_headers: $$($1_COMPILE_TARGET) 365 $(MKDIR) -p $$(@D) 366 if [ -d "$$($1_HEADERS).$1.tmp" ]; then \ 367 for f in `ls $$($1_HEADERS).$1.tmp`; do \ 368 if [ ! -f "$$($1_HEADERS)/$$$$f" ] \ 369 || [ "`$(DIFF) $$($1_HEADERS)/$$$$f $$($1_HEADERS).$1.tmp/$$$$f`" != "" ]; then \ 370 $(CP) -f $$($1_HEADERS).$1.tmp/$$$$f $$($1_HEADERS)/$$$$f; \ 371 fi; \ 372 done; \ 373 fi 374 $(RM) -r $$($1_HEADERS).$1.tmp 375 $(TOUCH) $$@ 376 377 $1_HEADER_TARGETS := $$($1_HEADERS)/_the.$1_headers 378 endif 379 380 $1_VARDEPS := $$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) $$($1_BIN) \ 381 $$($1_HEADERS_ARG) $$($1_EXCLUDES) $$($1_INCLUDES) \ 382 $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES) 383 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_BIN)/_the.$1.vardeps) 384 385 ifeq ($$($1_DISABLE_SJAVAC)x$(ENABLE_JAVAC_SERVER), xyes) 386 $1_JAVAC_CMD := $$($1_SJAVAC) $$($1_REMOTE) 387 else 388 $1_JAVAC_CMD := $$($1_JAVAC) 389 endif 390 391 # When not using sjavac, pass along all sources to javac using an @file. 392 $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE) 393 $(MKDIR) -p $$(@D) 394 $$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp)) 395 $(ECHO) Compiling `$(WC) $$@.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files for $1 396 $(call LogFailures, $$($1_BIN)/_the.$$($1_SAFE_NAME)_batch.log, $$($1_SAFE_NAME), \ 397 $$($1_JVM) $$($1_JAVAC_CMD) $$($1_FLAGS) \ 398 -implicit:none \ 399 -d $$($1_BIN) $$($1_HEADERS_ARG) @$$@.tmp) && \ 400 $(MV) $$@.tmp $$@ 401 endif 402 403 # Add all targets to main variable 404 $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_COMPILE_TARGET) \ 405 $$($1_HEADER_TARGETS) 406 407 # Check if a jar file was specified, then setup the rules for the jar. 408 ifneq (,$$($1_JAR)) 409 # If no suffixes was explicitly set for this jar file. 410 # Use class and the cleaned/copied properties file suffixes as the default 411 # for the types of files to be put into the jar. 412 ifeq (,$$($1_SUFFIXES)) 413 $1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY) 414 endif 415 416 $$(eval $$(call SetupJarArchive, ARCHIVE_$1, \ 417 DEPENDENCIES:=$$($1), \ 418 SRCS:=$$($1_BIN), \ 419 SUFFIXES:=$$($1_SUFFIXES), \ 420 EXCLUDE:=$$($1_EXCLUDES), \ 421 INCLUDES:=$$($1_INCLUDES), \ 422 EXTRA_FILES:=$$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS), \ 423 JAR:=$$($1_JAR), \ 424 JARMAIN:=$$($1_JARMAIN), \ 425 MANIFEST:=$$($1_MANIFEST), \ 426 EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR), \ 427 JARINDEX:=$$($1_JARINDEX), \ 428 HEADERS:=$$($1_HEADERS), \ 429 SETUP:=$$($1_SETUP), \ 430 )) 431 432 # Add jar to target list 433 $1 += $$($1_JAR) 434 endif 435 436 # Check if a srczip was specified, then setup the rules for the srczip. 437 ifneq (,$$($1_SRCZIP)) 438 $$(eval $$(call SetupZipArchive, ZIP_ARCHIVE_$1, \ 439 SRC:=$$($1_SRC), \ 440 ZIP:=$$($1_SRCZIP), \ 441 INCLUDES:=$$($1_INCLUDES), \ 442 EXCLUDES:=$$($1_EXCLUDES), \ 443 EXCLUDE_FILES:=$$($1_EXCLUDE_FILES))) 444 445 # Add zip to target list 446 $1 += $$($1_SRCZIP) 447 endif 448endef 449 450# Use this macro to find the correct target to depend on when the original 451# SetupJavaCompilation is declared in a different makefile, to avoid having 452# to declare and evaluate it again. 453# param 1 is for example BUILD_MYPACKAGE 454# param 2 is the output directory (BIN) 455define SetupJavaCompilationCompileTarget 456 $(if $(findstring yes, $(ENABLE_SJAVAC)), $(strip $2)/_the.$(strip $1)_pubapi, \ 457 $(strip $2)/_the.$(strip $1)_batch) 458endef 459 460endif # _JAVA_COMPILATION_GMK 461