changeset 1383:6af7f86fc626

8074988: Reduce boilerplate in Setup* macro definitions Reviewed-by: tbell, ihse
author erikj
date Thu, 12 Mar 2015 12:13:23 +0100
parents 6ad4e1ab9bc4
children ac80b5d194b1
files make/common/IdlCompilation.gmk make/common/JavaCompilation.gmk make/common/MakeBase.gmk make/common/NativeCompilation.gmk make/common/RMICompilation.gmk make/common/TestFilesCompilation.gmk make/common/TextFileProcessing.gmk make/common/ZipArchive.gmk test/make/TestJavaCompilation.gmk test/make/TestMakeBase.gmk
diffstat 10 files changed, 115 insertions(+), 127 deletions(-) [+]
line wrap: on
line diff
--- a/make/common/IdlCompilation.gmk	Wed Mar 11 08:25:55 2015 -0700
+++ b/make/common/IdlCompilation.gmk	Thu Mar 12 12:13:23 2015 +0100
@@ -88,15 +88,8 @@
 #   EXCLUDES
 #   OLDIMPLBASES
 #   DELETES
-define SetupIdlCompilation
-  $(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 $(strip $($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))
+SetupIdlCompilation = $(NamedParamsMacroTemplate)
+define SetupIdlCompilationBody
 
   # Find all existing java files and existing class files.
   $$(call MakeDir,$$($1_BIN))
--- a/make/common/JavaCompilation.gmk	Wed Mar 11 08:25:55 2015 -0700
+++ b/make/common/JavaCompilation.gmk	Thu Mar 12 12:13:23 2015 +0100
@@ -59,16 +59,8 @@
 #   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
-  $(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 $(strip $($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))
-
+SetupJavaCompiler = $(NamedParamsMacroTemplate)
+define SetupJavaCompilerBody
   # The port file contains the tcp/ip on which the server listens
   # and the cookie necessary to talk to the server.
   $1_SJAVAC_PORTFILE:=$$($1_SERVER_DIR)/server.port
@@ -84,10 +76,11 @@
 # 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.
 #
-# Parameter 2 is a list of dependencies for the jar target. If left empty,
-# dependencies are searched using SRCS, which should not be empty.
-#
 # Remaining parameters are named arguments. These include:
+#   DEPENDENCIES:=List of dependencies for the jar target. If left empty,
+#       dependencies are calculated automatically from the source files found.
+#       For this to work, the source files must exist when the makefile is
+#       parsed.
 #   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
@@ -102,17 +95,8 @@
 #       added to the archive.
 #   EXTRA_MANIFEST_ATTR:=Extra attribute to add to manifest.
 #   CHECK_COMPRESS_JAR Check the COMPRESS_JAR variable
-define SetupArchive
-  $(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 $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
-  $(call LogSetupMacroEntry,SetupArchive($1),<dependencies>,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
-  $(if $(findstring $(LOG_LEVEL),trace), $(info *[2] <dependencies> = $(strip $2)))
-  $(if $(16),$(error Internal makefile error: Too many arguments to SetupArchive, please update JavaCompilation.gmk))
+SetupArchive = $(NamedParamsMacroTemplate)
+define SetupArchiveBody
 
   $1_JARMAIN:=$(strip $$($1_JARMAIN))
   $1_JARNAME:=$$(notdir $$($1_JAR))
@@ -171,29 +155,27 @@
   # When this macro is run in the same makefile as the java compilation, dependencies are
   # transfered in make variables. When the macro is run in a different makefile than the
   # java compilation, the dependencies need to be found in the filesystem.
-  ifneq (,$2)
-    $1_DEPS:=$2
-  else
+  ifeq ($$($1_DEPENDENCIES), )
     # Add all source roots to the find cache since we are likely going to run find
     # on these more than once. The cache will only be updated if necessary.
     $$(eval $$(call FillCacheFind, $$($1_FIND_LIST)))
-    $1_DEPS:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \
+    $1_DEPENDENCIES:=$$(filter $$(addprefix %,$$($1_SUFFIXES)), \
         $$(call CacheFind,$$($1_SRCS)))
     ifneq (,$$($1_GREP_INCLUDE_PATTERNS))
-      $1_DEPS:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPS))
+      $1_DEPENDENCIES:=$$(filter $$(addsuffix %,$$($1_GREP_INCLUDE_PATTERNS)),$$($1_DEPENDENCIES))
     endif
     ifneq (,$$($1_GREP_EXCLUDE_PATTERNS))
-      $1_DEPS:=$$(filter-out $$(addsuffix %,$$($1_GREP_EXCLUDE_PATTERNS)),$$($1_DEPS))
+      $1_DEPENDENCIES:=$$(filter-out $$(addsuffix %,$$($1_GREP_EXCLUDE_PATTERNS)),$$($1_DEPENDENCIES))
     endif
     # Look for EXTRA_FILES in all SRCS dirs and as absolute paths.
-    $1_DEPS+=$$(wildcard $$(foreach src, $$($1_SRCS), \
+    $1_DEPENDENCIES+=$$(wildcard $$(foreach src, $$($1_SRCS), \
         $$(addprefix $$(src)/, $$($1_EXTRA_FILES))) $$($1_EXTRA_FILES))
     ifeq (,$$($1_SKIP_METAINF))
-      $1_DEPS+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
+      $1_DEPENDENCIES+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
     endif
   endif
   # The dependency list should never be empty
-  ifeq ($$(strip $$($1_DEPS)), )
+  ifeq ($$(strip $$($1_DEPENDENCIES)), )
     $$(warning No dependencies found for $1)
   endif
 
@@ -288,7 +270,7 @@
   $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$(dir $$($1_JAR))_the.$$($1_JARNAME).vardeps)
 
   # Here is the rule that creates/updates the jar file.
-  $$($1_JAR) : $$($1_DEPS) $$($1_MANIFEST) $$($1_VARDEPS_FILE)
+  $$($1_JAR) : $$($1_DEPENDENCIES) $$($1_MANIFEST) $$($1_VARDEPS_FILE)
 	$(MKDIR) -p $$($1_BIN)
 	$$($1_GREP_INCLUDE_OUTPUT)
 	$$($1_GREP_EXCLUDE_OUTPUT)
@@ -429,15 +411,8 @@
 #   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
-  $(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 $(strip $($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))
+SetupJavaCompilation = $(NamedParamsMacroTemplate)
+define SetupJavaCompilationBody
 
   # Verify arguments
   ifeq ($$($1_BIN),)
@@ -653,7 +628,8 @@
       $1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY)
     endif
 
-    $$(eval $$(call SetupArchive,ARCHIVE_$1,$$($1), \
+    $$(eval $$(call SetupArchive,ARCHIVE_$1, \
+        DEPENDENCIES:=$$($1), \
         SRCS:=$$($1_BIN), \
         SUFFIXES:=$$($1_SUFFIXES), \
         EXCLUDE:=$$($1_EXCLUDES), \
--- a/make/common/MakeBase.gmk	Wed Mar 11 08:25:55 2015 -0700
+++ b/make/common/MakeBase.gmk	Thu Mar 12 12:13:23 2015 +0100
@@ -374,28 +374,70 @@
 # Make sure logging is setup for everyone that includes MakeBase.gmk.
 $(eval $(call SetupLogging))
 
-# This is to be called by all SetupFoo macros
-define LogSetupMacroEntry
-  $(if $(30),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk))
-  $(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 27 28 29,$(if $(strip $($i)),$(NEWLINE) $(strip [$i] $($i))))))
+################################################################################
+# Creates a sequence of increasing numbers (inclusive).
+# Param 1 - starting number
+# Param 2 - ending number
+sequence = \
+    $(wordlist $1, $2, $(strip \
+        $(eval SEQUENCE_COUNT :=) \
+        $(call _sequence-do,$(strip $2))))
+
+_sequence-do = \
+    $(if $(word $1, $(SEQUENCE_COUNT)),, \
+      $(eval SEQUENCE_COUNT += .) \
+      $(words $(SEQUENCE_COUNT)) \
+      $(call _sequence-do,$1))
+
+################################################################################
+
+MAX_PARAMS := 30
+PARAM_SEQUENCE := $(call sequence, 2, $(MAX_PARAMS))
+
+# Template for creating a macro taking named parameters. To use it, assign the
+# template to a variable with the name you want for your macro, using '='
+# assignment. Then define a macro body with the suffix "Body". The Body macro
+# should take 1 parameter which should be a unique string for that invocation
+# of the macro.
+# Ex:
+# SetupFoo = $(NamedParamsMacroTemplate)
+# define SetupFooBody
+#   # do something
+#   # access parameters as $$($1_BAR)
+# endef
+# Call it like this
+# $(eval $(call SetupFoo, BUILD_SOMETHING, \
+#     BAR := some parameter value, \
+# ))
+define NamedParamsMacroTemplate
+  $(if $($(MAX_PARAMS)),$(error Internal makefile error: \
+      Too many named arguments to macro, please update MAX_PARAMS in MakeBase.gmk))
+  # Iterate over 2 3 4... and evaluate the named parameters with $1_ as prefix
+  $(foreach i,$(PARAM_SEQUENCE), $(if $(strip $($i)),\
+    $(strip $1)_$(strip $($i)))$(NEWLINE))
+  # Debug print all named parameter names and values
+  $(if $(findstring $(LOG_LEVEL),debug trace), \
+    $(info $0 $(strip $1) $(foreach i,$(PARAM_SEQUENCE), \
+      $(if $(strip $($i)),$(NEWLINE) $(strip [$i] $(if $(filter $(LOG_LEVEL), trace), \
+        $($i), $(wordlist 1, 20, $($(i))) $(if $(word 21, $($(i))), ...)))))))
+
+  $(if $(DEBUG_$(strip $1)),
+    $(info -------- <<< Begin expansion of $(strip $1)) \
+    $(info $(call $(0)Body,$(strip $1))) \
+    $(info -------- >>> End expansion of $(strip $1)) \
+  )
+
+  $(call $(0)Body,$(strip $1))
 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
 MakeDir = \
     $(strip $(if $(subst $(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),,$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9)),\
       $(shell $(MKDIR) -p $1 $2 $3 $4 $5 $6 $7 $8 $9)))
 
+################################################################################
+
 ifeq ($(OPENJDK_TARGET_OS),solaris)
   # On Solaris, if the target is a symlink and exists, cp won't overwrite.
   # Cp has to operate in recursive mode to allow for -P flag, to preserve soft links. If the
@@ -437,6 +479,7 @@
   endef
 endif
 
+################################################################################
 # Convenience functions for working around make's limitations with $(filter ).
 containing = \
     $(strip $(foreach v,$(strip $2),$(if $(findstring $(strip $1),$v),$v)))
@@ -457,8 +500,9 @@
     $(and $(findstring $(strip $1),$(strip $2)),\
         $(findstring $(strip $2),$(strip $1)))
 
+################################################################################
+
 ifneq ($(DISABLE_CACHE_FIND), true)
-  ################################################################################
   # In Cygwin, finds are very costly, both because of expensive forks and because
   # of bad file system caching. Find is used extensively in $(shell) commands to
   # find source files. This makes rerunning make with no or few changes rather
@@ -544,16 +588,8 @@
 #   FLATTEN : Set to flatten the directory structure in the DEST dir.
 #   MACRO   : Optionally override the default macro used for making the copy.
 #             Default is 'install-file'
-
-define SetupCopyFiles
-  $(if $(16),$(error Internal makefile error: Too many arguments to SetupCopyFiles, please update MakeBase.gmk))
-  $(call EvalDebugWrapper,$(strip $1),$(call SetupCopyFilesInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
-endef
-
-define SetupCopyFilesInner
-  $(foreach i,2 3 4 5 6, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
-  $(call LogSetupMacroEntry,SetupCopyFiles($1),$2,$3,$4,$5,$6)
-  $(if $(7),$(error Internal makefile error: Too many arguments to SetupCopyFiles, please update MakeBase.gmk))
+SetupCopyFiles = $(NamedParamsMacroTemplate)
+define SetupCopyFilesBody
 
   ifeq ($$($1_MACRO), )
     $1_MACRO := install-file
--- a/make/common/NativeCompilation.gmk	Wed Mar 11 08:25:55 2015 -0700
+++ b/make/common/NativeCompilation.gmk	Thu Mar 12 12:13:23 2015 +0100
@@ -195,15 +195,8 @@
 #   LDEXE the linker to use for linking executables, default is $(LDEXE)
 #   OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST
 #   DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain
-define SetupNativeCompilation
-  $(if $(30),$(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),$(27),$(28),$(29)))
-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 27 28 29, $(if $(strip $($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),$(27),$(28),$(29))
-  $(if $(30),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
+SetupNativeCompilation = $(NamedParamsMacroTemplate)
+define SetupNativeCompilationBody
 
   ifneq (,$$($1_BIN))
     $$(error BIN has been replaced with OBJECT_DIR)
--- a/make/common/RMICompilation.gmk	Wed Mar 11 08:25:55 2015 -0700
+++ b/make/common/RMICompilation.gmk	Thu Mar 12 12:13:23 2015 +0100
@@ -37,15 +37,8 @@
 #   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
-  $(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 $(strip $($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))
+SetupRMICompilation = $(NamedParamsMacroTemplate)
+define SetupRMICompilationBody
 
   $1_DEP_FILE := $$($1_STUB_CLASSES_DIR)/_the.$1_rmic.generated
 
--- a/make/common/TestFilesCompilation.gmk	Wed Mar 11 08:25:55 2015 -0700
+++ b/make/common/TestFilesCompilation.gmk	Thu Mar 12 12:13:23 2015 +0100
@@ -46,15 +46,8 @@
 #   TYPE Must be either PROGRAM or LIBRARY.
 #   SOURCE_DIRS A list of source directories to search
 #   OUTPUT_DIR Where to put the resulting files
-define SetupTestFilesCompilation
-  $(if $(27),$(error Internal makefile error: Too many arguments to SetupTestFilesCompilation, please update BuildJTRegNative.gmk))
-  $(call EvalDebugWrapper,$(strip $1),$(call SetupTestFilesCompilationInner,$(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 SetupTestFilesCompilationInner
-  $(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 $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
-  $(call LogSetupMacroEntry,SetupTestFileCompilation($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 SetupTestFilesCompilation, please update BuildJTRegNative.gmk))
+SetupTestFilesCompilation = $(NamedParamsMacroTemplate)
+define SetupTestFilesCompilationBody
 
   # Check for duplicate base file names. That would have failed later anyhow, but
   # this gives a better error message.
--- a/make/common/TextFileProcessing.gmk	Wed Mar 11 08:25:55 2015 -0700
+++ b/make/common/TextFileProcessing.gmk	Thu Mar 12 12:13:23 2015 +0100
@@ -77,15 +77,8 @@
 #   processed first, and replacements will be done on the included fragments as well.
 #   If neither is present, the files will just be copied without modifications.
 #
-define SetupTextFileProcessing
-  $(if $(16),$(error Internal makefile error: Too many arguments to SetupTextFileProcessing, please update TextFileProcessing.gmk))
-  $(call EvalDebugWrapper,$(strip $1),$(call SetupTextFileProcessingInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
-endef
-
-define SetupTextFileProcessingInner
-  $(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,SetupTextFileProcessing($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 SetupTextFileProcessing, please update TextFileProcessing.gmk))
+SetupTextFileProcessing = $(NamedParamsMacroTemplate)
+define SetupTextFileProcessingBody
 
   ifneq ($$($1_SOURCE_FILES),)
     ifneq ($$($1_SOURCE_DIRS),)
--- a/make/common/ZipArchive.gmk	Wed Mar 11 08:25:55 2015 -0700
+++ b/make/common/ZipArchive.gmk	Thu Mar 12 12:13:23 2015 +0100
@@ -45,15 +45,8 @@
 #   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))
+SetupZipArchive = $(NamedParamsMacroTemplate)
+define SetupZipArchiveBody
 
   # 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
--- a/test/make/TestJavaCompilation.gmk	Wed Mar 11 08:25:55 2015 -0700
+++ b/test/make/TestJavaCompilation.gmk	Thu Mar 12 12:13:23 2015 +0100
@@ -67,7 +67,7 @@
 	$(TOUCH) $@
 
 $(eval $(call SetupArchive,BUILD_JAR1, \
-    $(OUTPUT_DIR)/_jar1_created, \
+    DEPENDENCIES := $(OUTPUT_DIR)/_jar1_created, \
     SRCS := $(JAR1_SRC_ROOT), \
     MANIFEST := $(JAR1_MANIFEST), \
     JAR := $(JAR1_FILE)))
@@ -143,7 +143,7 @@
 	$(TOUCH) $@
 
 $(eval $(call SetupArchive,BUILD_JAR2, \
-    $(OUTPUT_DIR)/_jar2_created, \
+    DEPENDENCIES := $(OUTPUT_DIR)/_jar2_created, \
     SRCS := $(JAR2_SRC_ROOT1) $(JAR2_SRC_ROOT2), \
     JAR := $(JAR2_FILE)))
 
@@ -196,7 +196,7 @@
 	$(TOUCH) $@
 
 $(eval $(call SetupArchive,BUILD_JAR3, \
-    $(OUTPUT_DIR)/_jar3_created, \
+    DEPENDENCIES := $(OUTPUT_DIR)/_jar3_created, \
     SRCS := $(JAR3_SRC_ROOT1) $(JAR3_SRC_ROOT2), \
     EXTRA_FILES := extra-file \
         dir2/file$$$$foo.dollar \
--- a/test/make/TestMakeBase.gmk	Wed Mar 11 08:25:55 2015 -0700
+++ b/test/make/TestMakeBase.gmk	Thu Mar 12 12:13:23 2015 +0100
@@ -182,5 +182,23 @@
 TEST_TARGETS += test-vardep
 
 ################################################################################
+# Test sequence
+
+ifneq ($(call sequence, 1, 1), 1)
+  $(error Sequence 1, 1 should be "1", but was $(call sequence, 1, 1))
+endif
+
+ifneq ($(call sequence, 2, 3), 2 3)
+  $(error Sequence 2, 3 should be "2 3", but was $(call sequence, 2, 3))
+endif
+
+ifneq ($(call sequence, 4, 9), 4 5 6 7 8 9)
+  $(error Sequence 4, 9 should be "4 5 6 7 8 9", but was $(call sequence, 4, 9))
+endif
+
+ifneq ($(call sequence, 5, 15), 5 6 7 8 9 10 11 12 13 14 15)
+  $(error Sequence 5, 15 should be "5 6 7 8 9 10 11 12 13 14 15", \
+      but was $(call sequence, 5, 15))
+endif
 
 all: $(TEST_TARGETS)