make/Init.gmk
author lancea
Wed, 20 Jun 2018 16:08:14 -0400
branchJDK-8188051-branch
changeset 56798 3b438b3fef46
parent 50562 3903ab54107e
child 51678 2fdfe34f7262
permissions -rw-r--r--
JDK-8188051-branch removing files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
fd16c54261b3 Initial load
duke
parents:
diff changeset
     1
#
49568
3e9cb3562d83 8201320: Allow PrintFailureReports to be turned off
ihse
parents: 47928
diff changeset
     2
# Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
0
fd16c54261b3 Initial load
duke
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fd16c54261b3 Initial load
duke
parents:
diff changeset
     4
#
fd16c54261b3 Initial load
duke
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
fd16c54261b3 Initial load
duke
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
5499
eb0b3e373167 6943119: Rebrand source copyright notices
ohair
parents: 4309
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
0
fd16c54261b3 Initial load
duke
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
5499
eb0b3e373167 6943119: Rebrand source copyright notices
ohair
parents: 4309
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
0
fd16c54261b3 Initial load
duke
parents:
diff changeset
    10
#
fd16c54261b3 Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
fd16c54261b3 Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fd16c54261b3 Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fd16c54261b3 Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
fd16c54261b3 Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
fd16c54261b3 Initial load
duke
parents:
diff changeset
    16
#
fd16c54261b3 Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
fd16c54261b3 Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
fd16c54261b3 Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fd16c54261b3 Initial load
duke
parents:
diff changeset
    20
#
5499
eb0b3e373167 6943119: Rebrand source copyright notices
ohair
parents: 4309
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
eb0b3e373167 6943119: Rebrand source copyright notices
ohair
parents: 4309
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
eb0b3e373167 6943119: Rebrand source copyright notices
ohair
parents: 4309
diff changeset
    23
# questions.
0
fd16c54261b3 Initial load
duke
parents:
diff changeset
    24
#
fd16c54261b3 Initial load
duke
parents:
diff changeset
    25
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    26
################################################################################
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    27
# This is the bootstrapping part of the build. This file is included from the
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    28
# top level Makefile, and is responsible for launching the Main.gmk file with
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    29
# the proper make and the proper make arguments.
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    30
################################################################################
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    31
21759
e24e22311718 8027566: Remove the old build system
ihse
parents: 19758
diff changeset
    32
# This must be the first rule
e24e22311718 8027566: Remove the old build system
ihse
parents: 19758
diff changeset
    33
default:
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    34
.PHONY: default
17
bb9f330cd95a 6649672: Adjustments to OUTPUTDIR default and mkdirs to avoid empty directory clutter
ohair
parents: 16
diff changeset
    35
21759
e24e22311718 8027566: Remove the old build system
ihse
parents: 19758
diff changeset
    36
# Inclusion of this pseudo-target will cause make to execute this file
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    37
# serially, regardless of -j.
21759
e24e22311718 8027566: Remove the old build system
ihse
parents: 19758
diff changeset
    38
.NOTPARALLEL:
9618
83db8167c9f6 7043700: Regression for IcedTea builds
ohair
parents: 9309
diff changeset
    39
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    40
ifeq ($(HAS_SPEC),)
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    41
  ##############################################################################
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    42
  # This is the default mode. We have not been recursively called with a SPEC.
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    43
  ##############################################################################
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    44
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    45
  # Include our helper functions.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    46
  include $(topdir)/make/InitSupport.gmk
8441
30f5ad688d4a 7021753: Add a build times report
ohrstrom
parents: 7876
diff changeset
    47
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    48
  # Here are "global" targets, i.e. targets that can be executed without having
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    49
  # a configuration. This will define ALL_GLOBAL_TARGETS.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    50
  include $(topdir)/make/Help.gmk
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    51
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    52
  # Targets provided by Init.gmk.
32715
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
    53
  ALL_INIT_TARGETS := print-modules print-targets print-configuration \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43653
diff changeset
    54
      print-tests reconfigure pre-compare-build post-compare-build
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 22031
diff changeset
    55
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    56
  # CALLED_TARGETS is the list of targets that the user provided,
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    57
  # or "default" if unspecified.
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
    58
  CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    59
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    60
  # Extract non-global targets that require a spec file.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    61
  CALLED_SPEC_TARGETS := $(filter-out $(ALL_GLOBAL_TARGETS), $(CALLED_TARGETS))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    62
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    63
  # If we have only global targets, or if we are called with -qp (assuming an
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    64
  # external part, e.g. bash completion, is trying to understand our targets),
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    65
  # we will skip SPEC location and the sanity checks.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    66
  ifeq ($(CALLED_SPEC_TARGETS), )
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    67
    ONLY_GLOBAL_TARGETS := true
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    68
  endif
43653
576b07393f1d 8174064: Tab expansion broken for make
ihse
parents: 42300
diff changeset
    69
  ifeq ($(findstring p, $(MAKEFLAGS))$(findstring q, $(MAKEFLAGS)), pq)
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    70
    ONLY_GLOBAL_TARGETS := true
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    71
  endif
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    72
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    73
  ifeq ($(ONLY_GLOBAL_TARGETS), true)
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    74
    ############################################################################
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    75
    # We have only global targets, or are called with -pq.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    76
    ############################################################################
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    77
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    78
    ifeq ($(wildcard $(SPEC)), )
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    79
      # If we have no SPEC provided, we will just make a "best effort" target list.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    80
      # First try to grab any available pre-existing main-targets.gmk.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    81
      main_targets_file := $(firstword $(wildcard $(build_dir)/*/make-support/main-targets.gmk))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    82
      ifneq ($(main_targets_file), )
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    83
        # Extract the SPEC that corresponds to this main-targets.gmk file.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    84
        SPEC := $(patsubst %/make-support/main-targets.gmk, %/spec.gmk, $(main_targets_file))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    85
      else
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    86
        # None found, pick an arbitrary SPEC for which to generate a file
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    87
        SPEC := $(firstword $(all_spec_files))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    88
      endif
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    89
    endif
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    90
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    91
    ifneq ($(wildcard $(SPEC)), )
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    92
      $(eval $(call DefineMainTargets, LAZY, $(SPEC)))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    93
    else
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    94
      # If we have no configurations we can not provide any main targets.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    95
      ALL_MAIN_TARGETS :=
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    96
    endif
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    97
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    98
    ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
    99
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   100
    # Just list all our targets.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   101
    $(ALL_TARGETS):
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   102
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   103
    .PHONY: $(ALL_TARGETS)
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   104
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   105
  else
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   106
    ############################################################################
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   107
    # This is the normal case, we have been called from the command line by the
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   108
    # user and we need to call ourself back with a proper SPEC.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   109
    # We have at least one non-global target, so we need to find a spec file.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   110
    ############################################################################
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   111
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   112
    # Basic checks on environment and command line.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   113
    $(eval $(call CheckControlVariables))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   114
    $(eval $(call CheckDeprecatedEnvironment))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   115
    $(eval $(call CheckInvalidMakeFlags))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   116
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   117
    # Check that CONF_CHECK is valid.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   118
    $(eval $(call ParseConfCheckOption))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   119
44465
26fabd8abee9 8177770: Need more precise control on build system logging
asemenyuk
parents: 44027
diff changeset
   120
    # Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE, MAKE_LOG_VARS and MAKE_LOG_FLAGS.
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   121
    $(eval $(call ParseLogLevel))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   122
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   123
    # After this SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails).
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   124
    $(eval $(call ParseConfAndSpec))
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 22031
diff changeset
   125
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   126
    # Extract main targets from Main.gmk using the spec(s) provided. In theory,
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   127
    # with multiple specs, we should find the intersection of targets provided
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   128
    # by all specs, but we approximate this by an arbitrary spec from the list.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   129
    # This will setup ALL_MAIN_TARGETS.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   130
    $(eval $(call DefineMainTargets, FORCE, $(firstword $(SPECS))))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   131
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   132
    # Separate called targets depending on type.
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   133
    INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS))
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   134
    MAIN_TARGETS := $(filter $(ALL_MAIN_TARGETS), $(CALLED_SPEC_TARGETS))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   135
    SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(MAIN_TARGETS))
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   136
    PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS))
874
638ddad10e12 6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents: 668
diff changeset
   137
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   138
    # The spec files depend on the autoconf source code. This check makes sure
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   139
    # the configuration is up to date after changes to configure.
47313
eb28be8f935d 8188768: Fix interaction between make and autoconf after consolidation
ihse
parents: 47253
diff changeset
   140
    $(SPECS): $(wildcard $(topdir)/make/autoconf/*) \
eb28be8f935d 8188768: Fix interaction between make and autoconf after consolidation
ihse
parents: 47253
diff changeset
   141
            $(if $(CUSTOM_CONFIG_DIR), $(wildcard $(CUSTOM_CONFIG_DIR)/*))
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   142
        ifeq ($(CONF_CHECK), fail)
47313
eb28be8f935d 8188768: Fix interaction between make and autoconf after consolidation
ihse
parents: 47253
diff changeset
   143
	  @echo Error: The configuration is not up to date for \
eb28be8f935d 8188768: Fix interaction between make and autoconf after consolidation
ihse
parents: 47253
diff changeset
   144
	      "'$(lastword $(subst /, , $(dir $@)))'."
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   145
	  $(call PrintConfCheckFailed)
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   146
	  @exit 2
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   147
        else ifeq ($(CONF_CHECK), auto)
47313
eb28be8f935d 8188768: Fix interaction between make and autoconf after consolidation
ihse
parents: 47253
diff changeset
   148
	  @echo Note: The configuration is not up to date for \
eb28be8f935d 8188768: Fix interaction between make and autoconf after consolidation
ihse
parents: 47253
diff changeset
   149
	      "'$(lastword $(subst /, , $(dir $@)))'."
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   150
	  @( cd $(topdir) && \
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   151
	      $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   152
	      SPEC=$@ HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   153
	      reconfigure )
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   154
        else ifeq ($(CONF_CHECK), ignore)
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   155
          # Do nothing
26398
ca1f84f97e20 8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents: 26128
diff changeset
   156
        endif
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents: 22031
diff changeset
   157
36050
f6590b6e5e97 8150203: Incremental update from build-infra project
ihse
parents: 35744
diff changeset
   158
    # Do not let make delete spec files even if aborted while doing a reconfigure
f6590b6e5e97 8150203: Incremental update from build-infra project
ihse
parents: 35744
diff changeset
   159
    .PRECIOUS: $(SPECS)
f6590b6e5e97 8150203: Incremental update from build-infra project
ihse
parents: 35744
diff changeset
   160
42300
218374d35efd 8039103: "explicitly" is misspelled as "explicitely" in configure scripts
ihse
parents: 41458
diff changeset
   161
    # Unless reconfigure is explicitly called, let all main targets depend on
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   162
    # the spec files to be up to date.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   163
    ifeq ($(findstring reconfigure, $(INIT_TARGETS)), )
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   164
      $(MAIN_TARGETS): $(SPECS)
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   165
    endif
874
638ddad10e12 6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents: 668
diff changeset
   166
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   167
    make-info:
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   168
        ifneq ($(findstring $(LOG_LEVEL),info debug trace),)
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   169
	  $(info Running make as '$(strip $(MAKE) $(MFLAGS) \
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   170
	      $(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))')
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   171
        endif
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   172
32715
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   173
    MAKE_INIT_WITH_SPEC_ARGUMENTS := ACTUAL_TOPDIR=$(topdir) \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   174
        USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \
44465
26fabd8abee9 8177770: Need more precise control on build system logging
asemenyuk
parents: 44027
diff changeset
   175
        $(MAKE_LOG_VARS) \
32715
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   176
        INIT_TARGETS="$(INIT_TARGETS)" \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   177
        SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   178
        PARALLEL_TARGETS="$(PARALLEL_TARGETS)"
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   179
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   180
    # Now the init and main targets will be called, once for each SPEC. The
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   181
    # recipe will be run once for every target specified, but we only want to
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   182
    # execute the recipe a single time, hence the TARGET_DONE with a dummy
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   183
    # command if true.
32715
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   184
    # The COMPARE_BUILD part implements special support for makefile development.
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   185
    $(ALL_INIT_TARGETS) $(ALL_MAIN_TARGETS): make-info
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   186
	@$(if $(TARGET_DONE), \
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   187
	  true \
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   188
	, \
32715
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   189
	  ( cd $(topdir) && \
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   190
	  $(foreach spec, $(SPECS), \
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   191
	    $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
32715
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   192
	        SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   193
	        main && \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   194
	    $(if $(and $(COMPARE_BUILD), $(PARALLEL_TARGETS)), \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   195
	        $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   196
	            SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   197
	            COMPARE_BUILD="$(COMPARE_BUILD)" pre-compare-build && \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   198
	        $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   199
	            SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   200
	            COMPARE_BUILD="$(COMPARE_BUILD)" main && \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   201
	        $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   202
	            SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   203
	            COMPARE_BUILD="$(COMPARE_BUILD)" post-compare-build && \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   204
	    ) \
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   205
	  ) true ) \
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   206
	  $(eval TARGET_DONE=true) \
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   207
	)
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   208
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   209
    .PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)
0
fd16c54261b3 Initial load
duke
parents:
diff changeset
   210
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   211
  endif # $(ONLY_GLOBAL_TARGETS)!=true
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   212
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   213
else # HAS_SPEC=true
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   214
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   215
  ##############################################################################
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   216
  # Now we have a spec. This part provides the "main" target that acts as a
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   217
  # trampoline to call the Main.gmk with the value of $(MAKE) found in the spec
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   218
  # file.
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   219
  ##############################################################################
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   220
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   221
  include $(SPEC)
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   222
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   223
  # Our helper functions.
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   224
  include $(TOPDIR)/make/InitSupport.gmk
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   225
32715
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   226
  # Parse COMPARE_BUILD (for makefile development)
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   227
  $(eval $(call ParseCompareBuild))
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   228
49568
3e9cb3562d83 8201320: Allow PrintFailureReports to be turned off
ihse
parents: 47928
diff changeset
   229
  # If no LOG= was given on command line, but we have a non-standard default
3e9cb3562d83 8201320: Allow PrintFailureReports to be turned off
ihse
parents: 47928
diff changeset
   230
  # value, use that instead and re-parse log level.
3e9cb3562d83 8201320: Allow PrintFailureReports to be turned off
ihse
parents: 47928
diff changeset
   231
  ifeq ($(LOG), )
3e9cb3562d83 8201320: Allow PrintFailureReports to be turned off
ihse
parents: 47928
diff changeset
   232
    ifneq ($(DEFAULT_LOG), )
3e9cb3562d83 8201320: Allow PrintFailureReports to be turned off
ihse
parents: 47928
diff changeset
   233
      override LOG := $(DEFAULT_LOG)
3e9cb3562d83 8201320: Allow PrintFailureReports to be turned off
ihse
parents: 47928
diff changeset
   234
      $(eval $(call ParseLogLevel))
3e9cb3562d83 8201320: Allow PrintFailureReports to be turned off
ihse
parents: 47928
diff changeset
   235
    endif
3e9cb3562d83 8201320: Allow PrintFailureReports to be turned off
ihse
parents: 47928
diff changeset
   236
  endif
3e9cb3562d83 8201320: Allow PrintFailureReports to be turned off
ihse
parents: 47928
diff changeset
   237
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   238
  ifeq ($(LOG_NOFILE), true)
35008
ef0cd710989f 8146403: Windows build can be faster
erikj
parents: 33572
diff changeset
   239
    # Disable build log if LOG=[level,]nofile was given
ef0cd710989f 8146403: Windows build can be faster
erikj
parents: 33572
diff changeset
   240
    override BUILD_LOG_PIPE :=
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   241
  endif
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   242
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   243
  ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   244
    OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   245
  endif
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   246
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   247
  ##############################################################################
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   248
  # Init targets
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   249
  ##############################################################################
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   250
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   251
  print-modules:
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   252
	( cd $(TOPDIR) && \
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   253
	    $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   254
	    NO_RECIPES=true print-modules )
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   255
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   256
  print-targets:
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   257
	( cd $(TOPDIR) && \
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   258
	    $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   259
	    NO_RECIPES=true print-targets )
28902
0c09b47449c8 8069064: Various improvements and fixes in build system
ihse
parents: 28286
diff changeset
   260
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43653
diff changeset
   261
  print-tests:
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43653
diff changeset
   262
	( cd $(TOPDIR) && \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43653
diff changeset
   263
	    $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43653
diff changeset
   264
	    NO_RECIPES=true print-tests )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43653
diff changeset
   265
32461
e1cfbafc4e9c 8135180: Print configure arguments using make print-configuration
ihse
parents: 32344
diff changeset
   266
  print-configuration:
e1cfbafc4e9c 8135180: Print configure arguments using make print-configuration
ihse
parents: 32344
diff changeset
   267
	  $(ECHO) $(CONFIGURE_COMMAND_LINE)
e1cfbafc4e9c 8135180: Print configure arguments using make print-configuration
ihse
parents: 32344
diff changeset
   268
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   269
  reconfigure:
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   270
        ifneq ($(CONFIGURE_COMMAND_LINE), )
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   271
	  $(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   272
        else
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   273
	  $(ECHO) "Re-running configure using default settings"
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   274
        endif
47253
92fd0e04e0e1 8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents: 47217
diff changeset
   275
	( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \
47346
ea082b202a23 8189263: Introduce CUSTOM_ROOT
ihse
parents: 47313
diff changeset
   276
	    CUSTOM_ROOT="$(CUSTOM_ROOT)" \
47313
eb28be8f935d 8188768: Fix interaction between make and autoconf after consolidation
ihse
parents: 47253
diff changeset
   277
	    CUSTOM_CONFIG_DIR="$(CUSTOM_CONFIG_DIR)" \
47346
ea082b202a23 8189263: Introduce CUSTOM_ROOT
ihse
parents: 47313
diff changeset
   278
	    $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   279
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   280
  ##############################################################################
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   281
  # The main target, for delegating into Main.gmk
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   282
  ##############################################################################
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   283
32715
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   284
  MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE)
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 36050
diff changeset
   285
  # If building the default target, add what they are to the description.
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 36050
diff changeset
   286
  DESCRIPTION_TARGETS := $(strip $(MAIN_TARGETS))
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 36050
diff changeset
   287
  ifeq ($(DESCRIPTION_TARGETS), default)
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 36050
diff changeset
   288
    DESCRIPTION_TARGETS += ($(DEFAULT_MAKE_TARGET))
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 36050
diff changeset
   289
  endif
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   290
  TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 36050
diff changeset
   291
      '$(strip $(DESCRIPTION_TARGETS))' in configuration '$(CONF_NAME)'
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   292
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   293
  # MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls.
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   294
  # We need to clear it of the init-specific variables. The user-specified
42300
218374d35efd 8039103: "explicitly" is misspelled as "explicitely" in configure scripts
ihse
parents: 41458
diff changeset
   295
  # variables are explicitly propagated using $(USER_MAKE_VARS).
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   296
  main: MAKEOVERRIDES :=
0
fd16c54261b3 Initial load
duke
parents:
diff changeset
   297
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   298
  main: $(INIT_TARGETS)
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   299
        ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   300
	  $(call RotateLogFiles)
35008
ef0cd710989f 8146403: Windows build can be faster
erikj
parents: 33572
diff changeset
   301
	  $(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   302
          ifneq ($(SEQUENTIAL_TARGETS), )
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   303
            # Don't touch build output dir since we might be cleaning. That
35008
ef0cd710989f 8146403: Windows build can be faster
erikj
parents: 33572
diff changeset
   304
            # means no log pipe.
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   305
	    ( cd $(TOPDIR) && \
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   306
	        $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   307
	        $(SEQUENTIAL_TARGETS) )
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   308
          endif
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   309
          ifneq ($(PARALLEL_TARGETS), )
50562
3903ab54107e 8204664: PrepareFailureLogs should be done after sequential make targets
ihse
parents: 49841
diff changeset
   310
	    $(call PrepareFailureLogs)
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   311
	    $(call StartGlobalTimer)
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   312
	    $(call PrepareSmartJavac)
49841
b39ba7ae45cc 8201788: Number of make jobs wrong for bootcycle-images target
sgehwolf
parents: 49568
diff changeset
   313
            # JOBS will only be empty for a bootcycle-images recursive call
b39ba7ae45cc 8201788: Number of make jobs wrong for bootcycle-images target
sgehwolf
parents: 49568
diff changeset
   314
            # or if specified via a make argument directly. In those cases
b39ba7ae45cc 8201788: Number of make jobs wrong for bootcycle-images target
sgehwolf
parents: 49568
diff changeset
   315
            # treat it as NOT using jobs at all.
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   316
	    ( cd $(TOPDIR) && \
35008
ef0cd710989f 8146403: Windows build can be faster
erikj
parents: 33572
diff changeset
   317
	        $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
49841
b39ba7ae45cc 8201788: Number of make jobs wrong for bootcycle-images target
sgehwolf
parents: 49568
diff changeset
   318
                    $(if $(JOBS), -j $(JOBS)) \
b39ba7ae45cc 8201788: Number of make jobs wrong for bootcycle-images target
sgehwolf
parents: 49568
diff changeset
   319
	            -f make/Main.gmk $(USER_MAKE_VARS) \
35008
ef0cd710989f 8146403: Windows build can be faster
erikj
parents: 33572
diff changeset
   320
	            $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
ef0cd710989f 8146403: Windows build can be faster
erikj
parents: 33572
diff changeset
   321
	        ( exitcode=$$? && \
ef0cd710989f 8146403: Windows build can be faster
erikj
parents: 33572
diff changeset
   322
	        $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
ef0cd710989f 8146403: Windows build can be faster
erikj
parents: 33572
diff changeset
   323
	            $(BUILD_LOG_PIPE) && \
32344
0b288e0efcfa 8062618: Create a build failure summary at end of build log
ihse
parents: 30415
diff changeset
   324
	        cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
0b288e0efcfa 8062618: Create a build failure summary at end of build log
ihse
parents: 30415
diff changeset
   325
	            HAS_SPEC=true on-failure ; \
0b288e0efcfa 8062618: Create a build failure summary at end of build log
ihse
parents: 30415
diff changeset
   326
	        exit $$exitcode ) )
29788
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   327
	    $(call CleanupSmartJavac)
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   328
	    $(call StopGlobalTimer)
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   329
	    $(call ReportBuildTimes)
b581a3d9db41 8076465: New Init.gmk needs improvements
ihse
parents: 29663
diff changeset
   330
          endif
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43653
diff changeset
   331
	  if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43653
diff changeset
   332
	    exit 1 ; \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents: 43653
diff changeset
   333
	  fi
35008
ef0cd710989f 8146403: Windows build can be faster
erikj
parents: 33572
diff changeset
   334
	  $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
44465
26fabd8abee9 8177770: Need more precise control on build system logging
asemenyuk
parents: 44027
diff changeset
   335
	  $(call ReportProfileTimes)
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   336
        endif
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   337
32344
0b288e0efcfa 8062618: Create a build failure summary at end of build log
ihse
parents: 30415
diff changeset
   338
    on-failure:
40621
c55ef7ed9aa0 8165314: Javac server process left running if build fails on Windows
erikj
parents: 37649
diff changeset
   339
	$(call CleanupSmartJavac)
c55ef7ed9aa0 8165314: Javac server process left running if build fails on Windows
erikj
parents: 37649
diff changeset
   340
	$(call StopGlobalTimer)
c55ef7ed9aa0 8165314: Javac server process left running if build fails on Windows
erikj
parents: 37649
diff changeset
   341
	$(call ReportBuildTimes)
33572
b74ceb2d2d20 8141696: Improve COMPARE_BUILD
ihse
parents: 33051
diff changeset
   342
	$(call PrintFailureReports)
b74ceb2d2d20 8141696: Improve COMPARE_BUILD
ihse
parents: 33051
diff changeset
   343
	$(call PrintBuildLogFailures)
44465
26fabd8abee9 8177770: Need more precise control on build system logging
asemenyuk
parents: 44027
diff changeset
   344
	$(call ReportProfileTimes)
47928
fb62d4519338 8191715: Update documentation pointing to "common" directory
ihse
parents: 47456
diff changeset
   345
	$(PRINTF) "Hint: See doc/building.html#troubleshooting for assistance.\n\n"
33572
b74ceb2d2d20 8141696: Improve COMPARE_BUILD
ihse
parents: 33051
diff changeset
   346
        ifneq ($(COMPARE_BUILD), )
b74ceb2d2d20 8141696: Improve COMPARE_BUILD
ihse
parents: 33051
diff changeset
   347
	  $(call CleanupCompareBuild)
32344
0b288e0efcfa 8062618: Create a build failure summary at end of build log
ihse
parents: 30415
diff changeset
   348
        endif
0b288e0efcfa 8062618: Create a build failure summary at end of build log
ihse
parents: 30415
diff changeset
   349
32715
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   350
    # Support targets for COMPARE_BUILD, used for makefile development
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   351
    pre-compare-build:
35370
f9b430645a18 8148120: Incremental update from build-infra project
ihse
parents: 35008
diff changeset
   352
	$(call WaitForSmartJavacFinish)
33572
b74ceb2d2d20 8141696: Improve COMPARE_BUILD
ihse
parents: 33051
diff changeset
   353
	$(call PrepareCompareBuild)
32715
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   354
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   355
    post-compare-build:
35744
4f5e0998b6e9 8149479: Fix compare.sh to have a clean baseline with COMPARE_BUILD
erikj
parents: 35444
diff changeset
   356
	$(call WaitForSmartJavacFinish)
33572
b74ceb2d2d20 8141696: Improve COMPARE_BUILD
ihse
parents: 33051
diff changeset
   357
	$(call CleanupCompareBuild)
b74ceb2d2d20 8141696: Improve COMPARE_BUILD
ihse
parents: 33051
diff changeset
   358
	$(call CompareBuildDoComparison)
32715
4d558a41a1ec 8136695: Automatic build comparison with COMPARE_BUILD
ihse
parents: 32461
diff changeset
   359
32344
0b288e0efcfa 8062618: Create a build failure summary at end of build log
ihse
parents: 30415
diff changeset
   360
  .PHONY: print-targets print-modules reconfigure main on-failure
29662
78c47f0002c3 8076060: Improve make bootstrap process
ihse
parents: 28902
diff changeset
   361
endif