Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2012, 2015, 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 |
| 23 | # questions. |
| 24 | # |
| 25 | |
| 26 | ################################################################################ |
| 27 | # This is the bootstrapping part of the build. This file is included from the |
| 28 | # top level Makefile, and is responsible for launching the Main.gmk file with |
| 29 | # the proper make and the proper make arguments. |
| 30 | ################################################################################ |
| 31 | |
| 32 | # This must be the first rule |
| 33 | default: |
| 34 | .PHONY: default |
| 35 | |
| 36 | # Inclusion of this pseudo-target will cause make to execute this file |
| 37 | # serially, regardless of -j. |
| 38 | .NOTPARALLEL: |
| 39 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 40 | ifeq ($(HAS_SPEC),) |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 41 | ############################################################################## |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 42 | # This is the default mode. We have not been recursively called with a SPEC. |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 43 | ############################################################################## |
| 44 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 45 | # Include our helper functions. |
| 46 | include $(topdir)/make/InitSupport.gmk |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 47 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 48 | # Here are "global" targets, i.e. targets that can be executed without having |
| 49 | # a configuration. This will define ALL_GLOBAL_TARGETS. |
| 50 | include $(topdir)/make/Help.gmk |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 51 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 52 | # Targets provided by Init.gmk. |
Magnus Ihse Bursie | 19b025d | 2015-09-21 09:32:07 +0200 | [diff] [blame] | 53 | ALL_INIT_TARGETS := print-modules print-targets print-configuration \ |
| 54 | reconfigure pre-compare-build post-compare-build |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 55 | |
| 56 | # CALLED_TARGETS is the list of targets that the user provided, |
| 57 | # or "default" if unspecified. |
| 58 | CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default) |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 59 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 60 | # Extract non-global targets that require a spec file. |
| 61 | CALLED_SPEC_TARGETS := $(filter-out $(ALL_GLOBAL_TARGETS), $(CALLED_TARGETS)) |
| 62 | |
| 63 | # If we have only global targets, or if we are called with -qp (assuming an |
| 64 | # external part, e.g. bash completion, is trying to understand our targets), |
| 65 | # we will skip SPEC location and the sanity checks. |
| 66 | ifeq ($(CALLED_SPEC_TARGETS), ) |
| 67 | ONLY_GLOBAL_TARGETS := true |
| 68 | endif |
| 69 | ifneq ($(findstring qp, $(MAKEFLAGS)),) |
| 70 | ONLY_GLOBAL_TARGETS := true |
| 71 | endif |
| 72 | |
| 73 | ifeq ($(ONLY_GLOBAL_TARGETS), true) |
| 74 | ############################################################################ |
| 75 | # We have only global targets, or are called with -pq. |
| 76 | ############################################################################ |
| 77 | |
| 78 | ifeq ($(wildcard $(SPEC)), ) |
| 79 | # If we have no SPEC provided, we will just make a "best effort" target list. |
| 80 | # First try to grab any available pre-existing main-targets.gmk. |
| 81 | main_targets_file := $(firstword $(wildcard $(build_dir)/*/make-support/main-targets.gmk)) |
| 82 | ifneq ($(main_targets_file), ) |
| 83 | # Extract the SPEC that corresponds to this main-targets.gmk file. |
| 84 | SPEC := $(patsubst %/make-support/main-targets.gmk, %/spec.gmk, $(main_targets_file)) |
| 85 | else |
| 86 | # None found, pick an arbitrary SPEC for which to generate a file |
| 87 | SPEC := $(firstword $(all_spec_files)) |
| 88 | endif |
| 89 | endif |
| 90 | |
| 91 | ifneq ($(wildcard $(SPEC)), ) |
| 92 | $(eval $(call DefineMainTargets, LAZY, $(SPEC))) |
| 93 | else |
| 94 | # If we have no configurations we can not provide any main targets. |
| 95 | ALL_MAIN_TARGETS := |
| 96 | endif |
| 97 | |
| 98 | ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)) |
| 99 | |
| 100 | # Just list all our targets. |
| 101 | $(ALL_TARGETS): |
| 102 | |
| 103 | .PHONY: $(ALL_TARGETS) |
| 104 | |
| 105 | else |
| 106 | ############################################################################ |
| 107 | # This is the normal case, we have been called from the command line by the |
| 108 | # user and we need to call ourself back with a proper SPEC. |
| 109 | # We have at least one non-global target, so we need to find a spec file. |
| 110 | ############################################################################ |
| 111 | |
| 112 | # Basic checks on environment and command line. |
| 113 | $(eval $(call CheckControlVariables)) |
| 114 | $(eval $(call CheckDeprecatedEnvironment)) |
| 115 | $(eval $(call CheckInvalidMakeFlags)) |
| 116 | |
| 117 | # Check that CONF_CHECK is valid. |
| 118 | $(eval $(call ParseConfCheckOption)) |
| 119 | |
| 120 | # Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE and MAKE_LOG_FLAGS. |
| 121 | $(eval $(call ParseLogLevel)) |
| 122 | |
| 123 | # After this SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails). |
| 124 | $(eval $(call ParseConfAndSpec)) |
| 125 | |
| 126 | # Extract main targets from Main.gmk using the spec(s) provided. In theory, |
| 127 | # with multiple specs, we should find the intersection of targets provided |
| 128 | # by all specs, but we approximate this by an arbitrary spec from the list. |
| 129 | # This will setup ALL_MAIN_TARGETS. |
| 130 | $(eval $(call DefineMainTargets, FORCE, $(firstword $(SPECS)))) |
| 131 | |
| 132 | # Separate called targets depending on type. |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 133 | INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS)) |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 134 | MAIN_TARGETS := $(filter $(ALL_MAIN_TARGETS), $(CALLED_SPEC_TARGETS)) |
| 135 | SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(MAIN_TARGETS)) |
| 136 | PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS)) |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 137 | |
| 138 | # The spec files depend on the autoconf source code. This check makes sure |
| 139 | # the configuration is up to date after changes to configure. |
Magnus Ihse Bursie | a6bb026 | 2015-10-22 15:54:15 +0200 | [diff] [blame] | 140 | CUSTOM_CONFIG_DIR ?= $(topdir)/closed/autoconf |
| 141 | |
| 142 | $(SPECS): $(wildcard $(topdir)/common/autoconf/*) $(wildcard $(CUSTOM_CONFIG_DIR)/*) |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 143 | ifeq ($(CONF_CHECK), fail) |
| 144 | @echo "Error: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'." |
| 145 | $(call PrintConfCheckFailed) |
| 146 | @exit 2 |
| 147 | else ifeq ($(CONF_CHECK), auto) |
| 148 | @echo "Note: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'." |
| 149 | @( cd $(topdir) && \ |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 150 | $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \ |
| 151 | SPEC=$@ HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \ |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 152 | reconfigure ) |
| 153 | else ifeq ($(CONF_CHECK), ignore) |
| 154 | # Do nothing |
| 155 | endif |
| 156 | |
Magnus Ihse Bursie | 2011115 | 2016-02-22 11:22:55 +0100 | [diff] [blame] | 157 | # Do not let make delete spec files even if aborted while doing a reconfigure |
| 158 | .PRECIOUS: $(SPECS) |
| 159 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 160 | # Unless reconfigure is explicitely called, let all main targets depend on |
| 161 | # the spec files to be up to date. |
| 162 | ifeq ($(findstring reconfigure, $(INIT_TARGETS)), ) |
| 163 | $(MAIN_TARGETS): $(SPECS) |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 164 | endif |
| 165 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 166 | make-info: |
| 167 | ifneq ($(findstring $(LOG_LEVEL),info debug trace),) |
| 168 | $(info Running make as '$(strip $(MAKE) $(MFLAGS) \ |
| 169 | $(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))') |
| 170 | endif |
| 171 | |
Magnus Ihse Bursie | 19b025d | 2015-09-21 09:32:07 +0200 | [diff] [blame] | 172 | MAKE_INIT_WITH_SPEC_ARGUMENTS := ACTUAL_TOPDIR=$(topdir) \ |
| 173 | USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \ |
Magnus Ihse Bursie | 7553186 | 2016-02-02 15:02:55 +0100 | [diff] [blame] | 174 | LOG_LEVEL=$(LOG_LEVEL) LOG_NOFILE=$(LOG_NOFILE) LOG_CMDLINES=$(LOG_CMDLINES) \ |
Magnus Ihse Bursie | 19b025d | 2015-09-21 09:32:07 +0200 | [diff] [blame] | 175 | INIT_TARGETS="$(INIT_TARGETS)" \ |
| 176 | SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \ |
| 177 | PARALLEL_TARGETS="$(PARALLEL_TARGETS)" |
| 178 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 179 | # Now the init and main targets will be called, once for each SPEC. The |
| 180 | # recipe will be run once for every target specified, but we only want to |
| 181 | # execute the recipe a single time, hence the TARGET_DONE with a dummy |
| 182 | # command if true. |
Magnus Ihse Bursie | 19b025d | 2015-09-21 09:32:07 +0200 | [diff] [blame] | 183 | # The COMPARE_BUILD part implements special support for makefile development. |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 184 | $(ALL_INIT_TARGETS) $(ALL_MAIN_TARGETS): make-info |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 185 | @$(if $(TARGET_DONE), \ |
| 186 | true \ |
| 187 | , \ |
Magnus Ihse Bursie | 19b025d | 2015-09-21 09:32:07 +0200 | [diff] [blame] | 188 | ( cd $(topdir) && \ |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 189 | $(foreach spec, $(SPECS), \ |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 190 | $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \ |
Magnus Ihse Bursie | 19b025d | 2015-09-21 09:32:07 +0200 | [diff] [blame] | 191 | SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \ |
| 192 | main && \ |
| 193 | $(if $(and $(COMPARE_BUILD), $(PARALLEL_TARGETS)), \ |
| 194 | $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \ |
| 195 | SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \ |
| 196 | COMPARE_BUILD="$(COMPARE_BUILD)" pre-compare-build && \ |
| 197 | $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \ |
| 198 | SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \ |
| 199 | COMPARE_BUILD="$(COMPARE_BUILD)" main && \ |
| 200 | $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \ |
| 201 | SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \ |
| 202 | COMPARE_BUILD="$(COMPARE_BUILD)" post-compare-build && \ |
| 203 | ) \ |
| 204 | ) true ) \ |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 205 | $(eval TARGET_DONE=true) \ |
| 206 | ) |
| 207 | |
| 208 | .PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS) |
| 209 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 210 | endif # $(ONLY_GLOBAL_TARGETS)!=true |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 211 | |
| 212 | else # HAS_SPEC=true |
| 213 | |
| 214 | ############################################################################## |
| 215 | # Now we have a spec. This part provides the "main" target that acts as a |
| 216 | # trampoline to call the Main.gmk with the value of $(MAKE) found in the spec |
| 217 | # file. |
| 218 | ############################################################################## |
| 219 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 220 | include $(SPEC) |
| 221 | |
| 222 | # Our helper functions. |
| 223 | include $(TOPDIR)/make/InitSupport.gmk |
| 224 | |
| 225 | # Verify that the spec file we included seems okay. |
| 226 | $(eval $(call CheckSpecSanity)) |
| 227 | |
Magnus Ihse Bursie | 19b025d | 2015-09-21 09:32:07 +0200 | [diff] [blame] | 228 | # Parse COMPARE_BUILD (for makefile development) |
| 229 | $(eval $(call ParseCompareBuild)) |
| 230 | |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 231 | ifeq ($(LOG_NOFILE), true) |
Erik Joelsson | 8c55662 | 2016-01-16 13:01:43 +0100 | [diff] [blame] | 232 | # Disable build log if LOG=[level,]nofile was given |
| 233 | override BUILD_LOG_PIPE := |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 234 | endif |
| 235 | |
| 236 | ifeq ($(OUTPUT_SYNC_SUPPORTED), true) |
| 237 | OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC) |
| 238 | endif |
| 239 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 240 | ############################################################################## |
| 241 | # Init targets |
| 242 | ############################################################################## |
| 243 | |
| 244 | print-modules: |
| 245 | ( cd $(TOPDIR) && \ |
| 246 | $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \ |
| 247 | NO_RECIPES=true print-modules ) |
| 248 | |
| 249 | print-targets: |
| 250 | ( cd $(TOPDIR) && \ |
| 251 | $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \ |
| 252 | NO_RECIPES=true print-targets ) |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 253 | |
Magnus Ihse Bursie | 4ce6bdb | 2015-09-09 09:44:57 +0200 | [diff] [blame] | 254 | print-configuration: |
| 255 | $(ECHO) $(CONFIGURE_COMMAND_LINE) |
| 256 | |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 257 | reconfigure: |
| 258 | ifneq ($(CONFIGURE_COMMAND_LINE), ) |
| 259 | $(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'" |
| 260 | else |
| 261 | $(ECHO) "Re-running configure using default settings" |
| 262 | endif |
| 263 | ( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \ |
| 264 | $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) ) |
| 265 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 266 | ############################################################################## |
| 267 | # The main target, for delegating into Main.gmk |
| 268 | ############################################################################## |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 269 | |
Magnus Ihse Bursie | 19b025d | 2015-09-21 09:32:07 +0200 | [diff] [blame] | 270 | MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) |
Erik Joelsson | 5914461 | 2016-04-27 14:30:32 +0200 | [diff] [blame] | 271 | # If building the default target, add what they are to the description. |
| 272 | DESCRIPTION_TARGETS := $(strip $(MAIN_TARGETS)) |
| 273 | ifeq ($(DESCRIPTION_TARGETS), default) |
| 274 | DESCRIPTION_TARGETS += ($(DEFAULT_MAKE_TARGET)) |
| 275 | endif |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 276 | TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \ |
Erik Joelsson | 5914461 | 2016-04-27 14:30:32 +0200 | [diff] [blame] | 277 | '$(strip $(DESCRIPTION_TARGETS))' in configuration '$(CONF_NAME)' |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 278 | |
| 279 | # MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls. |
| 280 | # We need to clear it of the init-specific variables. The user-specified |
| 281 | # variables are explicitely propagated using $(USER_MAKE_VARS). |
| 282 | main: MAKEOVERRIDES := |
| 283 | |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 284 | main: $(INIT_TARGETS) |
| 285 | ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), ) |
| 286 | $(call RotateLogFiles) |
Magnus Ihse Bursie | 6047d89 | 2015-09-03 11:05:49 +0200 | [diff] [blame] | 287 | $(call PrepareFailureLogs) |
Erik Joelsson | 8c55662 | 2016-01-16 13:01:43 +0100 | [diff] [blame] | 288 | $(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE) |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 289 | ifneq ($(SEQUENTIAL_TARGETS), ) |
| 290 | # Don't touch build output dir since we might be cleaning. That |
Erik Joelsson | 8c55662 | 2016-01-16 13:01:43 +0100 | [diff] [blame] | 291 | # means no log pipe. |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 292 | ( cd $(TOPDIR) && \ |
| 293 | $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \ |
| 294 | $(SEQUENTIAL_TARGETS) ) |
| 295 | endif |
| 296 | ifneq ($(PARALLEL_TARGETS), ) |
| 297 | $(call StartGlobalTimer) |
| 298 | $(call PrepareSmartJavac) |
| 299 | ( cd $(TOPDIR) && \ |
Erik Joelsson | 8c55662 | 2016-01-16 13:01:43 +0100 | [diff] [blame] | 300 | $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \ |
Magnus Ihse Bursie | 6047d89 | 2015-09-03 11:05:49 +0200 | [diff] [blame] | 301 | -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \ |
Erik Joelsson | 8c55662 | 2016-01-16 13:01:43 +0100 | [diff] [blame] | 302 | $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \ |
| 303 | ( exitcode=$$? && \ |
| 304 | $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \ |
| 305 | $(BUILD_LOG_PIPE) && \ |
Magnus Ihse Bursie | 6047d89 | 2015-09-03 11:05:49 +0200 | [diff] [blame] | 306 | cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \ |
| 307 | HAS_SPEC=true on-failure ; \ |
| 308 | exit $$exitcode ) ) |
Magnus Ihse Bursie | 7ba3b45 | 2015-04-07 09:06:24 +0200 | [diff] [blame] | 309 | $(call CleanupSmartJavac) |
| 310 | $(call StopGlobalTimer) |
| 311 | $(call ReportBuildTimes) |
| 312 | endif |
Erik Joelsson | 8c55662 | 2016-01-16 13:01:43 +0100 | [diff] [blame] | 313 | $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE) |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 314 | endif |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 315 | |
Magnus Ihse Bursie | 6047d89 | 2015-09-03 11:05:49 +0200 | [diff] [blame] | 316 | on-failure: |
Erik Joelsson | da68b22 | 2016-09-05 10:10:29 +0200 | [diff] [blame^] | 317 | $(call CleanupSmartJavac) |
| 318 | $(call StopGlobalTimer) |
| 319 | $(call ReportBuildTimes) |
Magnus Ihse Bursie | 209ebcf | 2015-11-10 11:41:21 +0100 | [diff] [blame] | 320 | $(call PrintFailureReports) |
| 321 | $(call PrintBuildLogFailures) |
Magnus Ihse Bursie | 6047d89 | 2015-09-03 11:05:49 +0200 | [diff] [blame] | 322 | $(PRINTF) "Hint: If caused by a warning, try configure --disable-warnings-as-errors.\n\n" |
Magnus Ihse Bursie | 209ebcf | 2015-11-10 11:41:21 +0100 | [diff] [blame] | 323 | ifneq ($(COMPARE_BUILD), ) |
| 324 | $(call CleanupCompareBuild) |
| 325 | endif |
Magnus Ihse Bursie | 6047d89 | 2015-09-03 11:05:49 +0200 | [diff] [blame] | 326 | |
Magnus Ihse Bursie | 19b025d | 2015-09-21 09:32:07 +0200 | [diff] [blame] | 327 | # Support targets for COMPARE_BUILD, used for makefile development |
| 328 | pre-compare-build: |
Magnus Ihse Bursie | 44a1209 | 2016-01-30 10:25:15 +0100 | [diff] [blame] | 329 | $(call WaitForSmartJavacFinish) |
Magnus Ihse Bursie | 209ebcf | 2015-11-10 11:41:21 +0100 | [diff] [blame] | 330 | $(call PrepareCompareBuild) |
Magnus Ihse Bursie | 19b025d | 2015-09-21 09:32:07 +0200 | [diff] [blame] | 331 | |
| 332 | post-compare-build: |
Erik Joelsson | a5b9b52 | 2016-02-11 11:54:00 +0100 | [diff] [blame] | 333 | $(call WaitForSmartJavacFinish) |
Magnus Ihse Bursie | 209ebcf | 2015-11-10 11:41:21 +0100 | [diff] [blame] | 334 | $(call CleanupCompareBuild) |
| 335 | $(call CompareBuildDoComparison) |
Magnus Ihse Bursie | 19b025d | 2015-09-21 09:32:07 +0200 | [diff] [blame] | 336 | |
Magnus Ihse Bursie | 6047d89 | 2015-09-03 11:05:49 +0200 | [diff] [blame] | 337 | .PHONY: print-targets print-modules reconfigure main on-failure |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 338 | endif |