make/common/JavaCompilation.gmk
changeset 27602 236555ddac42
parent 27560 adc258b13e2c
parent 27595 cff167b3bfa2
child 27866 e6c790ef8899
equal deleted inserted replaced
27581:9fffb959eb41 27602:236555ddac42
     1 #
     1 #
     2 # Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
     2 # Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     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
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.  Oracle designates this
     7 # published by the Free Software Foundation.  Oracle designates this
    40 
    40 
    41 ifeq (,$(_MAKEBASE_GMK))
    41 ifeq (,$(_MAKEBASE_GMK))
    42   $(error You must include MakeBase.gmk prior to including JavaCompilation.gmk)
    42   $(error You must include MakeBase.gmk prior to including JavaCompilation.gmk)
    43 endif
    43 endif
    44 
    44 
       
    45 # Java compilation needs SetupZipArchive if we're generating a source zip.
       
    46 include ZipArchive.gmk
       
    47 
    45 FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST
    48 FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST
    46 
    49 
       
    50 # Setup make rules for defining a Java compiler, which is needed to compile
       
    51 # Java code. This rule generates no output.
       
    52 #
       
    53 # Parameter 1 is the name of the compiler definition. This name needs to be
       
    54 # passed to SetupJavaCompilation. This name is used as variable prefix.
       
    55 #
       
    56 # Remaining parameters are named arguments. These include:
       
    57 #   JVM:=The jvm used to run the javac/javah command
       
    58 #   JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out
       
    59 #   FLAGS:=Flags to be supplied to javac
       
    60 #   SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
       
    61 #   SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above.
    47 define SetupJavaCompiler
    62 define SetupJavaCompiler
    48   # param 1 is for example GENERATE_OLD_BYTECODE or GENERATE_NEW_JDKBYTECODE
    63   $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
    49   # This is the name of the compiler setup.
    64   $(call EvalDebugWrapper,$(strip $1),$(call SetupJavaCompilerInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
    50   # param 2-9 are named args.
    65 endef
    51   #   JVM:=The jvm used to run the javac/javah command
    66 
    52   #   JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out
    67 define SetupJavaCompilerInner
    53   #   FLAGS:=Flags to be supplied to javac
       
    54   #   SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
       
    55   #   SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above.
       
    56   $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
    68   $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
    57   $(call LogSetupMacroEntry,SetupJavaCompiler($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
    69   $(call LogSetupMacroEntry,SetupJavaCompiler($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
    58   $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
    70   $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
    59 
    71 
    60   # The port file contains the tcp/ip on which the server listens
    72   # The port file contains the tcp/ip on which the server listens
    65     # It defaults to the same JVM that is used to start the javac command.
    77     # It defaults to the same JVM that is used to start the javac command.
    66     $1_SERVER_JVM:=$$($1_JVM)
    78     $1_SERVER_JVM:=$$($1_JVM)
    67   endif
    79   endif
    68 endef
    80 endef
    69 
    81 
       
    82 # Setup make rules for creating a jar archive.
       
    83 #
       
    84 # Parameter 1 is the name of the rule. This name is used as variable prefix,
       
    85 # and the targets generated are listed in a variable by that name.
       
    86 #
       
    87 # Remaining parameters are named arguments. These include:
       
    88 #   SRCS:=List of directories in where to find files to add to archive
       
    89 #   SUFFIXES:=File suffixes to include in jar
       
    90 #   INCLUDES:=List of directories/packages in SRCS that should be included
       
    91 #   EXCLUDES:=List of directories/packages in SRCS that should be excluded
       
    92 #   EXCLUDE_FILES:=List of files in SRCS that should be excluded
       
    93 #   EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match.
       
    94 #   JAR:=Jar file to create
       
    95 #   MANIFEST:=Optional manifest file template.
       
    96 #   JARMAIN:=Optional main class to add to manifest
       
    97 #   JARINDEX:=true means generate the index in the jar file.
       
    98 #   SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically
       
    99 #       added to the archive.
       
   100 #   EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
       
   101 #   CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable
    70 define SetupArchive
   102 define SetupArchive
    71   # param 1 is for example ARCHIVE_MYPACKAGE
   103   $(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk))
    72   # param 2 are the dependecies
   104   $(call EvalDebugWrapper,$(strip $1),$(call SetupArchiveInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
    73   # param 3,4,5,6,7,8,9 are named args.
   105 endef
    74   #   SRCS:=List of directories in where to find files to add to archive
   106 
    75   #   SUFFIXES:=File suffixes to include in jar
   107 define SetupArchiveInner
    76   #   INCLUDES:=List of directories/packages in SRCS that should be included
       
    77   #   EXCLUDES:=List of directories/packages in SRCS that should be excluded
       
    78   #   EXCLUDE_FILES:=List of files in SRCS that should be excluded
       
    79   #   EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match.
       
    80   #   JAR:=Jar file to create
       
    81   #   MANIFEST:=Optional manifest file template.
       
    82   #   JARMAIN:=Optional main class to add to manifest
       
    83   #   JARINDEX:=true means generate the index in the jar file.
       
    84   #   SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically
       
    85   #       added to the archive.
       
    86   #   EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
       
    87   #   CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable
       
    88 
       
    89   # NOTE: $2 is dependencies, not a named argument!
   108   # NOTE: $2 is dependencies, not a named argument!
    90   $(foreach i,3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
   109   $(foreach i,3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
    91   $(call LogSetupMacroEntry,SetupArchive($1),<dependencies>,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
   110   $(call LogSetupMacroEntry,SetupArchive($1),<dependencies>,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
    92   $(if $(findstring $(LOG_LEVEL),trace), $(info *[2] <dependencies> = $(strip $2)))
   111   $(if $(findstring $(LOG_LEVEL),trace), $(info *[2] <dependencies> = $(strip $2)))
    93   $(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk))
   112   $(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk))
   145   # transfered in make variables. When the macro is run in a different makefile than the
   164   # transfered in make variables. When the macro is run in a different makefile than the
   146   # java compilation, the dependencies need to be found in the filesystem.
   165   # java compilation, the dependencies need to be found in the filesystem.
   147   ifneq (,$2)
   166   ifneq (,$2)
   148     $1_DEPS:=$2
   167     $1_DEPS:=$2
   149   else
   168   else
   150     # Add all source roots to the find cache since we are likely going to run find 
   169     # Add all source roots to the find cache since we are likely going to run find
   151     # on these more than once. The cache will only be updated if necessary.
   170     # on these more than once. The cache will only be updated if necessary.
   152     $$(eval $$(call FillCacheFind, $$($1_FIND_LIST)))
   171     $$(eval $$(call FillCacheFind, $$($1_FIND_LIST)))
   153     $1_DEPS:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \
   172     $1_DEPS:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \
   154         $$(call CacheFind,$$($1_SRCS)))
   173         $$(call CacheFind,$$($1_SRCS)))
   155     ifneq (,$$($1_GREP_INCLUDE_PATTERNS))
   174     ifneq (,$$($1_GREP_INCLUDE_PATTERNS))
   285 
   304 
   286   # Add jar to target list
   305   # Add jar to target list
   287   $1 += $$($1_JAR)
   306   $1 += $$($1_JAR)
   288 endef
   307 endef
   289 
   308 
   290 define SetupZipArchive
       
   291   # param 1 is for example ZIP_MYSOURCE
       
   292   # param 2,3,4,5,6,7,8,9 are named args.
       
   293   #   SRC,ZIP,INCLUDES,INCLUDE_FILES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS
       
   294   $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
       
   295   $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
       
   296   $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk))
       
   297 
       
   298   # To avoid running find over too large sets of files, which causes make to crash
       
   299   # on some configurations (cygwin), use INCLUDES and INCLUDE_FILES to build a set
       
   300   # of directories to run find in, if available.
       
   301   ifneq ($$($1_INCLUDES)$$($1_INCLUDE_FILES),)
       
   302     $1_FIND_LIST := $$(wildcard $$(foreach i,$$($1_SRC), \
       
   303         $$(addprefix $$i/,$$($1_INCLUDES) $$($1_INCLUDE_FILES))))
       
   304   else
       
   305     $1_FIND_LIST := $$($1_SRC)
       
   306   endif
       
   307 
       
   308   # Find all files in the source tree.
       
   309   $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST)))
       
   310 
       
   311   # Filter on suffixes if set
       
   312   ifneq ($$($1_SUFFIXES),)
       
   313     $1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS))
       
   314   endif
       
   315 
       
   316   ifneq ($$($1_INCLUDES),)
       
   317     ifneq ($$($1_SUFFIXES),)
       
   318       $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \
       
   319           $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES))))
       
   320     else
       
   321       $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
       
   322     endif
       
   323   endif
       
   324   ifneq ($$($1_INCLUDE_FILES),)
       
   325     $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
       
   326   endif
       
   327   ifneq ($$($1_EXCLUDES),)
       
   328     $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
       
   329     $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
   309     $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
   330     $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
       
   331   endif
       
   332   ifneq ($$($1_EXCLUDE_FILES),)
   310   ifneq ($$($1_EXCLUDE_FILES),)
   333     # Cannot precompute ZIP_EXCLUDE_FILES as it is dependent on which src root is being
   311     # Cannot precompute ZIP_EXCLUDE_FILES as it is dependent on which src root is being
   334     # zipped at the moment.
   312     # zipped at the moment.
   335     $1_SRC_EXCLUDE_FILES := $$(addprefix %, $$($1_EXCLUDE_FILES)) $$($1_EXCLUDE_FILES)
   313     $1_SRC_EXCLUDE_FILES := $$(addprefix %, $$($1_EXCLUDE_FILES)) $$($1_EXCLUDE_FILES)
   336     $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDE_FILES), $$($1_ALL_SRCS))
   314     $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDE_FILES), $$($1_ALL_SRCS))
   337   endif
   315   endif
   338 
       
   339   # Use a slightly shorter name for logging, but with enough path to identify this zip.
       
   340   $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
       
   341 
       
   342   # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip.
       
   343   # I.e. the zip -i and -x options should match the filtering done in the makefile.
       
   344   # Explicitly excluded files can be given with absolute path. The patsubst solution
       
   345   # isn't perfect but the likelyhood of an absolute path to match something in a src
       
   346   # dir is very small.
       
   347   # If zip has nothing to do, it returns 12 and would fail the build. Check for 12
       
   348   # and only fail if it's not.
       
   349   $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
       
   350 	$(MKDIR) -p $$(@D)
       
   351 	$(ECHO) Updating $$($1_NAME)
       
   352 	$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) \
       
   353 	    $$($1_ZIP_EXCLUDES) -x \*_the.\* \
       
   354 	    $$(addprefix -x$(SPACE), $$(patsubst $$i/%,%, $$($1_EXCLUDE_FILES))) \
       
   355 	    || test "$$$$?" = "12" )$$(NEWLINE)) true
       
   356 	$(TOUCH) $$@
       
   357 
       
   358   # Add zip to target list
       
   359   $1 += $$($1_ZIP)
       
   360 endef
       
   361 
       
   362 define add_file_to_copy
   316 define add_file_to_copy
   363   # param 1 = BUILD_MYPACKAGE
   317   # param 1 = BUILD_MYPACKAGE
   364   # parma 2 = The source file to copy.
   318   # parma 2 = The source file to copy.
   365   $2_TARGET:=$2
   319   $2_TARGET:=$2
   366   # Remove the source prefix.
   320   # Remove the source prefix.
   387 # This is the new clean standard. Though it is to be superseded by
   341 # This is the new clean standard. Though it is to be superseded by
   388 # a standard annotation processor from with sjavac.
   342 # a standard annotation processor from with sjavac.
   389 #
   343 #
   390 # The sed expression does this:
   344 # The sed expression does this:
   391 # 1. Add a backslash before any :, = or ! that do not have a backslash already.
   345 # 1. Add a backslash before any :, = or ! that do not have a backslash already.
   392 # 2. Apply the file unicode2x.sed which does a whole bunch of \u00XX to \xXX 
   346 # 2. Apply the file unicode2x.sed which does a whole bunch of \u00XX to \xXX
   393 #    conversions.
   347 #    conversions.
   394 # 3. Delete all lines starting with #.
   348 # 3. Delete all lines starting with #.
   395 # 4. Delete empty lines.
   349 # 4. Delete empty lines.
   396 # 5. Append lines ending with \ with the next line.
   350 # 5. Append lines ending with \ with the next line.
   397 # 6. Remove leading and trailing white space. Note that tabs must be explicit
   351 # 6. Remove leading and trailing white space. Note that tabs must be explicit
   398 #    as sed on macosx does not understand '\t'.
   352 #    as sed on macosx does not understand '\t'.
   399 # 7. Replace the first \= with just =.
   353 # 7. Replace the first \= with just =.
   400 # 8. Finally it's all sorted to create a stable output.
   354 # 8. Finally it's all sorted to create a stable output.
   401 # 
   355 #
   402 # It is assumed that = is the character used for separating names and values.
   356 # It is assumed that = is the character used for separating names and values.
   403 define add_file_to_clean
   357 define add_file_to_clean
   404   # param 1 = BUILD_MYPACKAGE
   358   # param 1 = BUILD_MYPACKAGE
   405   # parma 2 = The source file to copy and clean.
   359   # parma 2 = The source file to copy and clean.
   406   $2_TARGET:=$2
   360   $2_TARGET:=$2
   407   # Remove the source prefix.
   361   # Remove the source prefix.
   408   $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET)))
   362   $$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET)))
   409   # Now we can setup the depency that will trigger the copying.
   363   # Now we can setup the depency that will trigger the copying.
   410   $$($1_BIN)$$($2_TARGET) : $2
   364   $$($1_BIN)$$($2_TARGET) : $2
   411 	$(MKDIR) -p $$(@D)
   365 	$(MKDIR) -p $$(@D)
   412 	$(CAT) $$< | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \
   366 	export LC_ALL=C ; $(CAT) $$< \
       
   367 	    | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \
   413 	        -e 's/\([^\\]\)!/\1\\!/g' -e 's/#.*/#/g' \
   368 	        -e 's/\([^\\]\)!/\1\\!/g' -e 's/#.*/#/g' \
   414 	    | $(SED) -f "$(SRC_ROOT)/make/common/support/unicode2x.sed" \
   369 	    | $(SED) -f "$(SRC_ROOT)/make/common/support/unicode2x.sed" \
   415 	    | $(SED) -e '/^#/d' -e '/^$$$$/d' \
   370 	    | $(SED) -e '/^#/d' -e '/^$$$$/d' \
   416 	        -e :a -e '/\\$$$$/N; s/\\\n//; ta' \
   371 	        -e :a -e '/\\$$$$/N; s/\\\n//; ta' \
   417 	        -e 's/^[ 	]*//;s/[ 	]*$$$$//' \
   372 	        -e 's/^[ 	]*//;s/[ 	]*$$$$//' \
   418 	        -e 's/\\=/=/' | LC_ALL=C $(SORT) > $$@
   373 	        -e 's/\\=/=/' \
       
   374 	    | $(SORT) > $$@
   419 	$(CHMOD) -f ug+w $$@
   375 	$(CHMOD) -f ug+w $$@
   420 
   376 
   421   # And do not forget this target
   377   # And do not forget this target
   422   $1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($2_TARGET)
   378   $1_ALL_COPY_CLEAN_TARGETS += $$($1_BIN)$$($2_TARGET)
   423 endef
   379 endef
   428 
   384 
   429 define replace_space_with_pathsep
   385 define replace_space_with_pathsep
   430   $1:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$2)))
   386   $1:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$2)))
   431 endef
   387 endef
   432 
   388 
       
   389 # Setup make rules for compiling Java source code to class files and/or a
       
   390 # resulting jar file.
       
   391 #
       
   392 # Parameter 1 is the name of the rule. This name is used as variable prefix,
       
   393 # and the targets generated are listed in a variable by that name.
       
   394 #
       
   395 # Remaining parameters are named arguments. These include:
       
   396 #   SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC
       
   397 #   JVM:=path to ..bin/java
       
   398 #   ADD_JAVAC_FLAGS:=javac flags to append to the default ones.
       
   399 #   SRC:=one or more directories to search for sources
       
   400 #   BIN:=store classes here
       
   401 #   INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages.
       
   402 #   EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages.
       
   403 #   COPY:=.prp means copy all prp files to the corresponding package in BIN.
       
   404 #   COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo
       
   405 #   CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN.
       
   406 #   CLEAN_FILES:=myapp/foo/setting.txt means clean this file over to the package myapp/foo
       
   407 #   SRCZIP:=Create a src.zip based on the found sources and copied files.
       
   408 #   INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file!
       
   409 #   EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file!
       
   410 #       "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found.
       
   411 #   JAVAC_SOURCE_PATH_OVERRIDE:=This forces an explicit -sourcepath to javac instead of the complete
       
   412 #       source roots from SRC. This is sometimes needed when compiling specific subsets of the source.
       
   413 #   HEADERS:=path to directory where all generated c-headers are written.
       
   414 #   DEPENDS:=Extra dependecy
       
   415 #   DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit.
   433 define SetupJavaCompilation
   416 define SetupJavaCompilation
   434   # param 1 is for example BUILD_MYPACKAGE
   417   $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
   435   # param 2,3,4,5,6,7,8 are named args.
   418   $(call EvalDebugWrapper,$(strip $1),$(call SetupJavaCompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
   436   #   SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC
   419 endef
   437   #   JVM:=path to ..bin/java
   420 
   438   #   ADD_JAVAC_FLAGS:=javac flags to append to the default ones.
   421 define SetupJavaCompilationInner
   439   #   SRC:=one or more directories to search for sources
       
   440   #   BIN:=store classes here
       
   441   #   INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages.
       
   442   #   EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages.
       
   443   #   COPY:=.prp means copy all prp files to the corresponding package in BIN.
       
   444   #   COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo
       
   445   #   CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN.
       
   446   #   CLEAN_FILES:=myapp/foo/setting.txt means clean this file over to the package myapp/foo
       
   447   #   SRCZIP:=Create a src.zip based on the found sources and copied files.
       
   448   #   INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file!
       
   449   #   EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file!
       
   450   #       "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found.
       
   451   #   JAVAC_SOURCE_PATH_OVERRIDE:=This forces an explicit -sourcepath to javac instead of the complete
       
   452   #       source roots from SRC. This is sometimes needed when compiling specific subsets of the source.
       
   453   #   HEADERS:=path to directory where all generated c-headers are written.
       
   454   #   DEPENDS:=Extra dependecy
       
   455   #   DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit.
       
   456   $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
   422   $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
   457   $(call LogSetupMacroEntry,SetupJavaCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
   423   $(call LogSetupMacroEntry,SetupJavaCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
   458   $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
   424   $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
   459 
   425 
   460   # Extract the info from the java compiler setup.
   426   # Extract the info from the java compiler setup.
   470   # Handle addons and overrides.
   436   # Handle addons and overrides.
   471   $1_SRC:=$$(call ADD_SRCS,$$($1_SRC))
   437   $1_SRC:=$$(call ADD_SRCS,$$($1_SRC))
   472   # Make sure the dirs exist.
   438   # Make sure the dirs exist.
   473   $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupJavaCompilation $1 contains missing directory $$d)))
   439   $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupJavaCompilation $1 contains missing directory $$d)))
   474   $$(eval $$(call MakeDir,$$($1_BIN)))
   440   $$(eval $$(call MakeDir,$$($1_BIN)))
   475   # Add all source roots to the find cache since we are likely going to run find 
   441   # Add all source roots to the find cache since we are likely going to run find
   476   # on these more than once. The cache will only be updated if necessary.
   442   # on these more than once. The cache will only be updated if necessary.
   477   $$(eval $$(call FillCacheFind,$$($1_SRC)))
   443   $$(eval $$(call FillCacheFind,$$($1_SRC)))
   478   # Find all files in the source trees. Preserve order of source roots for overrides to
   444   # Find all files in the source trees. Preserve order of source roots for overrides to
   479   # work correctly. CacheFind does not preserve order so need to call it for each root.
   445   # work correctly. CacheFind does not preserve order so need to call it for each root.
   480   $1_ALL_SRCS += $$(filter-out $(OVR_SRCS),$$(foreach s,$$($1_SRC),$$(call CacheFind,$$(s))))
   446   $1_ALL_SRCS += $$(filter-out $(OVR_SRCS),$$(foreach s,$$($1_SRC),$$(call CacheFind,$$(s))))