8069064: Various improvements and fixes in build system
authorihse
Fri, 16 Jan 2015 16:02:09 +0100
changeset 28902 0c09b47449c8
parent 28901 5acc0ec03d06
child 28903 2bf89d675e57
8069064: Various improvements and fixes in build system Reviewed-by: erikj
Makefile
common/autoconf/basics.m4
common/autoconf/generated-configure.sh
make/common/IdlCompilation.gmk
make/common/JavaCompilation.gmk
make/common/MakeBase.gmk
make/common/NativeCompilation.gmk
make/common/RMICompilation.gmk
--- a/Makefile	Thu Jan 15 16:36:24 2015 +0100
+++ b/Makefile	Fri Jan 16 16:02:09 2015 +0100
@@ -48,6 +48,17 @@
 endif
 root_dir:=$(patsubst %/,%,$(dir $(makefile_path)))
 
+ifeq ($(MAIN_TARGETS), )
+  COMMAND_LINE_VARIABLES:=$(subst =command,,$(filter %=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var))))))
+  MAKE_CONTROL_VARIABLES:=LOG CONF SPEC JOBS TEST IGNORE_OLD_CONFIG
+  UNKNOWN_COMMAND_LINE_VARIABLES:=$(strip $(filter-out $(MAKE_CONTROL_VARIABLES), $(COMMAND_LINE_VARIABLES)))
+  ifneq ($(UNKNOWN_COMMAND_LINE_VARIABLES), )
+    $(info Note: Command line contains non-control variables: $(UNKNOWN_COMMAND_LINE_VARIABLES).)
+    $(info Make sure it is not mistyped, and that you intend to override this variable.)
+    $(info 'make help' will list known control variables)
+  endif
+endif
+
 ifneq ($(findstring qp,$(MAKEFLAGS)),)
   # When called with -qp, assume an external part (e.g. bash completion) is trying
   # to understand our targets.
@@ -148,62 +159,64 @@
 # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
 # If you add more global targets, please update the variable global_targets in MakeHelpers.
 
+# Helper macro to allow $(info) to properly print strings beginning with spaces.
+_:=
+
 help:
 	$(info )
 	$(info OpenJDK Makefile help)
 	$(info =====================)
 	$(info )
 	$(info Common make targets)
-	$(info .  make [default]         # Compile all modules in langtools, hotspot, jaxp, jaxws,)
-	$(info .                         # corba and jdk and create a runnable "exploded" image)
-	$(info .  make all               # Compile everything, all repos, docs and images)
-	$(info .  make images            # Create complete jdk and jre images)
-	$(info .  make <phase>           # Compile the specified phase and everything it depends on)
-	$(info .                         # (gensrc, java, copy, libs, launchers, gendata, rmic))
-	$(info .  make *-only            # Applies to most targets and disables compling the)
-	$(info .                         # dependencies for the target. This is faster but may)
-	$(info .                         # result in incorrect build results!)
-	$(info .  make docs              # Create all docs)
-	$(info .  make docs-javadoc      # Create just javadocs, depends on less than full docs)
-	$(info .  make profiles          # Create complete jre compact profile images)
-	$(info .  make bootcycle-images  # Build images twice, second time with newly built JDK)
-	$(info .  make install           # Install the generated images locally)
-	$(info .  make reconfigure       # Rerun configure with the same arguments as last time)
-	$(info .  make help              # Give some help on using make)
-	$(info .  make test              # Run tests, default is all tests (see TEST below))
+	$(info $(_) make [default]         # Compile all modules in langtools, hotspot, jdk, jaxws,)
+	$(info $(_)                        # jaxp and corba, and create a runnable "exploded" image)
+	$(info $(_) make all               # Compile everything, all repos, docs and images)
+	$(info $(_) make images            # Create complete j2sdk and j2re images)
+	$(info $(_) make <phase>           # Build the specified phase and everything it depends on)
+	$(info $(_)                        # (gensrc, java, copy, libs, launchers, gendata, rmic))
+	$(info $(_) make *-only            # Applies to most targets and disables compling the)
+	$(info $(_)                        # dependencies for the target. This is faster but may)
+	$(info $(_)                        # result in incorrect build results!)
+	$(info $(_) make docs              # Create all docs)
+	$(info $(_) make docs-javadoc      # Create just javadocs, depends on less than full docs)
+	$(info $(_) make profiles          # Create complete j2re compact profile images)
+	$(info $(_) make bootcycle-images  # Build images twice, second time with newly built JDK)
+	$(info $(_) make install           # Install the generated images locally)
+	$(info $(_) make reconfigure       # Rerun configure with the same arguments as last time)
+	$(info $(_) make help              # Give some help on using make)
+	$(info $(_) make test              # Run tests, default is all tests (see TEST below))
 	$(info )
 	$(info Targets for cleaning)
-	$(info .  make clean             # Remove all files generated by make, but not those)
-	$(info .                         # generated by configure)
-	$(info .  make dist-clean        # Remove all files, including configuration)
-	$(info .  make clean-<outputdir> # Remove the subdir in the output dir with the name)
-	$(info .  make clean-<phase>     # Remove all build results related to a certain build)
-	$(info .                         # phase (gensrc, java, libs, launchers))
-	$(info .  make clean-<module>    # Remove all build results related to a certain module)
-	$(info .  make clean-<module>-<phase> # Remove all build results related to a certain)
-	$(info .                         # module and phase)
+	$(info $(_) make clean             # Remove all files generated by make, but not those)
+	$(info $(_)                        # generated by configure)
+	$(info $(_) make dist-clean        # Remove all files, including configuration)
+	$(info $(_) make clean-<outputdir> # Remove the subdir in the output dir with the name)
+	$(info $(_) make clean-<phase>     # Remove all build results related to a certain build)
+	$(info $(_)                        # phase (gensrc, java, libs, launchers))
+	$(info $(_) make clean-<module>    # Remove all build results related to a certain module)
+	$(info $(_) make clean-<module>-<phase> # Remove all build results related to a certain)
+	$(info $(_)                        # module and phase)
 	$(info )
 	$(info Targets for specific modules)
-	$(info .  make <module>          # Build <module> and everything it depends on. )
-	$(info .  make <module>-<phase>  # Compile the specified phase for the specified module)
-	$(info .                         # and everything it depends on)
-	$(info .                         # (gensrc, java, copy, libs, launchers, gendata, rmic))
-	$(info )
-	$(info Useful make variables)
-	$(info .  make CONF=             # Build all configurations (note, assignment is empty))
-	$(info .  make CONF=<substring>  # Build the configuration(s) with a name matching)
-	$(info .                         # <substring>)
+	$(info $(_) make <module>          # Build <module> and everything it depends on.)
+	$(info $(_) make <module>-<phase>  # Compile the specified phase for the specified module)
+	$(info $(_)                        # and everything it depends on)
+	$(info $(_)                        # (gensrc, java, copy, libs, launchers, gendata, rmic))
 	$(info )
-	$(info .  make LOG=<loglevel>    # Change the log level from warn to <loglevel>)
-	$(info .                         # Available log levels are:)
-	$(info .                         # 'warn' (default), 'info', 'debug' and 'trace')
-	$(info .                         # To see executed command lines, use LOG=debug)
-	$(info )
-	$(info .  make JOBS=<n>          # Run <n> parallel make jobs)
-	$(info .                         # Note that -jN does not work as expected!)
-	$(info )
-	$(info .  make test TEST=<test>  # Only run the given test or tests, e.g.)
-	$(info .                         # make test TEST="jdk_lang jdk_net")
+	$(info Make control variables)
+	$(info $(_) CONF=                  # Build all configurations (note, assignment is empty))
+	$(info $(_) CONF=<substring>       # Build the configuration(s) with a name matching)
+	$(info $(_)                        # <substring>)
+	$(info $(_) SPEC=<spec file>       # Build the configuration given by the spec file)
+	$(info $(_) LOG=<loglevel>         # Change the log level from warn to <loglevel>)
+	$(info $(_)                        # Available log levels are:)
+	$(info $(_)                        # 'warn' (default), 'info', 'debug' and 'trace')
+	$(info $(_)                        # To see executed command lines, use LOG=debug)
+	$(info $(_) JOBS=<n>               # Run <n> parallel make jobs)
+	$(info $(_)                        # Note that -jN does not work as expected!)
+	$(info $(_) IGNORE_OLD_CONFIG=true # Skip tests if spec file is up to date)
+	$(info $(_) make test TEST=<test>  # Only run the given test or tests, e.g.)
+	$(info $(_)                        # make test TEST="jdk_lang jdk_net")
 	$(info )
 
 .PHONY: help
--- a/common/autoconf/basics.m4	Thu Jan 15 16:36:24 2015 +0100
+++ b/common/autoconf/basics.m4	Fri Jan 16 16:02:09 2015 +0100
@@ -896,10 +896,6 @@
   fi
   AC_SUBST(IS_GNU_TIME)
 
-  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
-    BASIC_REQUIRE_PROGS(COMM, comm)
-  fi
-
   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
     BASIC_REQUIRE_PROGS(DSYMUTIL, dsymutil)
     BASIC_REQUIRE_PROGS(XATTR, xattr)
--- a/common/autoconf/generated-configure.sh	Thu Jan 15 16:36:24 2015 +0100
+++ b/common/autoconf/generated-configure.sh	Fri Jan 16 16:02:09 2015 +0100
@@ -4387,7 +4387,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1421073193
+DATE_WHEN_GENERATED=1421420310
 
 ###############################################################################
 #
@@ -18879,202 +18879,6 @@
   fi
 
 
-  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
-
-
-
-  # Publish this variable in the help.
-
-
-  if test "x$COMM" = x; then
-    # The variable is not set by user, try to locate tool using the code snippet
-    for ac_prog in comm
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_COMM+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $COMM in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_COMM="$COMM" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_COMM="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-COMM=$ac_cv_path_COMM
-if test -n "$COMM"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $COMM" >&5
-$as_echo "$COMM" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$COMM" && break
-done
-
-  else
-    # The variable is set, but is it from the command line or the environment?
-
-    # Try to remove the string !COMM! from our list.
-    try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!COMM!/}
-    if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
-      # If it failed, the variable was not from the command line. Ignore it,
-      # but warn the user (except for BASH, which is always set by the calling BASH).
-      if test "xCOMM" != xBASH; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of COMM from the environment. Use command line variables instead." >&5
-$as_echo "$as_me: WARNING: Ignoring value of COMM from the environment. Use command line variables instead." >&2;}
-      fi
-      # Try to locate tool using the code snippet
-      for ac_prog in comm
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_COMM+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $COMM in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_COMM="$COMM" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_COMM="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-COMM=$ac_cv_path_COMM
-if test -n "$COMM"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $COMM" >&5
-$as_echo "$COMM" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$COMM" && break
-done
-
-    else
-      # If it succeeded, then it was overridden by the user. We will use it
-      # for the tool.
-
-      # First remove it from the list of overridden variables, so we can test
-      # for unknown variables in the end.
-      CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
-
-      # Check if the provided tool contains a complete path.
-      tool_specified="$COMM"
-      tool_basename="${tool_specified##*/}"
-      if test "x$tool_basename" = "x$tool_specified"; then
-        # A command without a complete path is provided, search $PATH.
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Will search for user supplied tool COMM=$tool_basename" >&5
-$as_echo "$as_me: Will search for user supplied tool COMM=$tool_basename" >&6;}
-        # Extract the first word of "$tool_basename", so it can be a program name with args.
-set dummy $tool_basename; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_COMM+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $COMM in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_COMM="$COMM" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_COMM="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-COMM=$ac_cv_path_COMM
-if test -n "$COMM"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $COMM" >&5
-$as_echo "$COMM" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-        if test "x$COMM" = x; then
-          as_fn_error $? "User supplied tool $tool_basename could not be found" "$LINENO" 5
-        fi
-      else
-        # Otherwise we believe it is a complete path. Use it as it is.
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Will use user supplied tool COMM=$tool_specified" >&5
-$as_echo "$as_me: Will use user supplied tool COMM=$tool_specified" >&6;}
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for COMM" >&5
-$as_echo_n "checking for COMM... " >&6; }
-        if test ! -x "$tool_specified"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-$as_echo "not found" >&6; }
-          as_fn_error $? "User supplied tool COMM=$tool_specified does not exist or is not executable" "$LINENO" 5
-        fi
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tool_specified" >&5
-$as_echo "$tool_specified" >&6; }
-      fi
-    fi
-  fi
-
-
-
-  if test "x$COMM" = x; then
-    as_fn_error $? "Could not find required tool for COMM" "$LINENO" 5
-  fi
-
-
-  fi
-
   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
 
 
--- a/make/common/IdlCompilation.gmk	Thu Jan 15 16:36:24 2015 +0100
+++ b/make/common/IdlCompilation.gmk	Fri Jan 16 16:02:09 2015 +0100
@@ -94,7 +94,7 @@
 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))
+  $(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))
 
--- a/make/common/JavaCompilation.gmk	Thu Jan 15 16:36:24 2015 +0100
+++ b/make/common/JavaCompilation.gmk	Fri Jan 16 16:02:09 2015 +0100
@@ -65,7 +65,7 @@
 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))
+  $(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))
 
@@ -84,6 +84,9 @@
 # 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:
 #   SRCS:=List of directories in where to find files to add to archive
 #   SUFFIXES:=File suffixes to include in jar
@@ -106,7 +109,7 @@
 
 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))
+  $(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))
@@ -413,10 +416,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))
+  $(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))
 
+  # Verify arguments
+  ifeq ($$($1_BIN),)
+    $$(error Must specify BIN (in $1))
+  endif
+
   # Extract the info from the java compiler setup.
   $1_JVM := $$($$($1_SETUP)_JVM)
   $1_JAVAC := $$($$($1_SETUP)_JAVAC)
--- a/make/common/MakeBase.gmk	Thu Jan 15 16:36:24 2015 +0100
+++ b/make/common/MakeBase.gmk	Fri Jan 16 16:02:09 2015 +0100
@@ -377,7 +377,7 @@
 # This is to be called by all SetupFoo macros
 define LogSetupMacroEntry
   $(if $(27),$(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,$(if $($i),$(NEWLINE) $(strip [$i] $($i))))))
+  $(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 $(strip $($i)),$(NEWLINE) $(strip [$i] $($i))))))
 endef
 
 # Support macro for all SetupFoo macros.
@@ -519,19 +519,30 @@
   $3 += $2
 endef
 
+# Setup make rules for copying files, with an option to do more complex
+# processing instead of copying.
+#
+# 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     : Source root dir (defaults to dir of first file)
+#   DEST    : Dest root dir
+#   FILES   : List of files to copy with absolute paths, or path relative to SRC.
+#             Must be in SRC.
+#   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
-  # param 1 is for example COPY_MYFILES
-  # param 2,3,4,5 are named args.
-  #   SRC     : Source root dir (defaults to dir of first file)
-  #   DEST    : Dest root dir
-  #   FILES   : List of files to copy with absolute paths, or path relative to SRC.
-  #             Must be in SRC.
-  #   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'
-  $(foreach i,2 3 4 5 6, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+  $(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))
+  $(if $(7),$(error Internal makefile error: Too many arguments to SetupCopyFiles, please update MakeBase.gmk))
 
   ifeq ($$($1_MACRO), )
     $1_MACRO := install-file
--- a/make/common/NativeCompilation.gmk	Thu Jan 15 16:36:24 2015 +0100
+++ b/make/common/NativeCompilation.gmk	Fri Jan 16 16:02:09 2015 +0100
@@ -178,7 +178,7 @@
 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))
+  $(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,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	Thu Jan 15 16:36:24 2015 +0100
+++ b/make/common/RMICompilation.gmk	Fri Jan 16 16:02:09 2015 +0100
@@ -43,7 +43,7 @@
 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))
+  $(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))