< prev index next >

make/InitSupport.gmk

Print this page


   1 #
   2 # Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


 114     $$(topdir)/make/Init.gmk: .FORCE
 115         $$(if $$(findstring --jobserver, $$(MAKEFLAGS)), \
 116             $$(info Error: 'make -jN' is not supported, use 'make JOBS=N') \
 117             $$(error Cannot continue) \
 118         )
 119     .FORCE:
 120     .PHONY: .FORCE
 121   endef
 122 
 123   # Check that the CONF_CHECK option is valid and set up handling
 124   define ParseConfCheckOption
 125     ifeq ($$(CONF_CHECK), )
 126       # Default behavior is fail
 127       CONF_CHECK := fail
 128     else ifneq ($$(filter-out auto fail ignore, $$(CONF_CHECK)),)
 129       $$(info Error: CONF_CHECK must be one of: auto, fail or ignore.)
 130       $$(error Cannot continue)
 131     endif
 132   endef
 133 
 134   # Look for a given option in the LOG variable, and if found, set a variable
 135   # and remove the option from the LOG variable
 136   # $1: The option to look for
 137   # $2: The option to set to "true" if the option is found
 138   define ParseLogOption
 139     ifneq ($$(findstring $1, $$(LOG)),)
 140       $2 := true
 141       # COMMA is defined in spec.gmk, but that is not included yet
 142       COMMA := ,
 143       # First try to remove ",<option>" if it exists, otherwise just remove "<option>"
 144       LOG_STRIPPED := $$(subst $1,, $$(subst $$(COMMA)$(strip $1),, $$(LOG)))
 145       # We might have ended up with a leading comma. Remove it. Need override
 146       # since LOG is set from the command line.
 147       override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
 148     endif
 149   endef
 150 
 151   define ParseLogLevel
 152     # Catch old-style VERBOSE= command lines.
 153     ifneq ($$(origin VERBOSE), undefined)
 154       $$(info Error: VERBOSE is deprecated. Use LOG=<warn|info|debug|trace> instead.)
 155       $$(error Cannot continue)
 156     endif
 157 
 158     # Setup logging according to LOG
 159 
 160     # If the "nofile" argument is given, act on it and strip it away
 161     $$(eval $$(call ParseLogOption, nofile, LOG_NOFILE))
 162 
 163     # If the "cmdline" argument is given, act on it and strip it away
 164     $$(eval $$(call ParseLogOption, cmdlines, LOG_CMDLINES))
 165 
 166     # If the "profile-to-log" argument is given, write shell times in build log
 167     $$(eval $$(call ParseLogOption, profile-to-log, LOG_PROFILE_TIMES_LOG))
 168 
 169     # If the "profile" argument is given, write shell times in separate log file
 170     # IMPORTANT: $(ParseLogOption profile-to-log) should go first. Otherwise
 171     # parsing of 'LOG=debug,profile-to-log,nofile' ends up in the following error:
 172     # Error: LOG contains unknown option or log level: debug-to-log.
 173     $$(eval $$(call ParseLogOption, profile, LOG_PROFILE_TIMES_FILE))
 174 
 175     # Treat LOG=profile-to-log as if it were LOG=profile,profile-to-log
 176     LOG_PROFILE_TIMES_FILE := $$(firstword $$(LOG_PROFILE_TIMES_FILE) $$(LOG_PROFILE_TIMES_LOG))
 177 
 178     LOG_LEVEL := $$(LOG)
 179 
 180     ifeq ($$(LOG_LEVEL),)
 181       # Set LOG to "warn" as default if not set
 182       LOG_LEVEL := warn
 183     endif
 184 
 185     ifeq ($$(LOG_LEVEL), warn)
 186       MAKE_LOG_FLAGS := -s
 187     else ifeq ($$(LOG_LEVEL), info)
 188       MAKE_LOG_FLAGS := -s
 189     else ifeq ($$(LOG_LEVEL), debug)
 190       MAKE_LOG_FLAGS :=
 191     else ifeq ($$(LOG_LEVEL), trace)
 192       MAKE_LOG_FLAGS :=
 193     else
 194       $$(info Error: LOG contains unknown option or log level: $$(LOG).)
 195       $$(info LOG can be <level>[,<opt>[...]] where <opt> is nofile | cmdlines | profile | profile-to-log)
 196       $$(info and <level> is warn | info | debug | trace)
 197       $$(error Cannot continue)
 198     endif
 199   endef
 200 
 201   define ParseConfAndSpec
 202     ifneq ($$(origin SPEC), undefined)
 203       # We have been given a SPEC, check that it works out properly
 204       ifneq ($$(origin CONF), undefined)
 205         # We also have a CONF argument. We can't have both.
 206         $$(info Error: Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.)
 207         $$(error Cannot continue)
 208       endif
 209       ifneq ($$(origin CONF_NAME), undefined)
 210         # We also have a CONF_NAME argument. We can't have both.
 211         $$(info Error: Cannot use CONF_NAME=$$(CONF_NAME) and SPEC=$$(SPEC) at the same time. Choose one.)
 212         $$(error Cannot continue)
 213       endif
 214       ifeq ($$(wildcard $$(SPEC)),)
 215         $$(info Error: Cannot locate spec.gmk, given by SPEC=$$(SPEC).)
 216         $$(error Cannot continue)
 217       endif
 218       ifeq ($$(filter /%, $$(SPEC)),)
 219         # If given with relative path, make it absolute
 220         SPECS := $$(CURDIR)/$$(strip $$(SPEC))


 460         $(MKDIR) -p $(topdir)/build/compare-build
 461         $(MV) $(OUTPUTDIR) $(COMPARE_BUILD_OUTPUTDIR)
 462         $(MV) $(topdir)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUTDIR)
 463         $(RM) -r $(topdir)/build/.compare-build-temp
 464   endef
 465 
 466   # Do the actual comparison of two builds
 467   define CompareBuildDoComparison
 468         # Compare first and second build. Ignore any error code from compare.sh.
 469         $(ECHO) "Comparing between comparison rebuild (this/new) and baseline (other/old)"
 470         $(if $(COMPARE_BUILD_COMP_DIR), \
 471           +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
 472               -2dirs $(COMPARE_BUILD_OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) \
 473               $(OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) $(COMPARE_BUILD_IGNORE_RESULT)), \
 474           +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
 475               -o $(OUTPUTDIR) $(COMPARE_BUILD_IGNORE_RESULT)) \
 476         )
 477   endef
 478 
 479   define PrintFailureReports

 480         $(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log), \
 481           $(PRINTF) "\n=== Output from failing command(s) repeated here ===\n" $(NEWLINE) \
 482           $(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log)), \
 483               $(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(NEWLINE) \



 484               ($(GREP) -v -e "^Note: including file:" <  $(logfile) || true) | $(HEAD) -n 12 $(NEWLINE) \
 485               if test `$(WC) -l < $(logfile)` -gt 12; then \
 486                 $(ECHO) "   ... (rest of output omitted)" ; \
 487               fi $(NEWLINE) \
 488           ) \

 489           $(PRINTF) "\n* All command lines available in $(MAKESUPPORT_OUTPUTDIR)/failure-logs.\n" $(NEWLINE) \
 490           $(PRINTF) "=== End of repeated output ===\n" \

 491         )
 492   endef
 493 
 494   define PrintBuildLogFailures

 495         if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then  \
 496           $(PRINTF) "\n=== Make failed targets repeated here ===\n" ; \
 497           $(GREP) "recipe for target .* failed" $(BUILD_LOG) ; \
 498           $(PRINTF) "=== End of repeated output ===\n" ; \
 499           $(PRINTF) "\nHint: Try searching the build log for the name of the first failed target.\n" ; \
 500         else \
 501           $(PRINTF) "\nNo indication of failed target found.\n" ; \
 502           $(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \
 503         fi

 504   endef
 505 
 506   define RotateLogFiles
 507         $(RM) $(BUILD_LOG).old 2> /dev/null && \
 508         $(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
 509         $(if $(findstring true, $(LOG_PROFILE_TIMES_FILE)), \
 510           $(RM) $(BUILD_PROFILE_LOG).old 2> /dev/null && \
 511           $(MV) $(BUILD_PROFILE_LOG) $(BUILD_PROFILE_LOG).old 2> /dev/null || true \
 512         )
 513   endef
 514 
 515   define PrepareFailureLogs
 516         $(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \
 517         $(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs
 518         $(RM) $(MAKESUPPORT_OUTPUTDIR)/exit-with-error 2> /dev/null
 519   endef
 520 
 521   # Remove any javac server logs and port files. This
 522   # prevents a new make run to reuse the previous servers.
 523   define PrepareSmartJavac


 566             "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
 567             "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
 568             $(XARGS) $(CAT) | $(SORT) -k 2`" \
 569             "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \
 570             $(BUILD_LOG_PIPE)
 571   endef
 572 
 573   define ReportProfileTimes
 574     $(if $(findstring true, $(LOG_PROFILE_TIMES_LOG)), \
 575       [ ! -f $(BUILD_PROFILE_LOG) ] || \
 576       { $(ECHO) Begin $(notdir $(BUILD_PROFILE_LOG)) && \
 577         $(CAT) $(BUILD_PROFILE_LOG) && \
 578         $(ECHO) End $(notdir $(BUILD_PROFILE_LOG)); \
 579       } \
 580       $(BUILD_LOG_PIPE)
 581     )
 582   endef
 583 
 584 endif # HAS_SPEC
 585 


































































































 586 MAKE_LOG_VARS = $(foreach v, \
 587     LOG_LEVEL LOG_NOFILE LOG_CMDLINES LOG_PROFILE_TIMES_LOG LOG_PROFILE_TIMES_FILE, \

 588     $v=$($v) \
 589 )
 590 
 591 endif # _INITSUPPORT_GMK
   1 #
   2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


 114     $$(topdir)/make/Init.gmk: .FORCE
 115         $$(if $$(findstring --jobserver, $$(MAKEFLAGS)), \
 116             $$(info Error: 'make -jN' is not supported, use 'make JOBS=N') \
 117             $$(error Cannot continue) \
 118         )
 119     .FORCE:
 120     .PHONY: .FORCE
 121   endef
 122 
 123   # Check that the CONF_CHECK option is valid and set up handling
 124   define ParseConfCheckOption
 125     ifeq ($$(CONF_CHECK), )
 126       # Default behavior is fail
 127       CONF_CHECK := fail
 128     else ifneq ($$(filter-out auto fail ignore, $$(CONF_CHECK)),)
 129       $$(info Error: CONF_CHECK must be one of: auto, fail or ignore.)
 130       $$(error Cannot continue)
 131     endif
 132   endef
 133 



































































 134   define ParseConfAndSpec
 135     ifneq ($$(origin SPEC), undefined)
 136       # We have been given a SPEC, check that it works out properly
 137       ifneq ($$(origin CONF), undefined)
 138         # We also have a CONF argument. We can't have both.
 139         $$(info Error: Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.)
 140         $$(error Cannot continue)
 141       endif
 142       ifneq ($$(origin CONF_NAME), undefined)
 143         # We also have a CONF_NAME argument. We can't have both.
 144         $$(info Error: Cannot use CONF_NAME=$$(CONF_NAME) and SPEC=$$(SPEC) at the same time. Choose one.)
 145         $$(error Cannot continue)
 146       endif
 147       ifeq ($$(wildcard $$(SPEC)),)
 148         $$(info Error: Cannot locate spec.gmk, given by SPEC=$$(SPEC).)
 149         $$(error Cannot continue)
 150       endif
 151       ifeq ($$(filter /%, $$(SPEC)),)
 152         # If given with relative path, make it absolute
 153         SPECS := $$(CURDIR)/$$(strip $$(SPEC))


 393         $(MKDIR) -p $(topdir)/build/compare-build
 394         $(MV) $(OUTPUTDIR) $(COMPARE_BUILD_OUTPUTDIR)
 395         $(MV) $(topdir)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUTDIR)
 396         $(RM) -r $(topdir)/build/.compare-build-temp
 397   endef
 398 
 399   # Do the actual comparison of two builds
 400   define CompareBuildDoComparison
 401         # Compare first and second build. Ignore any error code from compare.sh.
 402         $(ECHO) "Comparing between comparison rebuild (this/new) and baseline (other/old)"
 403         $(if $(COMPARE_BUILD_COMP_DIR), \
 404           +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
 405               -2dirs $(COMPARE_BUILD_OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) \
 406               $(OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) $(COMPARE_BUILD_IGNORE_RESULT)), \
 407           +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \
 408               -o $(OUTPUTDIR) $(COMPARE_BUILD_IGNORE_RESULT)) \
 409         )
 410   endef
 411 
 412   define PrintFailureReports
 413         $(if $(filter none, $(LOG_REPORT)), , \
 414           $(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log), \
 415             $(PRINTF) "\n=== Output from failing command(s) repeated here ===\n" $(NEWLINE) \
 416             $(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log)), \
 417                 $(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(NEWLINE) \
 418                 $(if $(filter all, $(LOG_REPORT)), \
 419                   $(GREP) -v -e "^Note: including file:" <  $(logfile) || true $(NEWLINE) \
 420                 , \
 421                   ($(GREP) -v -e "^Note: including file:" <  $(logfile) || true) | $(HEAD) -n 12 $(NEWLINE) \
 422                   if test `$(WC) -l < $(logfile)` -gt 12; then \
 423                     $(ECHO) "   ... (rest of output omitted)" ; \
 424                   fi $(NEWLINE) \
 425                 ) \
 426             ) \
 427             $(PRINTF) "\n* All command lines available in $(MAKESUPPORT_OUTPUTDIR)/failure-logs.\n" $(NEWLINE) \
 428             $(PRINTF) "=== End of repeated output ===\n" \
 429           ) \
 430         )
 431   endef
 432 
 433   define PrintBuildLogFailures
 434         $(if $(filter none, $(LOG_REPORT)), , \
 435           if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then  \
 436             $(PRINTF) "\n=== Make failed targets repeated here ===\n" ; \
 437             $(GREP) "recipe for target .* failed" $(BUILD_LOG) ; \
 438             $(PRINTF) "=== End of repeated output ===\n" ; \
 439             $(PRINTF) "\nHint: Try searching the build log for the name of the first failed target.\n" ; \
 440           else \
 441             $(PRINTF) "\nNo indication of failed target found.\n" ; \
 442             $(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \
 443           fi \
 444         )
 445   endef
 446 
 447   define RotateLogFiles
 448         $(RM) $(BUILD_LOG).old 2> /dev/null && \
 449         $(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
 450         $(if $(findstring true, $(LOG_PROFILE_TIMES_FILE)), \
 451           $(RM) $(BUILD_PROFILE_LOG).old 2> /dev/null && \
 452           $(MV) $(BUILD_PROFILE_LOG) $(BUILD_PROFILE_LOG).old 2> /dev/null || true \
 453         )
 454   endef
 455 
 456   define PrepareFailureLogs
 457         $(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \
 458         $(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs
 459         $(RM) $(MAKESUPPORT_OUTPUTDIR)/exit-with-error 2> /dev/null
 460   endef
 461 
 462   # Remove any javac server logs and port files. This
 463   # prevents a new make run to reuse the previous servers.
 464   define PrepareSmartJavac


 507             "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
 508             "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
 509             $(XARGS) $(CAT) | $(SORT) -k 2`" \
 510             "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \
 511             $(BUILD_LOG_PIPE)
 512   endef
 513 
 514   define ReportProfileTimes
 515     $(if $(findstring true, $(LOG_PROFILE_TIMES_LOG)), \
 516       [ ! -f $(BUILD_PROFILE_LOG) ] || \
 517       { $(ECHO) Begin $(notdir $(BUILD_PROFILE_LOG)) && \
 518         $(CAT) $(BUILD_PROFILE_LOG) && \
 519         $(ECHO) End $(notdir $(BUILD_PROFILE_LOG)); \
 520       } \
 521       $(BUILD_LOG_PIPE)
 522     )
 523   endef
 524 
 525 endif # HAS_SPEC
 526 
 527 # Look for a given option in the LOG variable, and if found, set a variable
 528 # and remove the option from the LOG variable
 529 # $1: The option to look for
 530 # $2: The variable to set to "true" if the option is found
 531 define ParseLogOption
 532   ifneq ($$(findstring $1, $$(LOG)),)
 533     override $2 := true
 534     # COMMA is defined in spec.gmk, but that is not included yet
 535     COMMA := ,
 536     # First try to remove ",<option>" if it exists, otherwise just remove "<option>"
 537     LOG_STRIPPED := $$(subst $1,, $$(subst $$(COMMA)$$(strip $1),, $$(LOG)))
 538     # We might have ended up with a leading comma. Remove it. Need override
 539     # since LOG is set from the command line.
 540     override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
 541   endif
 542 endef
 543 
 544 # Look for a given option with an assignment in the LOG variable, and if found,
 545 # set a variable to that value and remove the option from the LOG variable
 546 # $1: The option to look for
 547 # $2: The variable to set to the value of the option, if found
 548 define ParseLogValue
 549   ifneq ($$(findstring $1=, $$(LOG)),)
 550     # Make words of out comma-separated list and find the one with opt=val
 551     value := $$(strip $$(subst $$(strip $1)=,, $$(filter $$(strip $1)=%, $$(subst $$(COMMA), , $$(LOG)))))
 552     override $2 := $$(value)
 553     # COMMA is defined in spec.gmk, but that is not included yet
 554     COMMA := ,
 555     # First try to remove ",<option>" if it exists, otherwise just remove "<option>"
 556     LOG_STRIPPED := $$(subst $$(strip $1)=$$(value),, \
 557         $$(subst $$(COMMA)$$(strip $1)=$$(value),, $$(LOG)))
 558     # We might have ended up with a leading comma. Remove it. Need override
 559     # since LOG is set from the command line.
 560     override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
 561   endif
 562 endef
 563 
 564 
 565 define ParseLogLevel
 566   # Catch old-style VERBOSE= command lines.
 567   ifneq ($$(origin VERBOSE), undefined)
 568     $$(info Error: VERBOSE is deprecated. Use LOG=<warn|info|debug|trace> instead.)
 569     $$(error Cannot continue)
 570   endif
 571 
 572   # Setup logging according to LOG
 573 
 574   # If "nofile" is present, do not log to a file
 575   $$(eval $$(call ParseLogOption, nofile, LOG_NOFILE))
 576 
 577   # If "cmdline" is present, print all executes "important" command lines.
 578   $$(eval $$(call ParseLogOption, cmdlines, LOG_CMDLINES))
 579 
 580   # If "report" is present, use non-standard reporting options at build failure.
 581   $$(eval $$(call ParseLogValue, report, LOG_REPORT))
 582   ifneq ($$(LOG_REPORT), )
 583     ifeq ($$(filter $$(LOG_REPORT), none all default), )
 584       $$(info Error: LOG=report has invalid value: $$(LOG_REPORT).)
 585       $$(info Valid values: LOG=report=<none>|<all>|<default>)
 586       $$(error Cannot continue)
 587     endif
 588   endif
 589 
 590   # If "profile-to-log" is present, write shell times in build log
 591   $$(eval $$(call ParseLogOption, profile-to-log, LOG_PROFILE_TIMES_LOG))
 592 
 593   # If "profile" is present, write shell times in separate log file
 594   # IMPORTANT: $(ParseLogOption profile-to-log) should go first. Otherwise
 595   # parsing of 'LOG=debug,profile-to-log,nofile' ends up in the following error:
 596   # Error: LOG contains unknown option or log level: debug-to-log.
 597   $$(eval $$(call ParseLogOption, profile, LOG_PROFILE_TIMES_FILE))
 598 
 599   # Treat LOG=profile-to-log as if it were LOG=profile,profile-to-log
 600   LOG_PROFILE_TIMES_FILE := $$(firstword $$(LOG_PROFILE_TIMES_FILE) $$(LOG_PROFILE_TIMES_LOG))
 601 
 602   override LOG_LEVEL := $$(LOG)
 603 
 604   ifeq ($$(LOG_LEVEL),)
 605     # Set LOG to "warn" as default if not set
 606     override LOG_LEVEL := warn
 607   endif
 608 
 609   ifeq ($$(LOG_LEVEL), warn)
 610     override MAKE_LOG_FLAGS := -s
 611   else ifeq ($$(LOG_LEVEL), info)
 612     override MAKE_LOG_FLAGS := -s
 613   else ifeq ($$(LOG_LEVEL), debug)
 614     override MAKE_LOG_FLAGS :=
 615   else ifeq ($$(LOG_LEVEL), trace)
 616     override MAKE_LOG_FLAGS :=
 617   else
 618     $$(info Error: LOG contains unknown option or log level: $$(LOG).)
 619     $$(info LOG can be <level>[,<opt>[...]] where <opt> is nofile | cmdlines | profile | profile-to-log)
 620     $$(info and <level> is warn | info | debug | trace)
 621     $$(error Cannot continue)
 622   endif
 623 endef
 624 
 625 MAKE_LOG_VARS = $(foreach v, \
 626     LOG_LEVEL LOG_NOFILE LOG_CMDLINES LOG_REPORT LOG_PROFILE_TIMES_LOG \
 627     LOG_PROFILE_TIMES_FILE, \
 628     $v=$($v) \
 629 )
 630 
 631 endif # _INITSUPPORT_GMK
< prev index next >