2015-03-26 15:17:30 +00:00
|
|
|
#
|
2022-03-31 13:30:16 +00:00
|
|
|
# Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
|
2015-03-26 15:17:30 +00:00
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
#
|
|
|
|
# This code is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License version 2 only, as
|
|
|
|
# published by the Free Software Foundation. Oracle designates this
|
|
|
|
# particular file as subject to the "Classpath" exception as provided
|
|
|
|
# by Oracle in the LICENSE file that accompanied this code.
|
|
|
|
#
|
|
|
|
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
# version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
# accompanied this code).
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License version
|
|
|
|
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
|
|
|
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
# or visit www.oracle.com if you need additional information or have any
|
|
|
|
# questions.
|
|
|
|
#
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# This is the bootstrapping part of the build. This file is included from the
|
|
|
|
# top level Makefile, and is responsible for launching the Main.gmk file with
|
|
|
|
# the proper make and the proper make arguments.
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# This must be the first rule
|
|
|
|
default:
|
|
|
|
.PHONY: default
|
|
|
|
|
|
|
|
# Inclusion of this pseudo-target will cause make to execute this file
|
|
|
|
# serially, regardless of -j.
|
|
|
|
.NOTPARALLEL:
|
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
ifeq ($(HAS_SPEC),)
|
|
|
|
##############################################################################
|
|
|
|
# This is the default mode. We have not been recursively called with a SPEC.
|
|
|
|
##############################################################################
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
# Include our helper functions.
|
|
|
|
include $(topdir)/make/InitSupport.gmk
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
# Here are "global" targets, i.e. targets that can be executed without having
|
|
|
|
# a configuration. This will define ALL_GLOBAL_TARGETS.
|
2020-02-17 07:59:26 +00:00
|
|
|
include $(topdir)/make/Global.gmk
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
# Targets provided by Init.gmk.
|
2015-09-21 07:32:07 +00:00
|
|
|
ALL_INIT_TARGETS := print-modules print-targets print-configuration \
|
2017-03-03 11:57:57 +00:00
|
|
|
print-tests reconfigure pre-compare-build post-compare-build
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
# CALLED_TARGETS is the list of targets that the user provided,
|
|
|
|
# or "default" if unspecified.
|
|
|
|
CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
# Extract non-global targets that require a spec file.
|
|
|
|
CALLED_SPEC_TARGETS := $(filter-out $(ALL_GLOBAL_TARGETS), $(CALLED_TARGETS))
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
# If we have only global targets, or if we are called with -qp (assuming an
|
|
|
|
# external part, e.g. bash completion, is trying to understand our targets),
|
|
|
|
# we will skip SPEC location and the sanity checks.
|
|
|
|
ifeq ($(CALLED_SPEC_TARGETS), )
|
|
|
|
ONLY_GLOBAL_TARGETS := true
|
|
|
|
endif
|
2017-02-07 10:09:42 +00:00
|
|
|
ifeq ($(findstring p, $(MAKEFLAGS))$(findstring q, $(MAKEFLAGS)), pq)
|
2015-04-07 07:06:24 +00:00
|
|
|
ONLY_GLOBAL_TARGETS := true
|
|
|
|
endif
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
ifeq ($(ONLY_GLOBAL_TARGETS), true)
|
|
|
|
############################################################################
|
|
|
|
# We have only global targets, or are called with -pq.
|
|
|
|
############################################################################
|
|
|
|
|
|
|
|
ifeq ($(wildcard $(SPEC)), )
|
|
|
|
# If we have no SPEC provided, we will just make a "best effort" target list.
|
|
|
|
# First try to grab any available pre-existing main-targets.gmk.
|
|
|
|
main_targets_file := $(firstword $(wildcard $(build_dir)/*/make-support/main-targets.gmk))
|
|
|
|
ifneq ($(main_targets_file), )
|
|
|
|
# Extract the SPEC that corresponds to this main-targets.gmk file.
|
|
|
|
SPEC := $(patsubst %/make-support/main-targets.gmk, %/spec.gmk, $(main_targets_file))
|
|
|
|
else
|
|
|
|
# None found, pick an arbitrary SPEC for which to generate a file
|
|
|
|
SPEC := $(firstword $(all_spec_files))
|
|
|
|
endif
|
|
|
|
endif
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
ifneq ($(wildcard $(SPEC)), )
|
|
|
|
$(eval $(call DefineMainTargets, LAZY, $(SPEC)))
|
|
|
|
else
|
|
|
|
# If we have no configurations we can not provide any main targets.
|
|
|
|
ALL_MAIN_TARGETS :=
|
|
|
|
endif
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS))
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
# Just list all our targets.
|
|
|
|
$(ALL_TARGETS):
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
.PHONY: $(ALL_TARGETS)
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
else
|
|
|
|
############################################################################
|
|
|
|
# This is the normal case, we have been called from the command line by the
|
|
|
|
# user and we need to call ourself back with a proper SPEC.
|
|
|
|
# We have at least one non-global target, so we need to find a spec file.
|
|
|
|
############################################################################
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
# Basic checks on environment and command line.
|
|
|
|
$(eval $(call CheckControlVariables))
|
|
|
|
$(eval $(call CheckDeprecatedEnvironment))
|
|
|
|
$(eval $(call CheckInvalidMakeFlags))
|
|
|
|
|
|
|
|
# Check that CONF_CHECK is valid.
|
|
|
|
$(eval $(call ParseConfCheckOption))
|
|
|
|
|
2017-03-30 19:23:07 +00:00
|
|
|
# Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE, MAKE_LOG_VARS and MAKE_LOG_FLAGS.
|
2015-04-07 07:06:24 +00:00
|
|
|
$(eval $(call ParseLogLevel))
|
|
|
|
|
|
|
|
# After this SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails).
|
2015-03-26 15:17:30 +00:00
|
|
|
$(eval $(call ParseConfAndSpec))
|
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
# Extract main targets from Main.gmk using the spec(s) provided. In theory,
|
|
|
|
# with multiple specs, we should find the intersection of targets provided
|
|
|
|
# by all specs, but we approximate this by an arbitrary spec from the list.
|
|
|
|
# This will setup ALL_MAIN_TARGETS.
|
|
|
|
$(eval $(call DefineMainTargets, FORCE, $(firstword $(SPECS))))
|
|
|
|
|
|
|
|
# Separate called targets depending on type.
|
2015-03-26 15:17:30 +00:00
|
|
|
INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS))
|
2015-04-07 07:06:24 +00:00
|
|
|
MAIN_TARGETS := $(filter $(ALL_MAIN_TARGETS), $(CALLED_SPEC_TARGETS))
|
|
|
|
SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(MAIN_TARGETS))
|
|
|
|
PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS))
|
2015-03-26 15:17:30 +00:00
|
|
|
|
|
|
|
# The spec files depend on the autoconf source code. This check makes sure
|
|
|
|
# the configuration is up to date after changes to configure.
|
2017-10-05 09:02:18 +00:00
|
|
|
$(SPECS): $(wildcard $(topdir)/make/autoconf/*) \
|
|
|
|
$(if $(CUSTOM_CONFIG_DIR), $(wildcard $(CUSTOM_CONFIG_DIR)/*))
|
2015-03-26 15:17:30 +00:00
|
|
|
ifeq ($(CONF_CHECK), fail)
|
2017-10-05 09:02:18 +00:00
|
|
|
@echo Error: The configuration is not up to date for \
|
|
|
|
"'$(lastword $(subst /, , $(dir $@)))'."
|
2015-03-26 15:17:30 +00:00
|
|
|
$(call PrintConfCheckFailed)
|
|
|
|
@exit 2
|
|
|
|
else ifeq ($(CONF_CHECK), auto)
|
2017-10-05 09:02:18 +00:00
|
|
|
@echo Note: The configuration is not up to date for \
|
|
|
|
"'$(lastword $(subst /, , $(dir $@)))'."
|
2015-03-26 15:17:30 +00:00
|
|
|
@( cd $(topdir) && \
|
2015-04-07 07:06:24 +00:00
|
|
|
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
|
|
|
|
SPEC=$@ HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
|
2015-03-26 15:17:30 +00:00
|
|
|
reconfigure )
|
|
|
|
else ifeq ($(CONF_CHECK), ignore)
|
|
|
|
# Do nothing
|
|
|
|
endif
|
|
|
|
|
2016-02-22 10:22:55 +00:00
|
|
|
# Do not let make delete spec files even if aborted while doing a reconfigure
|
|
|
|
.PRECIOUS: $(SPECS)
|
|
|
|
|
2016-12-02 15:17:52 +00:00
|
|
|
# Unless reconfigure is explicitly called, let all main targets depend on
|
2015-04-07 07:06:24 +00:00
|
|
|
# the spec files to be up to date.
|
|
|
|
ifeq ($(findstring reconfigure, $(INIT_TARGETS)), )
|
|
|
|
$(MAIN_TARGETS): $(SPECS)
|
2015-03-26 15:17:30 +00:00
|
|
|
endif
|
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
make-info:
|
|
|
|
ifneq ($(findstring $(LOG_LEVEL),info debug trace),)
|
|
|
|
$(info Running make as '$(strip $(MAKE) $(MFLAGS) \
|
|
|
|
$(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))')
|
|
|
|
endif
|
|
|
|
|
2015-09-21 07:32:07 +00:00
|
|
|
MAKE_INIT_WITH_SPEC_ARGUMENTS := ACTUAL_TOPDIR=$(topdir) \
|
|
|
|
USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \
|
2017-03-30 19:23:07 +00:00
|
|
|
$(MAKE_LOG_VARS) \
|
2015-09-21 07:32:07 +00:00
|
|
|
INIT_TARGETS="$(INIT_TARGETS)" \
|
|
|
|
SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \
|
|
|
|
PARALLEL_TARGETS="$(PARALLEL_TARGETS)"
|
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
# Now the init and main targets will be called, once for each SPEC. The
|
|
|
|
# recipe will be run once for every target specified, but we only want to
|
|
|
|
# execute the recipe a single time, hence the TARGET_DONE with a dummy
|
|
|
|
# command if true.
|
2015-09-21 07:32:07 +00:00
|
|
|
# The COMPARE_BUILD part implements special support for makefile development.
|
2015-04-07 07:06:24 +00:00
|
|
|
$(ALL_INIT_TARGETS) $(ALL_MAIN_TARGETS): make-info
|
2015-03-26 15:17:30 +00:00
|
|
|
@$(if $(TARGET_DONE), \
|
|
|
|
true \
|
|
|
|
, \
|
2015-09-21 07:32:07 +00:00
|
|
|
( cd $(topdir) && \
|
2015-03-26 15:17:30 +00:00
|
|
|
$(foreach spec, $(SPECS), \
|
2015-04-07 07:06:24 +00:00
|
|
|
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
|
2015-09-21 07:32:07 +00:00
|
|
|
SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \
|
|
|
|
main && \
|
|
|
|
$(if $(and $(COMPARE_BUILD), $(PARALLEL_TARGETS)), \
|
|
|
|
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
|
|
|
|
SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
|
|
|
|
COMPARE_BUILD="$(COMPARE_BUILD)" pre-compare-build && \
|
|
|
|
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
|
|
|
|
SPEC=$(spec) HAS_SPEC=true $(MAKE_INIT_WITH_SPEC_ARGUMENTS) \
|
2020-06-29 16:39:40 +00:00
|
|
|
COMPARE_BUILD="$(COMPARE_BUILD):NODRYRUN=true" main && \
|
2015-09-21 07:32:07 +00:00
|
|
|
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
|
|
|
|
SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
|
2021-01-11 18:18:46 +00:00
|
|
|
COMPARE_BUILD="$(COMPARE_BUILD):NODRYRUN=true" post-compare-build && \
|
2015-09-21 07:32:07 +00:00
|
|
|
) \
|
|
|
|
) true ) \
|
2015-03-26 15:17:30 +00:00
|
|
|
$(eval TARGET_DONE=true) \
|
|
|
|
)
|
|
|
|
|
|
|
|
.PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)
|
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
endif # $(ONLY_GLOBAL_TARGETS)!=true
|
2015-03-26 15:17:30 +00:00
|
|
|
|
|
|
|
else # HAS_SPEC=true
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
# Now we have a spec. This part provides the "main" target that acts as a
|
|
|
|
# trampoline to call the Main.gmk with the value of $(MAKE) found in the spec
|
|
|
|
# file.
|
|
|
|
##############################################################################
|
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
include $(SPEC)
|
|
|
|
|
|
|
|
# Our helper functions.
|
|
|
|
include $(TOPDIR)/make/InitSupport.gmk
|
|
|
|
|
2015-09-21 07:32:07 +00:00
|
|
|
# Parse COMPARE_BUILD (for makefile development)
|
|
|
|
$(eval $(call ParseCompareBuild))
|
|
|
|
|
2020-05-07 15:47:11 +00:00
|
|
|
# Setup reproducible build environment
|
|
|
|
$(eval $(call SetupReproducibleBuild))
|
|
|
|
|
2018-04-10 21:32:54 +00:00
|
|
|
# If no LOG= was given on command line, but we have a non-standard default
|
|
|
|
# value, use that instead and re-parse log level.
|
|
|
|
ifeq ($(LOG), )
|
|
|
|
ifneq ($(DEFAULT_LOG), )
|
|
|
|
override LOG := $(DEFAULT_LOG)
|
|
|
|
$(eval $(call ParseLogLevel))
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2015-03-26 15:17:30 +00:00
|
|
|
ifeq ($(LOG_NOFILE), true)
|
2016-01-16 12:01:43 +00:00
|
|
|
# Disable build log if LOG=[level,]nofile was given
|
|
|
|
override BUILD_LOG_PIPE :=
|
2019-04-03 19:52:37 +00:00
|
|
|
override BUILD_LOG_PIPE_SIMPLE :=
|
2015-03-26 15:17:30 +00:00
|
|
|
endif
|
|
|
|
|
2018-09-10 07:59:27 +00:00
|
|
|
ifeq ($(filter dist-clean, $(SEQUENTIAL_TARGETS)), dist-clean)
|
|
|
|
# We can't have a log file if we're about to remove it.
|
|
|
|
override BUILD_LOG_PIPE :=
|
2019-04-03 19:52:37 +00:00
|
|
|
override BUILD_LOG_PIPE_SIMPLE :=
|
2018-09-10 07:59:27 +00:00
|
|
|
endif
|
|
|
|
|
2015-03-26 15:17:30 +00:00
|
|
|
ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
|
|
|
|
OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
|
|
|
|
endif
|
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
##############################################################################
|
|
|
|
# Init targets
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
print-modules:
|
|
|
|
( cd $(TOPDIR) && \
|
|
|
|
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
|
|
|
|
NO_RECIPES=true print-modules )
|
|
|
|
|
|
|
|
print-targets:
|
|
|
|
( cd $(TOPDIR) && \
|
|
|
|
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
|
|
|
|
NO_RECIPES=true print-targets )
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2017-03-03 11:57:57 +00:00
|
|
|
print-tests:
|
|
|
|
( cd $(TOPDIR) && \
|
|
|
|
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
|
|
|
|
NO_RECIPES=true print-tests )
|
|
|
|
|
2015-09-09 07:44:57 +00:00
|
|
|
print-configuration:
|
|
|
|
$(ECHO) $(CONFIGURE_COMMAND_LINE)
|
|
|
|
|
2015-03-26 15:17:30 +00:00
|
|
|
reconfigure:
|
2022-10-17 09:28:23 +00:00
|
|
|
ifneq ($(REAL_CONFIGURE_COMMAND_EXEC_FULL), )
|
|
|
|
$(ECHO) "Re-running configure using original command line '$(REAL_CONFIGURE_COMMAND_EXEC_SHORT) $(REAL_CONFIGURE_COMMAND_LINE)'"
|
|
|
|
$(eval RECONFIGURE_COMMAND := $(REAL_CONFIGURE_COMMAND_EXEC_FULL) $(REAL_CONFIGURE_COMMAND_LINE))
|
|
|
|
else ifneq ($(CONFIGURE_COMMAND_LINE), )
|
2015-03-26 15:17:30 +00:00
|
|
|
$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
|
2022-10-17 09:28:23 +00:00
|
|
|
$(eval RECONFIGURE_COMMAND := $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE))
|
2015-03-26 15:17:30 +00:00
|
|
|
else
|
|
|
|
$(ECHO) "Re-running configure using default settings"
|
2022-10-17 09:28:23 +00:00
|
|
|
$(eval RECONFIGURE_COMMAND := $(BASH) $(TOPDIR)/configure)
|
2015-03-26 15:17:30 +00:00
|
|
|
endif
|
2019-04-05 13:48:20 +00:00
|
|
|
( cd $(CONFIGURE_START_DIR) && PATH="$(ORIGINAL_PATH)" AUTOCONF="$(AUTOCONF)" \
|
2017-10-16 06:43:42 +00:00
|
|
|
CUSTOM_ROOT="$(CUSTOM_ROOT)" \
|
2017-10-05 09:02:18 +00:00
|
|
|
CUSTOM_CONFIG_DIR="$(CUSTOM_CONFIG_DIR)" \
|
2022-10-17 09:28:23 +00:00
|
|
|
$(RECONFIGURE_COMMAND) )
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
##############################################################################
|
|
|
|
# The main target, for delegating into Main.gmk
|
|
|
|
##############################################################################
|
2015-03-26 15:17:30 +00:00
|
|
|
|
2015-09-21 07:32:07 +00:00
|
|
|
MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE)
|
2016-04-27 12:30:32 +00:00
|
|
|
# If building the default target, add what they are to the description.
|
|
|
|
DESCRIPTION_TARGETS := $(strip $(MAIN_TARGETS))
|
|
|
|
ifeq ($(DESCRIPTION_TARGETS), default)
|
|
|
|
DESCRIPTION_TARGETS += ($(DEFAULT_MAKE_TARGET))
|
|
|
|
endif
|
2015-04-07 07:06:24 +00:00
|
|
|
TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \
|
2016-04-27 12:30:32 +00:00
|
|
|
'$(strip $(DESCRIPTION_TARGETS))' in configuration '$(CONF_NAME)'
|
2015-03-26 15:17:30 +00:00
|
|
|
|
|
|
|
# MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls.
|
|
|
|
# We need to clear it of the init-specific variables. The user-specified
|
2016-12-02 15:17:52 +00:00
|
|
|
# variables are explicitly propagated using $(USER_MAKE_VARS).
|
2015-03-26 15:17:30 +00:00
|
|
|
main: MAKEOVERRIDES :=
|
|
|
|
|
2015-04-07 07:06:24 +00:00
|
|
|
main: $(INIT_TARGETS)
|
|
|
|
ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
|
|
|
|
$(call RotateLogFiles)
|
2019-04-03 19:52:37 +00:00
|
|
|
$(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE_SIMPLE)
|
2015-04-07 07:06:24 +00:00
|
|
|
ifneq ($(SEQUENTIAL_TARGETS), )
|
|
|
|
# Don't touch build output dir since we might be cleaning. That
|
2016-01-16 12:01:43 +00:00
|
|
|
# means no log pipe.
|
2015-04-07 07:06:24 +00:00
|
|
|
( cd $(TOPDIR) && \
|
|
|
|
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
|
|
|
|
$(SEQUENTIAL_TARGETS) )
|
|
|
|
endif
|
|
|
|
ifneq ($(PARALLEL_TARGETS), )
|
2018-06-14 09:46:53 +00:00
|
|
|
$(call PrepareFailureLogs)
|
2015-04-07 07:06:24 +00:00
|
|
|
$(call StartGlobalTimer)
|
|
|
|
$(call PrepareSmartJavac)
|
2018-04-19 15:43:26 +00:00
|
|
|
# JOBS will only be empty for a bootcycle-images recursive call
|
|
|
|
# or if specified via a make argument directly. In those cases
|
|
|
|
# treat it as NOT using jobs at all.
|
2015-04-07 07:06:24 +00:00
|
|
|
( cd $(TOPDIR) && \
|
2016-01-16 12:01:43 +00:00
|
|
|
$(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
|
2018-04-19 15:43:26 +00:00
|
|
|
$(if $(JOBS), -j $(JOBS)) \
|
|
|
|
-f make/Main.gmk $(USER_MAKE_VARS) \
|
2016-01-16 12:01:43 +00:00
|
|
|
$(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
|
|
|
|
( exitcode=$$? && \
|
|
|
|
$(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
|
2019-04-03 19:52:37 +00:00
|
|
|
$(BUILD_LOG_PIPE_SIMPLE) && \
|
2015-09-03 09:05:49 +00:00
|
|
|
cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
|
|
|
|
HAS_SPEC=true on-failure ; \
|
|
|
|
exit $$exitcode ) )
|
2015-04-07 07:06:24 +00:00
|
|
|
$(call CleanupSmartJavac)
|
|
|
|
$(call StopGlobalTimer)
|
|
|
|
$(call ReportBuildTimes)
|
|
|
|
endif
|
2017-03-03 11:57:57 +00:00
|
|
|
if test -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error ; then \
|
|
|
|
exit 1 ; \
|
|
|
|
fi
|
2019-04-03 19:52:37 +00:00
|
|
|
$(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE_SIMPLE)
|
2017-03-30 19:23:07 +00:00
|
|
|
$(call ReportProfileTimes)
|
2015-03-26 15:17:30 +00:00
|
|
|
endif
|
|
|
|
|
2015-09-03 09:05:49 +00:00
|
|
|
on-failure:
|
2016-09-05 08:10:29 +00:00
|
|
|
$(call CleanupSmartJavac)
|
|
|
|
$(call StopGlobalTimer)
|
|
|
|
$(call ReportBuildTimes)
|
2015-11-10 10:41:21 +00:00
|
|
|
$(call PrintFailureReports)
|
|
|
|
$(call PrintBuildLogFailures)
|
2017-03-30 19:23:07 +00:00
|
|
|
$(call ReportProfileTimes)
|
2022-03-31 13:30:16 +00:00
|
|
|
$(PRINTF) "HELP: Run 'make doctor' to diagnose build problems.\n\n"
|
2015-11-10 10:41:21 +00:00
|
|
|
ifneq ($(COMPARE_BUILD), )
|
|
|
|
$(call CleanupCompareBuild)
|
|
|
|
endif
|
2015-09-03 09:05:49 +00:00
|
|
|
|
2015-09-21 07:32:07 +00:00
|
|
|
# Support targets for COMPARE_BUILD, used for makefile development
|
|
|
|
pre-compare-build:
|
2016-01-30 09:25:15 +00:00
|
|
|
$(call WaitForSmartJavacFinish)
|
2015-11-10 10:41:21 +00:00
|
|
|
$(call PrepareCompareBuild)
|
2015-09-21 07:32:07 +00:00
|
|
|
|
|
|
|
post-compare-build:
|
2016-02-11 10:54:00 +00:00
|
|
|
$(call WaitForSmartJavacFinish)
|
2015-11-10 10:41:21 +00:00
|
|
|
$(call CleanupCompareBuild)
|
|
|
|
$(call CompareBuildDoComparison)
|
2015-09-21 07:32:07 +00:00
|
|
|
|
2015-09-03 09:05:49 +00:00
|
|
|
.PHONY: print-targets print-modules reconfigure main on-failure
|
2015-03-26 15:17:30 +00:00
|
|
|
endif
|