make/InitSupport.gmk
changeset 32874 b563863620ec
parent 32720 7e0e586a6817
child 33572 b74ceb2d2d20
equal deleted inserted replaced
32873:d445b313f219 32874:b563863620ec
    38   # loaded. Most of these functions provide parsing and setting up make options
    38   # loaded. Most of these functions provide parsing and setting up make options
    39   # from the command-line.
    39   # from the command-line.
    40   ##############################################################################
    40   ##############################################################################
    41 
    41 
    42   # Make control variables, handled by Init.gmk
    42   # Make control variables, handled by Init.gmk
    43   INIT_CONTROL_VARIABLES := LOG CONF SPEC JOBS CONF_CHECK
    43   INIT_CONTROL_VARIABLES := LOG CONF SPEC JOBS CONF_CHECK COMPARE_BUILD
    44 
    44 
    45   # All known make control variables
    45   # All known make control variables
    46   MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER
    46   MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER
    47 
    47 
    48   # Define a simple reverse function.
    48   # Define a simple reverse function.
    51       $(if $(strip $(1)), $(call reverse, $(wordlist 2, $(words $(1)), $(1)))) \
    51       $(if $(strip $(1)), $(call reverse, $(wordlist 2, $(words $(1)), $(1)))) \
    52           $(firstword $(1))
    52           $(firstword $(1))
    53 
    53 
    54   # The variable MAKEOVERRIDES contains variable assignments from the command
    54   # The variable MAKEOVERRIDES contains variable assignments from the command
    55   # line, but in reverse order to what the user entered.
    55   # line, but in reverse order to what the user entered.
       
    56   # The '\#' <=> '\ 'dance is needed to keep values with space in them connected.
    56   COMMAND_LINE_VARIABLES := $(subst \#,\ , $(call reverse, $(subst \ ,\#,$(MAKEOVERRIDES))))
    57   COMMAND_LINE_VARIABLES := $(subst \#,\ , $(call reverse, $(subst \ ,\#,$(MAKEOVERRIDES))))
    57 
    58 
    58   # A list like FOO="val1" BAR="val2" containing all user-supplied make
    59   # A list like FOO="val1" BAR="val2" containing all user-supplied make
    59   # variables that we should propagate.
    60   # variables that we should propagate.
    60   USER_MAKE_VARS := $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \
    61   # The '\#' <=> '\ 'dance is needed to keep values with space in them connected.
    61       $(MAKEOVERRIDES))
    62   USER_MAKE_VARS := $(subst \#,\ , $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \
       
    63       $(subst \ ,\#,$(MAKEOVERRIDES))))
    62 
    64 
    63   # Setup information about available configurations, if any.
    65   # Setup information about available configurations, if any.
    64   build_dir=$(topdir)/build
    66   build_dir=$(topdir)/build
    65   all_spec_files=$(wildcard $(build_dir)/*/spec.gmk)
    67   all_spec_files=$(wildcard $(build_dir)/*/spec.gmk)
    66   # Extract the configuration names from the path
    68   # Extract the configuration names from the path
   307         endif
   309         endif
   308       endif
   310       endif
   309     endif
   311     endif
   310   endef
   312   endef
   311 
   313 
       
   314   # Parse COMPARE_BUILD into COMPARE_BUILD_*
       
   315   # Syntax: COMPARE_BUILD=CONF=<configure options>:PATCH=<patch file>:
       
   316   #         MAKE=<make targets>:COMP_OPTS=<compare script options>:
       
   317   #         COMP_DIR=<compare script base dir>|<default>
       
   318   # If neither CONF or PATCH is given, assume <default> means CONF if it
       
   319   # begins with "--", otherwise assume it means PATCH.
       
   320   # MAKE and COMP_OPTS can only be used with CONF and/or PATCH specified.
       
   321   # If any value contains "+", it will be replaced by space.
       
   322   define ParseCompareBuild
       
   323     ifneq ($$(COMPARE_BUILD), )
       
   324       ifneq ($$(findstring :, $$(COMPARE_BUILD)), )
       
   325         $$(foreach part, $$(subst :, , $$(COMPARE_BUILD)), \
       
   326           $$(if $$(filter PATCH=%, $$(part)), \
       
   327             $$(eval COMPARE_BUILD_PATCH=$$(strip $$(patsubst PATCH=%, %, $$(part)))) \
       
   328           ) \
       
   329           $$(if $$(filter CONF=%, $$(part)), \
       
   330             $$(eval COMPARE_BUILD_CONF=$$(strip $$(subst +, , $$(patsubst CONF=%, %, $$(part))))) \
       
   331           ) \
       
   332           $$(if $$(filter MAKE=%, $$(part)), \
       
   333             $$(eval COMPARE_BUILD_MAKE=$$(strip $$(subst +, , $$(patsubst MAKE=%, %, $$(part))))) \
       
   334           ) \
       
   335           $$(if $$(filter COMP_OPTS=%, $$(part)), \
       
   336             $$(eval COMPARE_BUILD_COMP_OPTS=$$(strip $$(subst +, , $$(patsubst COMP_OPTS=%, %, $$(part))))) \
       
   337           ) \
       
   338           $$(if $$(filter COMP_DIR=%, $$(part)), \
       
   339             $$(eval COMPARE_BUILD_COMP_DIR=$$(strip $$(subst +, , $$(patsubst COMP_DIR=%, %, $$(part))))) \
       
   340           ) \
       
   341         )
       
   342       else
       
   343         # Separate handling for single field case, to allow for spaces in values.
       
   344         ifneq ($$(filter PATCH=%, $$(COMPARE_BUILD)), )
       
   345           COMPARE_BUILD_PATCH=$$(strip $$(patsubst PATCH=%, %, $$(COMPARE_BUILD)))
       
   346         else ifneq ($$(filter CONF=%, $$(COMPARE_BUILD)), )
       
   347           COMPARE_BUILD_CONF=$$(strip $$(subst +, , $$(patsubst CONF=%, %, $$(COMPARE_BUILD))))
       
   348         else ifneq ($$(filter --%, $$(COMPARE_BUILD)), )
       
   349           # Assume CONF if value begins with --
       
   350           COMPARE_BUILD_CONF=$$(strip $$(subst +, , $$(COMPARE_BUILD)))
       
   351         else
       
   352           # Otherwise assume patch file
       
   353           COMPARE_BUILD_PATCH=$$(strip $$(COMPARE_BUILD))
       
   354         endif
       
   355       endif
       
   356       ifneq ($$(COMPARE_BUILD_PATCH), )
       
   357         ifneq ($$(wildcard $$(TOPDIR)/$$(COMPARE_BUILD_PATCH)), )
       
   358           # Assume relative path, if file exists
       
   359           COMPARE_BUILD_PATCH := $$(wildcard $$(TOPDIR)/$$(COMPARE_BUILD_PATCH))
       
   360         else ifeq ($$(wildcard $$(COMPARE_BUILD_PATCH)), )
       
   361           $$(error Patch file $$(COMPARE_BUILD_PATCH) does not exist)
       
   362         endif
       
   363       endif
       
   364     endif
       
   365   endef
       
   366 
   312   define RotateLogFiles
   367   define RotateLogFiles
   313 	$(RM) $(BUILD_LOG).old 2> /dev/null
   368 	$(RM) $(BUILD_LOG).old 2> /dev/null
   314 	$(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
   369 	$(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
   315 	$(if $(findstring trace, $(LOG_LEVEL)), \
   370 	$(if $(findstring trace, $(LOG_LEVEL)), \
   316 	  $(RM) $(BUILD_TRACE_LOG).old 2> /dev/null && \
   371 	  $(RM) $(BUILD_TRACE_LOG).old 2> /dev/null && \