changeset 1237:86ff430e9a2b

8065911: Introduce EvalDebugWrapper for all Setup* macros Reviewed-by: erikj
author ihse
date Wed, 26 Nov 2014 14:59:10 +0100
parents c09e33a86d38
children d52ae6b38836
files make/common/IdlCompilation.gmk make/common/JavaCompilation.gmk make/common/MakeBase.gmk make/common/NativeCompilation.gmk make/common/RMICompilation.gmk make/common/TextFileProcessing.gmk make/common/ZipArchive.gmk
diffstat 7 files changed, 286 insertions(+), 165 deletions(-) [+]
line wrap: on
line diff
--- a/make/common/IdlCompilation.gmk	Mon Nov 24 11:53:47 2014 +0100
+++ b/make/common/IdlCompilation.gmk	Wed Nov 26 14:59:10 2014 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -75,10 +75,25 @@
 	$(RM) -rf $3/$$($4_TMPDIR)
 endef
 
+# Setup make rules for creating an IDL compilation.
+#
+# Parameter 1 is the name of the rule. This name is used as variable prefix,
+# and the targets generated are listed in a variable by that name.
+#
+# Remaining parameters are named arguments. These include:
+#   IDLJ
+#   SRC
+#   BIN
+#   INCLUDES
+#   EXCLUDES
+#   OLDIMPLBASES
+#   DELETES
 define SetupIdlCompilation
-  # param 1 is for example BUILD_IDLS
-  # param 2,3,4,5,6,7,8 are named args.
-  #   IDLJ,SRC,BIN,INCLUDES,EXCLUDES,OLDIMPLBASES,DELETES
+  $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk))
+  $(call EvalDebugWrapper,$(strip $1),$(call SetupIdlCompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
+endef
+
+define SetupIdlCompilationInner
   $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupIdlCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
   $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk))
--- a/make/common/JavaCompilation.gmk	Mon Nov 24 11:53:47 2014 +0100
+++ b/make/common/JavaCompilation.gmk	Wed Nov 26 14:59:10 2014 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -42,17 +42,29 @@
   $(error You must include MakeBase.gmk prior to including JavaCompilation.gmk)
 endif
 
+# Java compilation needs SetupZipArchive if we're generating a source zip.
+include ZipArchive.gmk
+
 FALSE_FIND_PATTERN:=-name FILE_NAME_THAT_DOESNT_EXIST
 
+# Setup make rules for defining a Java compiler, which is needed to compile
+# Java code. This rule generates no output.
+#
+# Parameter 1 is the name of the compiler definition. This name needs to be
+# passed to SetupJavaCompilation. This name is used as variable prefix.
+#
+# Remaining parameters are named arguments. These include:
+#   JVM:=The jvm used to run the javac/javah command
+#   JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out
+#   FLAGS:=Flags to be supplied to javac
+#   SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
+#   SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above.
 define SetupJavaCompiler
-  # param 1 is for example GENERATE_OLD_BYTECODE or GENERATE_NEW_JDKBYTECODE
-  # This is the name of the compiler setup.
-  # param 2-9 are named args.
-  #   JVM:=The jvm used to run the javac/javah command
-  #   JAVAC:=The javac jar and bootstrap classpath changes, or just bin/javac if JVM is left out
-  #   FLAGS:=Flags to be supplied to javac
-  #   SERVER_DIR:=Use a javac server (-XDserver) and store the server related files here
-  #   SERVER_JVM:=Use this JVM for the server. Defaults to the JVM above.
+  $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
+  $(call EvalDebugWrapper,$(strip $1),$(call SetupJavaCompilerInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
+endef
+
+define SetupJavaCompilerInner
   $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupJavaCompiler($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
   $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompiler, please update JavaCompilation.gmk))
@@ -67,25 +79,32 @@
   endif
 endef
 
+# Setup make rules for creating a jar archive.
+#
+# Parameter 1 is the name of the rule. This name is used as variable prefix,
+# and the targets generated are listed in a variable by that name.
+#
+# Remaining parameters are named arguments. These include:
+#   SRCS:=List of directories in where to find files to add to archive
+#   SUFFIXES:=File suffixes to include in jar
+#   INCLUDES:=List of directories/packages in SRCS that should be included
+#   EXCLUDES:=List of directories/packages in SRCS that should be excluded
+#   EXCLUDE_FILES:=List of files in SRCS that should be excluded
+#   EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match.
+#   JAR:=Jar file to create
+#   MANIFEST:=Optional manifest file template.
+#   JARMAIN:=Optional main class to add to manifest
+#   JARINDEX:=true means generate the index in the jar file.
+#   SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically
+#       added to the archive.
+#   EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
+#   CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable
 define SetupArchive
-  # param 1 is for example ARCHIVE_MYPACKAGE
-  # param 2 are the dependecies
-  # param 3,4,5,6,7,8,9 are named args.
-  #   SRCS:=List of directories in where to find files to add to archive
-  #   SUFFIXES:=File suffixes to include in jar
-  #   INCLUDES:=List of directories/packages in SRCS that should be included
-  #   EXCLUDES:=List of directories/packages in SRCS that should be excluded
-  #   EXCLUDE_FILES:=List of files in SRCS that should be excluded
-  #   EXTRA_FILES:=List of files in SRCS that should be included regardless of suffix match.
-  #   JAR:=Jar file to create
-  #   MANIFEST:=Optional manifest file template.
-  #   JARMAIN:=Optional main class to add to manifest
-  #   JARINDEX:=true means generate the index in the jar file.
-  #   SKIP_METAINF:=Set to prevent contents of an META-INF directory to be automatically
-  #       added to the archive.
-  #   EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
-  #   CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable
+  $(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk))
+  $(call EvalDebugWrapper,$(strip $1),$(call SetupArchiveInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
+endef
 
+define SetupArchiveInner
   # NOTE: $2 is dependencies, not a named argument!
   $(foreach i,3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupArchive($1),<dependencies>,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
@@ -287,69 +306,6 @@
   $1 += $$($1_JAR)
 endef
 
-define SetupZipArchive
-  # param 1 is for example ZIP_MYSOURCE
-  # param 2,3,4,5,6,7,8,9 are named args.
-  #   SRC,ZIP,INCLUDES,INCLUDE_FILES,EXCLUDES,EXCLUDE_FILES,SUFFIXES,EXTRA_DEPS
-  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
-  $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
-  $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk))
-
-  # To avoid running find over too large sets of files, which causes make to crash
-  # on some configurations (cygwin), use INCLUDES and INCLUDE_FILES to build a set
-  # of directories to run find in, if available.
-  ifneq ($$($1_INCLUDES)$$($1_INCLUDE_FILES),)
-    $1_FIND_LIST := $$(wildcard $$(foreach i,$$($1_SRC), \
-        $$(addprefix $$i/,$$($1_INCLUDES) $$($1_INCLUDE_FILES))))
-  else
-    $1_FIND_LIST := $$($1_SRC)
-  endif
-
-  # Find all files in the source tree.
-  $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST)))
-
-  # Filter on suffixes if set
-  ifneq ($$($1_SUFFIXES),)
-    $1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS))
-  endif
-
-  ifneq ($$($1_INCLUDES),)
-    ifneq ($$($1_SUFFIXES),)
-      $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \
-          $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES))))
-    else
-      $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
-    endif
-  endif
-  ifneq ($$($1_INCLUDE_FILES),)
-    $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
-  endif
-  ifneq ($$($1_EXCLUDES),)
-    $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
-    $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
-    $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
-  endif
-
-  # Use a slightly shorter name for logging, but with enough path to identify this zip.
-  $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
-
-  # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip.
-  # I.e. the zip -i and -x options should match the filtering done in the makefile.
-  # Explicitly excluded files can be given with absolute path. The patsubst solution
-  # isn't perfect but the likelyhood of an absolute path to match something in a src
-  # dir is very small.
-  # If zip has nothing to do, it returns 12 and would fail the build. Check for 12
-  # and only fail if it's not.
-  $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
-	$(MKDIR) -p $$(@D)
-	$(ECHO) Updating $$($1_NAME)
-	$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES))) || test "$$$$?" = "12" )$$(NEWLINE)) true
-	$(TOUCH) $$@
-
-  # Add zip to target list
-  $1 += $$($1_ZIP)
-endef
-
 define add_file_to_copy
   # param 1 = BUILD_MYPACKAGE
   # parma 2 = The source file to copy.
@@ -423,29 +379,39 @@
   $1:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$2)))
 endef
 
+# Setup make rules for compiling Java source code to class files and/or a
+# resulting jar file.
+#
+# Parameter 1 is the name of the rule. This name is used as variable prefix,
+# and the targets generated are listed in a variable by that name.
+#
+# Remaining parameters are named arguments. These include:
+#   SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC
+#   JVM:=path to ..bin/java
+#   ADD_JAVAC_FLAGS:=javac flags to append to the default ones.
+#   SRC:=one or more directories to search for sources
+#   BIN:=store classes here
+#   INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages.
+#   EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages.
+#   COPY:=.prp means copy all prp files to the corresponding package in BIN.
+#   COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo
+#   CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN.
+#   CLEAN_FILES:=myapp/foo/setting.txt means clean this file over to the package myapp/foo
+#   SRCZIP:=Create a src.zip based on the found sources and copied files.
+#   INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file!
+#   EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file!
+#       "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found.
+#   JAVAC_SOURCE_PATH_OVERRIDE:=This forces an explicit -sourcepath to javac instead of the complete
+#       source roots from SRC. This is sometimes needed when compiling specific subsets of the source.
+#   HEADERS:=path to directory where all generated c-headers are written.
+#   DEPENDS:=Extra dependecy
+#   DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit.
 define SetupJavaCompilation
-  # param 1 is for example BUILD_MYPACKAGE
-  # param 2,3,4,5,6,7,8 are named args.
-  #   SETUP:=must point to a previously setup java compiler, for example: SETUP:=BOOTJAVAC
-  #   JVM:=path to ..bin/java
-  #   ADD_JAVAC_FLAGS:=javac flags to append to the default ones.
-  #   SRC:=one or more directories to search for sources
-  #   BIN:=store classes here
-  #   INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages.
-  #   EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages.
-  #   COPY:=.prp means copy all prp files to the corresponding package in BIN.
-  #   COPY_FILES:=myapp/foo/setting.txt means copy this file over to the package myapp/foo
-  #   CLEAN:=.properties means copy and clean all properties file to the corresponding package in BIN.
-  #   CLEAN_FILES:=myapp/foo/setting.txt means clean this file over to the package myapp/foo
-  #   SRCZIP:=Create a src.zip based on the found sources and copied files.
-  #   INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file!
-  #   EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file!
-  #       "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found.
-  #   JAVAC_SOURCE_PATH_OVERRIDE:=This forces an explicit -sourcepath to javac instead of the complete
-  #       source roots from SRC. This is sometimes needed when compiling specific subsets of the source.
-  #   HEADERS:=path to directory where all generated c-headers are written.
-  #   DEPENDS:=Extra dependecy
-  #   DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit.
+  $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
+  $(call EvalDebugWrapper,$(strip $1),$(call SetupJavaCompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
+endef
+
+define SetupJavaCompilationInner
   $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupJavaCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
   $(if $(16),$(error Internal makefile error: Too many arguments to SetupJavaCompilation, please update JavaCompilation.gmk))
--- a/make/common/MakeBase.gmk	Mon Nov 24 11:53:47 2014 +0100
+++ b/make/common/MakeBase.gmk	Wed Nov 26 14:59:10 2014 +0100
@@ -380,6 +380,17 @@
   $(if $(findstring $(LOG_LEVEL),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26,$(if $($i),$(NEWLINE) $(strip [$i] $($i))))))
 endef
 
+# Support macro for all SetupFoo macros.
+define EvalDebugWrapper
+  $(if $(DEBUG_$1),
+    $(info -------- <<< Begin expansion of $1)
+    $(info $2)
+    $(info -------- >>> End expansion of $1)
+  )
+
+  $2
+endef
+
 # Make directory without forking mkdir if not needed
 define MakeDir
   ifneq ($$(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),$$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9))
--- a/make/common/NativeCompilation.gmk	Mon Nov 24 11:53:47 2014 +0100
+++ b/make/common/NativeCompilation.gmk	Wed Nov 26 14:59:10 2014 +0100
@@ -134,32 +134,43 @@
   endif
 endef
 
+# Setup make rules for creating a native binary (a shared library or an
+# executable).
+#
+# Parameter 1 is the name of the rule. This name is used as variable prefix,
+# and the targets generated are listed in a variable by that name.
+#
+# Remaining parameters are named arguments. These include:
+#   SRC one or more directory roots to scan for C/C++ files.
+#   LANG C or C++
+#   CFLAGS the compiler flags to be used, used both for C and C++.
+#   CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS.
+#   LDFLAGS the linker flags to be used, used both for C and C++.
+#   LDFLAGS_SUFFIX the linker flags to be added last on the commandline
+#       typically the libraries linked to.
+#   ARFLAGS the archiver flags to be used
+#   OBJECT_DIR the directory where we store the object files
+#   LIBRARY the resulting library file
+#   PROGRAM the resulting exec file
+#   INCLUDES only pick source from these directories
+#   EXCLUDES do not pick source from these directories
+#   INCLUDE_FILES only compile exactly these files!
+#   EXCLUDE_FILES with these names
+#   EXTRA_FILES List of extra files not in any of the SRC dirs
+#   VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
+#   RC_FLAGS flags for RC.
+#   MAPFILE mapfile
+#   REORDER reorder file
+#   DEBUG_SYMBOLS add debug symbols (if configured on)
+#   CC the compiler to use, default is $(CC)
+#   LDEXE the linker to use for linking executables, default is $(LDEXE)
+#   OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST
 define SetupNativeCompilation
-  # param 1 is for example BUILD_MYPACKAGE
-  # param 2,3,4,5,6,7,8 are named args.
-  #   SRC one or more directory roots to scan for C/C++ files.
-  #   LANG C or C++
-  #   CFLAGS the compiler flags to be used, used both for C and C++.
-  #   CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS.
-  #   LDFLAGS the linker flags to be used, used both for C and C++.
-  #   LDFLAGS_SUFFIX the linker flags to be added last on the commandline
-  #       typically the libraries linked to.
-  #   ARFLAGS the archiver flags to be used
-  #   OBJECT_DIR the directory where we store the object files
-  #   LIBRARY the resulting library file
-  #   PROGRAM the resulting exec file
-  #   INCLUDES only pick source from these directories
-  #   EXCLUDES do not pick source from these directories
-  #   INCLUDE_FILES only compile exactly these files!
-  #   EXCLUDE_FILES with these names
-  #   VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
-  #   RC_FLAGS flags for RC.
-  #   MAPFILE mapfile
-  #   REORDER reorder file
-  #   DEBUG_SYMBOLS add debug symbols (if configured on)
-  #   CC the compiler to use, default is $(CC)
-  #   LDEXE the linker to use for linking executables, default is $(LDEXE)
-  #   OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST
+  $(if $(27),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
+  $(call EvalDebugWrapper,$(strip $1),$(call SetupNativeCompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25),$(26)))
+endef
+
+define SetupNativeCompilationInner
   $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupNativeCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25),$(26))
   $(if $(27),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
--- a/make/common/RMICompilation.gmk	Mon Nov 24 11:53:47 2014 +0100
+++ b/make/common/RMICompilation.gmk	Wed Nov 26 14:59:10 2014 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,17 +23,26 @@
 # questions.
 #
 
+# Setup make rules for creating an RMI compilation.
+#
+# Parameter 1 is the name of the rule. This name is used as variable prefix,
+# and the targets generated are listed in a variable by that name.
+#
+# Remaining parameters are named arguments. These include:
+#   CLASSES:=List of classes to generate stubs for
+#   CLASSES_DIR:=Directory where to look for classes
+#   STUB_CLASSES_DIR:=Directory in where to put stub classes
+#   RUN_V11:=Set to run rmic with -v1.1
+#   RUN_V12:=Set to run rmic with -v1.2
+#   RUN_IIOP:=Set to run rmic with -iiop
+#   RUN_IIOP_STDPKG:=Set to run rmic with -iiop -standardPackage
+#   KEEP_GENERATED:=Set to keep generated sources around
 define SetupRMICompilation
-  # param 1 is a name for a variable to depend on.
-  # param 2 and up are named args.
-  #   CLASSES:=List of classes to generate stubs for
-  #   CLASSES_DIR:=Directory where to look for classes
-  #   STUB_CLASSES_DIR:=Directory in where to put stub classes
-  #   RUN_V11:=Set to run rmic with -v1.1
-  #   RUN_V12:=Set to run rmic with -v1.2
-  #   RUN_IIOP:=Set to run rmic with -iiop
-  #   RUN_IIOP_STDPKG:=Set to run rmic with -iiop -standardPackage
-  #   KEEP_GENERATED:=Set to keep generated sources around
+  $(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk))
+  $(call EvalDebugWrapper,$(strip $1),$(call SetupRMICompilationInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
+endef
+
+define SetupRMICompilationInner
   $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
   $(call LogSetupMacroEntry,SetupRMICompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
   $(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk))
--- a/make/common/TextFileProcessing.gmk	Mon Nov 24 11:53:47 2014 +0100
+++ b/make/common/TextFileProcessing.gmk	Wed Nov 26 14:59:10 2014 +0100
@@ -23,15 +23,9 @@
 # questions.
 #
 
-define EvalDebugWrapper
-  $(if $(DEBUG_$1),
-    $(info -------- <<< Begin expansion of $1)
-    $(info $2)
-    $(info -------- >>> End expansion of $1)
-  )
-    
-  $2
-endef
+ifeq (,$(_MAKEBASE_GMK))
+  $(error You must include MakeBase.gmk prior to including TextFileProcessing.gmk)
+endif
 
 # Helper function for SetupTextFileProcessing; adds a rule for a single file
 # to be processed.
@@ -52,18 +46,20 @@
   $1 += $(strip $3)/$(strip $4)
 endef
 
-# Setup a text file for processing, in which specified markers are replaced with
-# a given text, or with the contents of a given file.
+# Setup make rules for processing one or more text files, in which specified
+# markers are replaced with a given text, or with the contents of a given file.
 #
-# param 1 is the name space for this setup, e.g. BUILD_VERSION_FILE
-# param 2, 3, .. etc are named args:
+# Parameter 1 is the name of the rule. This name is used as variable prefix,
+# and the targets generated are listed in a variable by that name.
+#
+# Remaining parameters are named arguments. These include:
 #   SOURCE_DIRS one or more directory roots to search for files to process
 #   SOURCE_FILES complete paths to one or more files to process
 #   OUTPUT_DIR the directory where we store the processed files.
 #   OUTPUT_FILE the name of the resulting file. Only allowed if processing a
 #       single file.
 #   SOURCE_BASE_DIR a common root to all SOURCE_DIRS.
-#       If specified, files will keep the path relative to the base in the 
+#       If specified, files will keep the path relative to the base in the
 #       OUTPUT_DIR. Otherwise, the hierarchy will be flattened into the OUTPUT_DIR.
 #   INCLUDE_FILES only include files matching these patterns (used only with
 #       SOURCE_DIRS)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/common/ZipArchive.gmk	Wed Nov 26 14:59:10 2014 +0100
@@ -0,0 +1,113 @@
+#
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+ifndef _ZIP_ARCHIVE_GMK
+_ZIP_ARCHIVE_GMK := 1
+
+ifeq (,$(_MAKEBASE_GMK))
+  $(error You must include MakeBase.gmk prior to including ZipArchive.gmk)
+endif
+
+# Setup make rules for creating a zip archive.
+#
+# Parameter 1 is the name of the rule. This name is used as variable prefix,
+# and the targets generated are listed in a variable by that name.
+#
+# Remaining parameters are named arguments. These include:
+#   SRC
+#   ZIP
+#   INCLUDES
+#   INCLUDE_FILES
+#   EXCLUDES
+#   EXCLUDE_FILES
+#   SUFFIXES
+#   EXTRA_DEPS
+#   ZIP_OPTIONS extra options to pass to zip
+define SetupZipArchive
+  $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update ZipArchive.gmk))
+  $(call EvalDebugWrapper,$(strip $1),$(call SetupZipArchiveInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
+endef
+
+define SetupZipArchiveInner
+  $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
+  $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
+  $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk))
+
+  # To avoid running find over too large sets of files, which causes make to crash
+  # on some configurations (cygwin), use INCLUDES and INCLUDE_FILES to build a set
+  # of directories to run find in, if available.
+  ifneq ($$($1_INCLUDES)$$($1_INCLUDE_FILES),)
+    $1_FIND_LIST := $$(wildcard $$(foreach i,$$($1_SRC), \
+        $$(addprefix $$i/,$$($1_INCLUDES) $$($1_INCLUDE_FILES))))
+  else
+    $1_FIND_LIST := $$($1_SRC)
+  endif
+
+  # Find all files in the source tree.
+  $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST)))
+
+  # Filter on suffixes if set
+  ifneq ($$($1_SUFFIXES),)
+    $1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS))
+  endif
+
+  ifneq ($$($1_INCLUDES),)
+    ifneq ($$($1_SUFFIXES),)
+      $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES), \
+          $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES))))
+    else
+      $1_ZIP_INCLUDES := $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_INCLUDES)))
+    endif
+  endif
+  ifneq ($$($1_INCLUDE_FILES),)
+    $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
+  endif
+  ifneq ($$($1_EXCLUDES),)
+    $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
+    $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
+    $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
+  endif
+
+  # Use a slightly shorter name for logging, but with enough path to identify this zip.
+  $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
+
+  # Now $1_ALL_SRCS should contain all sources that are going to be put into the zip.
+  # I.e. the zip -i and -x options should match the filtering done in the makefile.
+  # Explicitly excluded files can be given with absolute path. The patsubst solution
+  # isn't perfect but the likelyhood of an absolute path to match something in a src
+  # dir is very small.
+  # If zip has nothing to do, it returns 12 and would fail the build. Check for 12
+  # and only fail if it's not.
+  $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
+	$(MKDIR) -p $$(@D)
+	$(ECHO) Updating $$($1_NAME)
+	$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$($1_ZIP_OPTIONS) $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES))) || test "$$$$?" = "12" )$$(NEWLINE)) true
+	$(TOUCH) $$@
+
+  # Add zip to target list
+  $1 += $$($1_ZIP)
+endef
+
+endif # _ZIP_ARCHIVE_GMK