common/makefiles/MakeHelpers.gmk

changeset 839
174a54ce39c4
parent 673
2ef28c12d649
     1.1 --- a/common/makefiles/MakeHelpers.gmk	Wed Oct 09 18:51:32 2013 -0700
     1.2 +++ b/common/makefiles/MakeHelpers.gmk	Thu Oct 10 14:58:19 2013 +0200
     1.3 @@ -26,7 +26,7 @@
     1.4  ################################################################
     1.5  #
     1.6  # This file contains helper functions for the top-level Makefile that does
     1.7 -# not depend on the spec.gmk file having been read. (The purpose of this 
     1.8 +# not depend on the spec.gmk file having been read. (The purpose of this
     1.9  # file is ju to avoid cluttering the top-level Makefile.)
    1.10  #
    1.11  ################################################################
    1.12 @@ -49,7 +49,7 @@
    1.13  BUILDTIMESDIR=$(OUTPUT_ROOT)/tmp/buildtimes
    1.14  
    1.15  # Global targets are possible to run either with or without a SPEC. The prototypical
    1.16 -# global target is "help". 
    1.17 +# global target is "help".
    1.18  global_targets=help jprt% bridgeBuild
    1.19  
    1.20  ##############################
    1.21 @@ -57,55 +57,55 @@
    1.22  ##############################
    1.23  
    1.24  define CheckEnvironment
    1.25 -    # Find all environment or command line variables that begin with ALT.
    1.26 -    $(if $(list_alt_overrides),
    1.27 -        @$(PRINTF) "\nWARNING: You have the following ALT_ variables set:\n"
    1.28 -    @$(PRINTF) "$(foreach var,$(list_alt_overrides),$(var)=$$$(var))\n"
    1.29 -    @$(PRINTF) "ALT_ variables are deprecated and will be ignored. Please clean your environment.\n\n"
    1.30 -    )
    1.31 +        # Find all environment or command line variables that begin with ALT.
    1.32 +	$(if $(list_alt_overrides),
    1.33 +	  @$(PRINTF) "\nWARNING: You have the following ALT_ variables set:\n"
    1.34 +	  @$(PRINTF) "$(foreach var,$(list_alt_overrides),$(var)=$$$(var))\n"
    1.35 +	  @$(PRINTF) "ALT_ variables are deprecated and will be ignored. Please clean your environment.\n\n"
    1.36 +	)
    1.37  endef
    1.38  
    1.39  ### Functions for timers
    1.40  
    1.41  # Record starting time for build of a sub repository.
    1.42  define RecordStartTime
    1.43 -    $(MKDIR) -p $(BUILDTIMESDIR)
    1.44 -    $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$1
    1.45 -    $(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$1_human_readable
    1.46 +	$(MKDIR) -p $(BUILDTIMESDIR)
    1.47 +	$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$1
    1.48 +	$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$1_human_readable
    1.49  endef
    1.50  
    1.51  # Record ending time and calculate the difference and store it in a
    1.52  # easy to read format. Handles builds that cross midnight. Expects
    1.53 -# that a build will never take 24 hours or more. 
    1.54 +# that a build will never take 24 hours or more.
    1.55  define RecordEndTime
    1.56 -    $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$1
    1.57 -    $(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$1_human_readable
    1.58 -    $(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$1` $1 | \
    1.59 -        $(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \
    1.60 -        M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \
    1.61 -        > $(BUILDTIMESDIR)/build_time_diff_$1
    1.62 +	$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$1
    1.63 +	$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$1_human_readable
    1.64 +	$(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$1` $1 | \
    1.65 +	    $(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \
    1.66 +	    M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \
    1.67 +	    > $(BUILDTIMESDIR)/build_time_diff_$1
    1.68  endef
    1.69  
    1.70  # Find all build_time_* files and print their contents in a list sorted
    1.71  # on the name of the sub repository.
    1.72  define ReportBuildTimes
    1.73 -    $(BUILD_LOG_WRAPPER) $(PRINTF) -- "----- Build times -------\nStart %s\nEnd   %s\n%s\n%s\n-------------------------\n" \
    1.74 -        "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
    1.75 -        "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
    1.76 -        "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | $(XARGS) $(CAT) | $(SORT) -k 2`" \
    1.77 -        "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
    1.78 +	$(BUILD_LOG_WRAPPER) $(PRINTF) -- "----- Build times -------\nStart %s\nEnd   %s\n%s\n%s\n-------------------------\n" \
    1.79 +	    "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
    1.80 +	    "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
    1.81 +	    "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | $(XARGS) $(CAT) | $(SORT) -k 2`" \
    1.82 +	    "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
    1.83  endef
    1.84  
    1.85  define ResetAllTimers
    1.86 -    $$(shell $(MKDIR) -p $(BUILDTIMESDIR) &&  $(RM) $(BUILDTIMESDIR)/build_time_*)
    1.87 +  $$(shell $(MKDIR) -p $(BUILDTIMESDIR) && $(RM) $(BUILDTIMESDIR)/build_time_*)
    1.88  endef
    1.89  
    1.90  define StartGlobalTimer
    1.91 -    $(call RecordStartTime,TOTAL)
    1.92 +	$(call RecordStartTime,TOTAL)
    1.93  endef
    1.94  
    1.95  define StopGlobalTimer
    1.96 -    $(call RecordEndTime,TOTAL)
    1.97 +	$(call RecordEndTime,TOTAL)
    1.98  endef
    1.99  
   1.100  ### Functions for managing makefile structure (start/end of makefile and individual targets)
   1.101 @@ -123,184 +123,184 @@
   1.102  # Check if the current target is the final target, as specified by
   1.103  # the user on the command line. If so, call AtRootMakeEnd.
   1.104  define CheckIfMakeAtEnd
   1.105 -    # Check if the current target is the last goal
   1.106 -    $(if $(filter $@,$(call LastGoal)),$(call AtMakeEnd))
   1.107 -    # If the target is 'foo-only', check if our goal was stated as 'foo'
   1.108 -    $(if $(filter $@,$(call LastGoal)-only),$(call AtMakeEnd))
   1.109 +        # Check if the current target is the last goal
   1.110 +	$(if $(filter $@,$(call LastGoal)),$(call AtMakeEnd))
   1.111 +        # If the target is 'foo-only', check if our goal was stated as 'foo'
   1.112 +	$(if $(filter $@,$(call LastGoal)-only),$(call AtMakeEnd))
   1.113  endef
   1.114  
   1.115  # Hook to be called when starting to execute a top-level target
   1.116  define TargetEnter
   1.117 -    $(BUILD_LOG_WRAPPER) $(PRINTF) "## Starting $(patsubst %-only,%,$@)\n"
   1.118 -    $(call RecordStartTime,$(patsubst %-only,%,$@))
   1.119 +	$(BUILD_LOG_WRAPPER) $(PRINTF) "## Starting $(patsubst %-only,%,$@)\n"
   1.120 +	$(call RecordStartTime,$(patsubst %-only,%,$@))
   1.121  endef
   1.122  
   1.123  # Hook to be called when finish executing a top-level target
   1.124  define TargetExit
   1.125 -    $(call RecordEndTime,$(patsubst %-only,%,$@))
   1.126 -    $(BUILD_LOG_WRAPPER) $(PRINTF) "## Finished $(patsubst %-only,%,$@) (build time %s)\n\n" \
   1.127 -        "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_$(patsubst %-only,%,$@) | $(CUT) -f 1 -d ' '`"
   1.128 -    $(call CheckIfMakeAtEnd)
   1.129 +	$(call RecordEndTime,$(patsubst %-only,%,$@))
   1.130 +	$(BUILD_LOG_WRAPPER) $(PRINTF) "## Finished $(patsubst %-only,%,$@) (build time %s)\n\n" \
   1.131 +	    "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_$(patsubst %-only,%,$@) | $(CUT) -f 1 -d ' '`"
   1.132 +	$(call CheckIfMakeAtEnd)
   1.133  endef
   1.134  
   1.135  # Hook to be called as the very first thing when running a normal build
   1.136  define AtMakeStart
   1.137 -    $(if $(findstring --jobserver,$(MAKEFLAGS)),$(error make -j is not supported, use make JOBS=n))
   1.138 -    $(call CheckEnvironment)
   1.139 -    @$(PRINTF) $(LOG_INFO) "Running make as '$(MAKE) $(MFLAGS) $(MAKE_ARGS)'\n"
   1.140 -    @$(PRINTF) "Building $(PRODUCT_NAME) for target '$(call GetRealTarget)' in configuration '$(CONF_NAME)'\n\n"
   1.141 -    $(call StartGlobalTimer)
   1.142 +	$(if $(findstring --jobserver,$(MAKEFLAGS)),$(error make -j is not supported, use make JOBS=n))
   1.143 +	$(call CheckEnvironment)
   1.144 +	@$(PRINTF) $(LOG_INFO) "Running make as '$(MAKE) $(MFLAGS) $(MAKE_ARGS)'\n"
   1.145 +	@$(PRINTF) "Building $(PRODUCT_NAME) for target '$(call GetRealTarget)' in configuration '$(CONF_NAME)'\n\n"
   1.146 +	$(call StartGlobalTimer)
   1.147  endef
   1.148  
   1.149  # Hook to be called as the very last thing for targets that are "top level" targets
   1.150  define AtMakeEnd
   1.151 -    [ -f $(SJAVAC_SERVER_DIR)/server.port ] && echo Stopping sjavac server && $(TOUCH) $(SJAVAC_SERVER_DIR)/server.port.stop; true
   1.152 -    $(call StopGlobalTimer)
   1.153 -    $(call ReportBuildTimes)
   1.154 -    @$(PRINTF) "Finished building $(PRODUCT_NAME) for target '$(call GetRealTarget)'\n"
   1.155 -    $(call CheckEnvironment)
   1.156 +	[ -f $(SJAVAC_SERVER_DIR)/server.port ] && echo Stopping sjavac server && $(TOUCH) $(SJAVAC_SERVER_DIR)/server.port.stop; true
   1.157 +	$(call StopGlobalTimer)
   1.158 +	$(call ReportBuildTimes)
   1.159 +	@$(PRINTF) "Finished building $(PRODUCT_NAME) for target '$(call GetRealTarget)'\n"
   1.160 +	$(call CheckEnvironment)
   1.161  endef
   1.162  
   1.163  ### Functions for parsing and setting up make options from command-line
   1.164  
   1.165  define FatalError
   1.166 -    # If the user specificed a "global" target (e.g. 'help'), do not exit but continue running
   1.167 -    $$(if $$(filter-out $(global_targets),$$(call GetRealTarget)),$$(error Cannot continue))
   1.168 +  # If the user specificed a "global" target (e.g. 'help'), do not exit but continue running
   1.169 +  $$(if $$(filter-out $(global_targets),$$(call GetRealTarget)),$$(error Cannot continue))
   1.170  endef
   1.171  
   1.172  define ParseLogLevel
   1.173 -    ifeq ($$(origin VERBOSE),undefined)
   1.174 -        # Setup logging according to LOG (but only if VERBOSE is not given)
   1.175 +  ifeq ($$(origin VERBOSE),undefined)
   1.176 +    # Setup logging according to LOG (but only if VERBOSE is not given)
   1.177  
   1.178 -        # If the "nofile" argument is given, act on it and strip it away
   1.179 -        ifneq ($$(findstring nofile,$$(LOG)),)
   1.180 -          # Reset the build log wrapper, regardless of other values
   1.181 -          override BUILD_LOG_WRAPPER=
   1.182 -          # COMMA is defined in spec.gmk, but that is not included yet
   1.183 -          COMMA=,
   1.184 -          # First try to remove ",nofile" if it exists
   1.185 -          LOG_STRIPPED1=$$(subst $$(COMMA)nofile,,$$(LOG))
   1.186 -          # Otherwise just remove "nofile"
   1.187 -          LOG_STRIPPED2=$$(subst nofile,,$$(LOG_STRIPPED1))
   1.188 -          # We might have ended up with a leading comma. Remove it
   1.189 -          LOG_STRIPPED3=$$(strip $$(patsubst $$(COMMA)%,%,$$(LOG_STRIPPED2)))
   1.190 -          LOG_LEVEL:=$$(LOG_STRIPPED3)
   1.191 -        else
   1.192 -          LOG_LEVEL:=$$(LOG)
   1.193 -        endif
   1.194 +    # If the "nofile" argument is given, act on it and strip it away
   1.195 +    ifneq ($$(findstring nofile,$$(LOG)),)
   1.196 +      # Reset the build log wrapper, regardless of other values
   1.197 +      override BUILD_LOG_WRAPPER=
   1.198 +      # COMMA is defined in spec.gmk, but that is not included yet
   1.199 +      COMMA=,
   1.200 +      # First try to remove ",nofile" if it exists
   1.201 +      LOG_STRIPPED1=$$(subst $$(COMMA)nofile,,$$(LOG))
   1.202 +      # Otherwise just remove "nofile"
   1.203 +      LOG_STRIPPED2=$$(subst nofile,,$$(LOG_STRIPPED1))
   1.204 +      # We might have ended up with a leading comma. Remove it
   1.205 +      LOG_STRIPPED3=$$(strip $$(patsubst $$(COMMA)%,%,$$(LOG_STRIPPED2)))
   1.206 +      LOG_LEVEL:=$$(LOG_STRIPPED3)
   1.207 +    else
   1.208 +      LOG_LEVEL:=$$(LOG)
   1.209 +    endif
   1.210  
   1.211 -        ifeq ($$(LOG_LEVEL),)
   1.212 -            # Set LOG to "warn" as default if not set (and no VERBOSE given)
   1.213 -            override LOG_LEVEL=warn
   1.214 -        endif
   1.215 -        ifeq ($$(LOG_LEVEL),warn)
   1.216 -            VERBOSE=-s
   1.217 -        else ifeq ($$(LOG_LEVEL),info)
   1.218 -            VERBOSE=-s
   1.219 -        else ifeq ($$(LOG_LEVEL),debug)
   1.220 -            VERBOSE=
   1.221 -        else ifeq ($$(LOG_LEVEL),trace)
   1.222 -            VERBOSE=
   1.223 -        else
   1.224 -            $$(info Error: LOG must be one of: warn, info, debug or trace.)
   1.225 -            $$(eval $$(call FatalError))
   1.226 -        endif
   1.227 +    ifeq ($$(LOG_LEVEL),)
   1.228 +      # Set LOG to "warn" as default if not set (and no VERBOSE given)
   1.229 +      override LOG_LEVEL=warn
   1.230 +    endif
   1.231 +    ifeq ($$(LOG_LEVEL),warn)
   1.232 +      VERBOSE=-s
   1.233 +    else ifeq ($$(LOG_LEVEL),info)
   1.234 +      VERBOSE=-s
   1.235 +    else ifeq ($$(LOG_LEVEL),debug)
   1.236 +      VERBOSE=
   1.237 +    else ifeq ($$(LOG_LEVEL),trace)
   1.238 +      VERBOSE=
   1.239      else
   1.240 -        # Provide resonable interpretations of LOG_LEVEL if VERBOSE is given.
   1.241 -        ifeq ($(VERBOSE),)
   1.242 -            LOG_LEVEL:=debug
   1.243 -        else
   1.244 -            LOG_LEVEL:=warn
   1.245 -        endif
   1.246 -        ifneq ($$(LOG),)
   1.247 -            # We have both a VERBOSE and a LOG argument. This is OK only if this is a repeated call by ourselves,
   1.248 -            # but complain if this is the top-level make call.
   1.249 -            ifeq ($$(MAKELEVEL),0)
   1.250 -                $$(info Cannot use LOG=$$(LOG) and VERBOSE=$$(VERBOSE) at the same time. Choose one.)
   1.251 -                $$(eval $$(call FatalError))
   1.252 -            endif
   1.253 -        endif
   1.254 +      $$(info Error: LOG must be one of: warn, info, debug or trace.)
   1.255 +      $$(eval $$(call FatalError))
   1.256      endif
   1.257 +  else
   1.258 +    # Provide resonable interpretations of LOG_LEVEL if VERBOSE is given.
   1.259 +    ifeq ($(VERBOSE),)
   1.260 +      LOG_LEVEL:=debug
   1.261 +    else
   1.262 +      LOG_LEVEL:=warn
   1.263 +    endif
   1.264 +    ifneq ($$(LOG),)
   1.265 +      # We have both a VERBOSE and a LOG argument. This is OK only if this is a repeated call by ourselves,
   1.266 +      # but complain if this is the top-level make call.
   1.267 +      ifeq ($$(MAKELEVEL),0)
   1.268 +        $$(info Cannot use LOG=$$(LOG) and VERBOSE=$$(VERBOSE) at the same time. Choose one.)
   1.269 +        $$(eval $$(call FatalError))
   1.270 +      endif
   1.271 +    endif
   1.272 +  endif
   1.273  endef
   1.274  
   1.275  define ParseConfAndSpec
   1.276 -    ifneq ($$(filter-out $(global_targets),$$(call GetRealTarget)),)
   1.277 -        # If we only have global targets, no need to bother with SPEC or CONF
   1.278 -        ifneq ($$(origin SPEC),undefined)
   1.279 -            # We have been given a SPEC, check that it works out properly
   1.280 -            ifeq ($$(wildcard $$(SPEC)),)
   1.281 -                $$(info Cannot locate spec.gmk, given by SPEC=$$(SPEC))
   1.282 -                $$(eval $$(call FatalError))
   1.283 -            endif
   1.284 -            ifneq ($$(origin CONF),undefined)
   1.285 -                # We also have a CONF argument. This is OK only if this is a repeated call by ourselves,
   1.286 -                # but complain if this is the top-level make call.
   1.287 -                ifeq ($$(MAKELEVEL),0)
   1.288 -                    $$(info Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.)
   1.289 -                    $$(eval $$(call FatalError))
   1.290 -                endif
   1.291 -            endif
   1.292 -            # ... OK, we're satisfied, we'll use this SPEC later on
   1.293 +  ifneq ($$(filter-out $(global_targets),$$(call GetRealTarget)),)
   1.294 +    # If we only have global targets, no need to bother with SPEC or CONF
   1.295 +    ifneq ($$(origin SPEC),undefined)
   1.296 +      # We have been given a SPEC, check that it works out properly
   1.297 +      ifeq ($$(wildcard $$(SPEC)),)
   1.298 +        $$(info Cannot locate spec.gmk, given by SPEC=$$(SPEC))
   1.299 +        $$(eval $$(call FatalError))
   1.300 +      endif
   1.301 +      ifneq ($$(origin CONF),undefined)
   1.302 +        # We also have a CONF argument. This is OK only if this is a repeated call by ourselves,
   1.303 +        # but complain if this is the top-level make call.
   1.304 +        ifeq ($$(MAKELEVEL),0)
   1.305 +          $$(info Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.)
   1.306 +          $$(eval $$(call FatalError))
   1.307 +        endif
   1.308 +      endif
   1.309 +      # ... OK, we're satisfied, we'll use this SPEC later on
   1.310 +    else
   1.311 +      # Find all spec.gmk files in the build output directory
   1.312 +      output_dir=$$(root_dir)/build
   1.313 +      all_spec_files=$$(wildcard $$(output_dir)/*/spec.gmk)
   1.314 +      ifeq ($$(all_spec_files),)
   1.315 +        $$(info No configurations found for $$(root_dir)! Please run configure to create a configuration.)
   1.316 +        $$(eval $$(call FatalError))
   1.317 +      endif
   1.318 +      # Extract the configuration names from the path
   1.319 +      all_confs=$$(patsubst %/spec.gmk,%,$$(patsubst $$(output_dir)/%,%,$$(all_spec_files)))
   1.320 +
   1.321 +      ifneq ($$(origin CONF),undefined)
   1.322 +        # User have given a CONF= argument.
   1.323 +        ifeq ($$(CONF),)
   1.324 +          # If given CONF=, match all configurations
   1.325 +          matching_confs=$$(strip $$(all_confs))
   1.326          else
   1.327 -            # Find all spec.gmk files in the build output directory
   1.328 -            output_dir=$$(root_dir)/build
   1.329 -            all_spec_files=$$(wildcard $$(output_dir)/*/spec.gmk)
   1.330 -            ifeq ($$(all_spec_files),)
   1.331 -                $$(info No configurations found for $$(root_dir)! Please run configure to create a configuration.)
   1.332 -                $$(eval $$(call FatalError))
   1.333 -            endif
   1.334 -            # Extract the configuration names from the path
   1.335 -            all_confs=$$(patsubst %/spec.gmk,%,$$(patsubst $$(output_dir)/%,%,$$(all_spec_files)))
   1.336 +          # Otherwise select those that contain the given CONF string
   1.337 +          matching_confs=$$(strip $$(foreach var,$$(all_confs),$$(if $$(findstring $$(CONF),$$(var)),$$(var))))
   1.338 +        endif
   1.339 +        ifeq ($$(matching_confs),)
   1.340 +          $$(info No configurations found matching CONF=$$(CONF))
   1.341 +          $$(info Available configurations:)
   1.342 +          $$(foreach var,$$(all_confs),$$(info * $$(var)))
   1.343 +          $$(eval $$(call FatalError))
   1.344 +        else
   1.345 +          ifeq ($$(words $$(matching_confs)),1)
   1.346 +            $$(info Building '$$(matching_confs)' (matching CONF=$$(CONF)))
   1.347 +          else
   1.348 +            $$(info Building target '$(call GetRealTarget)' in the following configurations (matching CONF=$$(CONF)):)
   1.349 +            $$(foreach var,$$(matching_confs),$$(info * $$(var)))
   1.350 +          endif
   1.351 +        endif
   1.352  
   1.353 -            ifneq ($$(origin CONF),undefined)
   1.354 -                # User have given a CONF= argument.
   1.355 -                ifeq ($$(CONF),)
   1.356 -                    # If given CONF=, match all configurations
   1.357 -                    matching_confs=$$(strip $$(all_confs))
   1.358 -                else
   1.359 -                    # Otherwise select those that contain the given CONF string
   1.360 -                    matching_confs=$$(strip $$(foreach var,$$(all_confs),$$(if $$(findstring $$(CONF),$$(var)),$$(var))))
   1.361 -                endif
   1.362 -                ifeq ($$(matching_confs),)
   1.363 -                    $$(info No configurations found matching CONF=$$(CONF))
   1.364 -                    $$(info Available configurations:)
   1.365 -                    $$(foreach var,$$(all_confs),$$(info * $$(var)))
   1.366 -                    $$(eval $$(call FatalError))
   1.367 -                else
   1.368 -                    ifeq ($$(words $$(matching_confs)),1)
   1.369 -                        $$(info Building '$$(matching_confs)' (matching CONF=$$(CONF)))
   1.370 -                    else
   1.371 -                        $$(info Building target '$(call GetRealTarget)' in the following configurations (matching CONF=$$(CONF)):)
   1.372 -                        $$(foreach var,$$(matching_confs),$$(info * $$(var)))
   1.373 -                    endif
   1.374 -                endif
   1.375 +        # Create a SPEC definition. This will contain the path to one or more spec.gmk files.
   1.376 +        SPEC=$$(addsuffix /spec.gmk,$$(addprefix $$(output_dir)/,$$(matching_confs)))
   1.377 +      else
   1.378 +        # No CONF or SPEC given, check the available configurations
   1.379 +        ifneq ($$(words $$(all_spec_files)),1)
   1.380 +          $$(info No CONF given, but more than one configuration found in $$(output_dir).)
   1.381 +          $$(info Available configurations:)
   1.382 +          $$(foreach var,$$(all_confs),$$(info * $$(var)))
   1.383 +          $$(info Please retry building with CONF=<config pattern> (or SPEC=<specfile>))
   1.384 +          $$(eval $$(call FatalError))
   1.385 +        endif
   1.386  
   1.387 -                # Create a SPEC definition. This will contain the path to one or more spec.gmk files.
   1.388 -                SPEC=$$(addsuffix /spec.gmk,$$(addprefix $$(output_dir)/,$$(matching_confs)))
   1.389 -            else
   1.390 -                # No CONF or SPEC given, check the available configurations
   1.391 -                ifneq ($$(words $$(all_spec_files)),1)
   1.392 -                    $$(info No CONF given, but more than one configuration found in $$(output_dir).)
   1.393 -                    $$(info Available configurations:)
   1.394 -                    $$(foreach var,$$(all_confs),$$(info * $$(var)))
   1.395 -                    $$(info Please retry building with CONF=<config pattern> (or SPEC=<specfile>))
   1.396 -                    $$(eval $$(call FatalError))
   1.397 -                endif
   1.398 -
   1.399 -                # We found exactly one configuration, use it
   1.400 -                SPEC=$$(strip $$(all_spec_files))
   1.401 -            endif
   1.402 -        endif
   1.403 +        # We found exactly one configuration, use it
   1.404 +        SPEC=$$(strip $$(all_spec_files))
   1.405 +      endif
   1.406      endif
   1.407 +  endif
   1.408  endef
   1.409  
   1.410  ### Convenience functions from Main.gmk
   1.411  
   1.412  # Cleans the component given as $1
   1.413  define CleanComponent
   1.414 -    @$(PRINTF) "Cleaning $1 build artifacts ..."
   1.415 -    @($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
   1.416 -    @$(PRINTF) " done\n"
   1.417 +	@$(PRINTF) "Cleaning $1 build artifacts ..."
   1.418 +	@($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
   1.419 +	@$(PRINTF) " done\n"
   1.420  endef
   1.421  
   1.422  endif # _MAKEHELPERS_GMK

mercurial