8076465: New Init.gmk needs improvements
Reviewed-by: erikj, tbell
This commit is contained in:
parent
4d3d136de1
commit
7ba3b45382
@ -59,7 +59,7 @@ SPEC:=@SPEC@
|
|||||||
MAKE := @MAKE@
|
MAKE := @MAKE@
|
||||||
|
|
||||||
# The default make arguments
|
# The default make arguments
|
||||||
MAKE_ARGS = $(MAKE_LOG_FLAGS) -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \
|
MAKE_ARGS = $(MAKE_LOG_FLAGS) -r -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \
|
||||||
MAKE_LOG_FLAGS="$(MAKE_LOG_FLAGS)" LOG_LEVEL=$(LOG_LEVEL)
|
MAKE_LOG_FLAGS="$(MAKE_LOG_FLAGS)" LOG_LEVEL=$(LOG_LEVEL)
|
||||||
|
|
||||||
OUTPUT_SYNC_SUPPORTED:=@OUTPUT_SYNC_SUPPORTED@
|
OUTPUT_SYNC_SUPPORTED:=@OUTPUT_SYNC_SUPPORTED@
|
||||||
@ -231,7 +231,6 @@ BUILD_OUTPUT:=@BUILD_OUTPUT@
|
|||||||
# Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images
|
# Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images
|
||||||
SUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/support
|
SUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/support
|
||||||
BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools
|
BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools
|
||||||
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/makesupport
|
|
||||||
|
|
||||||
HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
|
HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
|
||||||
JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
|
JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
|
||||||
|
@ -88,28 +88,15 @@ help:
|
|||||||
$(info $(_) # make test TEST="jdk_lang jdk_net")
|
$(info $(_) # make test TEST="jdk_lang jdk_net")
|
||||||
$(info )
|
$(info )
|
||||||
$(if $(all_confs), $(info Available configurations in $(build_dir):) $(foreach var,$(all_confs),$(info * $(var))),\
|
$(if $(all_confs), $(info Available configurations in $(build_dir):) $(foreach var,$(all_confs),$(info * $(var))),\
|
||||||
$(info No configurations were found in $(build_dir).) $(info Run 'bash configure' to create a configuration))
|
$(info No configurations were found in $(build_dir).) $(info Run 'bash configure' to create a configuration.))
|
||||||
# We need a dummy rule otherwise make will complain
|
# We need a dummy rule otherwise make will complain
|
||||||
@true
|
@true
|
||||||
|
|
||||||
print-targets:
|
|
||||||
$(if $(any_spec_file), ,\
|
|
||||||
@echo "Note: More targets will be available when at least one configuration exists." 1>&2\
|
|
||||||
)
|
|
||||||
@echo $(ALL_TARGETS)
|
|
||||||
|
|
||||||
print-modules:
|
|
||||||
$(if $(any_spec_file), \
|
|
||||||
@$(MAKE) -s -f $(topdir)/make/Main.gmk -I $(topdir)/make/common SPEC=$(any_spec_file) print-modules \
|
|
||||||
, \
|
|
||||||
@echo print-modules can currently only be run when at least one configuration exists \
|
|
||||||
)
|
|
||||||
|
|
||||||
print-configurations:
|
print-configurations:
|
||||||
$(foreach var, $(all_confs), $(info $(var)))
|
$(foreach var, $(all_confs), $(info $(var)))
|
||||||
# We need a dummy rule otherwise make will complain
|
# We need a dummy rule otherwise make will complain
|
||||||
@true
|
@true
|
||||||
|
|
||||||
ALL_GLOBAL_TARGETS := help print-modules print-targets print-configurations
|
ALL_GLOBAL_TARGETS := help print-configurations
|
||||||
|
|
||||||
.PHONY: $(ALL_GLOBAL_TARGETS)
|
.PHONY: $(ALL_GLOBAL_TARGETS)
|
||||||
|
208
make/Init.gmk
208
make/Init.gmk
@ -37,84 +37,102 @@ default:
|
|||||||
# serially, regardless of -j.
|
# serially, regardless of -j.
|
||||||
.NOTPARALLEL:
|
.NOTPARALLEL:
|
||||||
|
|
||||||
# If included from the top-level Makefile then topdir is set, but not when
|
ifeq ($(HAS_SPEC),)
|
||||||
# recursively calling ourself with a spec.
|
##############################################################################
|
||||||
ifeq ($(topdir),)
|
# This is the default mode. We have not been recursively called with a SPEC.
|
||||||
topdir := $(strip $(patsubst %/make/, %, $(dir $(lastword $(MAKEFILE_LIST)))))
|
##############################################################################
|
||||||
endif
|
|
||||||
|
|
||||||
# Our helper functions. Will include $(SPEC) if $(HAS_SPEC) is true.
|
# Include our helper functions.
|
||||||
include $(topdir)/make/InitSupport.gmk
|
include $(topdir)/make/InitSupport.gmk
|
||||||
|
|
||||||
# Here are "global" targets, i.e. targets that can be executed without having a configuration.
|
# Here are "global" targets, i.e. targets that can be executed without having
|
||||||
# This will define ALL_GLOBAL_TARGETS.
|
# a configuration. This will define ALL_GLOBAL_TARGETS.
|
||||||
include $(topdir)/make/Help.gmk
|
include $(topdir)/make/Help.gmk
|
||||||
|
|
||||||
# Extract main targets from Main.gmk.
|
# Targets provided by Init.gmk.
|
||||||
ifneq ($(any_spec_file), )
|
ALL_INIT_TARGETS := print-modules print-targets reconfigure
|
||||||
ifeq ($(wildcard $(dir $(any_spec_file))/make-support/module-deps.gmk),)
|
|
||||||
# If make-support does not exist, we need to build the genmodules java tool first.
|
# CALLED_TARGETS is the list of targets that the user provided,
|
||||||
$(info Creating data for first make execution in new configuration...)
|
# or "default" if unspecified.
|
||||||
ignore_output := $(shell $(MAKE) -r -R -f $(topdir)/make/Main.gmk \
|
CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
|
||||||
-I $(topdir)/make/common SPEC=$(any_spec_file) NO_RECIPES=true FRC)
|
|
||||||
$(info Done)
|
# Extract non-global targets that require a spec file.
|
||||||
|
CALLED_SPEC_TARGETS := $(filter-out $(ALL_GLOBAL_TARGETS), $(CALLED_TARGETS))
|
||||||
|
|
||||||
|
# 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
|
||||||
|
ifneq ($(findstring qp, $(MAKEFLAGS)),)
|
||||||
|
ONLY_GLOBAL_TARGETS := true
|
||||||
endif
|
endif
|
||||||
ALL_MAIN_TARGETS := $(shell $(MAKE) -r -R -f $(topdir)/make/Main.gmk \
|
|
||||||
-I $(topdir)/make/common SPEC=$(any_spec_file) NO_RECIPES=true print-targets)
|
|
||||||
else
|
|
||||||
# Without at least a single valid configuration, we cannot extract any real
|
|
||||||
# targets. To provide a helpful error message about the missing configuration
|
|
||||||
# later on, accept whatever targets the user has provided for now.
|
|
||||||
ALL_MAIN_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Targets provided by this file.
|
ifeq ($(ONLY_GLOBAL_TARGETS), true)
|
||||||
ALL_INIT_TARGETS := reconfigure
|
############################################################################
|
||||||
|
# We have only global targets, or are called with -pq.
|
||||||
|
############################################################################
|
||||||
|
|
||||||
ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS))
|
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
|
||||||
|
|
||||||
ifneq ($(findstring qp, $(MAKEFLAGS)),)
|
ifneq ($(wildcard $(SPEC)), )
|
||||||
##############################################################################
|
$(eval $(call DefineMainTargets, LAZY, $(SPEC)))
|
||||||
# When called with -qp, assume an external part (e.g. bash completion) is trying
|
else
|
||||||
# to understand our targets. Just list our targets and do no more checking.
|
# If we have no configurations we can not provide any main targets.
|
||||||
##############################################################################
|
ALL_MAIN_TARGETS :=
|
||||||
|
endif
|
||||||
|
|
||||||
|
ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS))
|
||||||
|
|
||||||
|
# Just list all our targets.
|
||||||
$(ALL_TARGETS):
|
$(ALL_TARGETS):
|
||||||
|
|
||||||
.PHONY: $(ALL_TARGETS)
|
.PHONY: $(ALL_TARGETS)
|
||||||
|
|
||||||
else ifeq ($(HAS_SPEC),)
|
else
|
||||||
|
############################################################################
|
||||||
##############################################################################
|
|
||||||
# This is the normal case, we have been called from the command line by the
|
# 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.
|
# 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.
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
# Basic checks on environment and command line.
|
||||||
$(eval $(call CheckControlVariables))
|
$(eval $(call CheckControlVariables))
|
||||||
$(eval $(call CheckDeprecatedEnvironment))
|
$(eval $(call CheckDeprecatedEnvironment))
|
||||||
$(eval $(call CheckInvalidMakeFlags))
|
$(eval $(call CheckInvalidMakeFlags))
|
||||||
|
|
||||||
|
# Check that CONF_CHECK is valid.
|
||||||
$(eval $(call ParseConfCheckOption))
|
$(eval $(call ParseConfCheckOption))
|
||||||
|
|
||||||
# Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE and MAKE_LOG_FLAGS.
|
# Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE and MAKE_LOG_FLAGS.
|
||||||
$(eval $(call ParseLogLevel))
|
$(eval $(call ParseLogLevel))
|
||||||
|
|
||||||
ifneq ($(findstring $(LOG_LEVEL),info debug trace),)
|
# After this SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails).
|
||||||
$(info Running make as '$(strip $(MAKE) $(MFLAGS) $(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))')
|
|
||||||
endif
|
|
||||||
|
|
||||||
# CALLED_TARGETS is the list of targets that the user provided,
|
|
||||||
# or "default" if unspecified.
|
|
||||||
CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
|
|
||||||
CALLED_SPEC_TARGETS := $(filter $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS), $(CALLED_TARGETS))
|
|
||||||
ifneq ($(CALLED_SPEC_TARGETS),)
|
|
||||||
# We have at least one non-global target, which need a SPEC
|
|
||||||
$(eval $(call ParseConfAndSpec))
|
$(eval $(call ParseConfAndSpec))
|
||||||
# Now SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails)
|
|
||||||
|
|
||||||
|
# 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.
|
||||||
INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS))
|
INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS))
|
||||||
SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(CALLED_SPEC_TARGETS))
|
MAIN_TARGETS := $(filter $(ALL_MAIN_TARGETS), $(CALLED_SPEC_TARGETS))
|
||||||
PARALLEL_TARGETS := $(filter-out $(INIT_TARGETS) $(SEQUENTIAL_TARGETS), $(CALLED_SPEC_TARGETS))
|
SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(MAIN_TARGETS))
|
||||||
|
PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS))
|
||||||
|
|
||||||
# The spec files depend on the autoconf source code. This check makes sure
|
# The spec files depend on the autoconf source code. This check makes sure
|
||||||
# the configuration is up to date after changes to configure.
|
# the configuration is up to date after changes to configure.
|
||||||
@ -126,30 +144,41 @@ else ifeq ($(HAS_SPEC),)
|
|||||||
else ifeq ($(CONF_CHECK), auto)
|
else ifeq ($(CONF_CHECK), auto)
|
||||||
@echo "Note: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'."
|
@echo "Note: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'."
|
||||||
@( cd $(topdir) && \
|
@( cd $(topdir) && \
|
||||||
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -f $(topdir)/make/Init.gmk SPEC=$@ HAS_SPEC=true \
|
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \
|
||||||
|
SPEC=$@ HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
|
||||||
reconfigure )
|
reconfigure )
|
||||||
else ifeq ($(CONF_CHECK), ignore)
|
else ifeq ($(CONF_CHECK), ignore)
|
||||||
# Do nothing
|
# Do nothing
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Unless reconfigure is explicitely called, let all targets depend on the spec files to be up to date.
|
# Unless reconfigure is explicitely called, let all main targets depend on
|
||||||
ifeq ($(findstring reconfigure, $(CALLED_SPEC_TARGETS)), )
|
# the spec files to be up to date.
|
||||||
$(CALLED_SPEC_TARGETS): $(SPECS)
|
ifeq ($(findstring reconfigure, $(INIT_TARGETS)), )
|
||||||
|
$(MAIN_TARGETS): $(SPECS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# The recipe will be run once for every target specified, but we only want to execute the
|
make-info:
|
||||||
# recipe a single time, hence the TARGET_DONE with a dummy command if true.
|
ifneq ($(findstring $(LOG_LEVEL),info debug trace),)
|
||||||
$(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS):
|
$(info Running make as '$(strip $(MAKE) $(MFLAGS) \
|
||||||
|
$(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))')
|
||||||
|
endif
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
$(ALL_INIT_TARGETS) $(ALL_MAIN_TARGETS): make-info
|
||||||
@$(if $(TARGET_DONE), \
|
@$(if $(TARGET_DONE), \
|
||||||
true \
|
true \
|
||||||
, \
|
, \
|
||||||
$(foreach spec, $(SPECS), \
|
$(foreach spec, $(SPECS), \
|
||||||
( cd $(topdir) && \
|
( cd $(topdir) && \
|
||||||
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -j 1 -f $(topdir)/make/Init.gmk \
|
$(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \
|
||||||
SPEC=$(spec) HAS_SPEC=true \
|
SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \
|
||||||
USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \
|
USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \
|
||||||
LOG_LEVEL=$(LOG_LEVEL) LOG_NOFILE=$(LOG_NOFILE) \
|
LOG_LEVEL=$(LOG_LEVEL) LOG_NOFILE=$(LOG_NOFILE) \
|
||||||
INIT_TARGETS="$(INIT_TARGETS)" SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \
|
INIT_TARGETS="$(INIT_TARGETS)" \
|
||||||
|
SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \
|
||||||
PARALLEL_TARGETS="$(PARALLEL_TARGETS)" \
|
PARALLEL_TARGETS="$(PARALLEL_TARGETS)" \
|
||||||
main ) && \
|
main ) && \
|
||||||
) true \
|
) true \
|
||||||
@ -158,7 +187,7 @@ else ifeq ($(HAS_SPEC),)
|
|||||||
|
|
||||||
.PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)
|
.PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)
|
||||||
|
|
||||||
endif # has $(CALLED_SPEC_TARGETS)
|
endif # $(ONLY_GLOBAL_TARGETS)!=true
|
||||||
|
|
||||||
else # HAS_SPEC=true
|
else # HAS_SPEC=true
|
||||||
|
|
||||||
@ -168,6 +197,14 @@ else # HAS_SPEC=true
|
|||||||
# file.
|
# file.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
include $(SPEC)
|
||||||
|
|
||||||
|
# Our helper functions.
|
||||||
|
include $(TOPDIR)/make/InitSupport.gmk
|
||||||
|
|
||||||
|
# Verify that the spec file we included seems okay.
|
||||||
|
$(eval $(call CheckSpecSanity))
|
||||||
|
|
||||||
ifeq ($(LOG_NOFILE), true)
|
ifeq ($(LOG_NOFILE), true)
|
||||||
# Disable log wrapper if LOG=[level,]nofile was given
|
# Disable log wrapper if LOG=[level,]nofile was given
|
||||||
override BUILD_LOG_WRAPPER :=
|
override BUILD_LOG_WRAPPER :=
|
||||||
@ -177,7 +214,19 @@ else # HAS_SPEC=true
|
|||||||
OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
|
OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(eval $(call CheckSpecSanity))
|
##############################################################################
|
||||||
|
# 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 )
|
||||||
|
|
||||||
reconfigure:
|
reconfigure:
|
||||||
ifneq ($(CONFIGURE_COMMAND_LINE), )
|
ifneq ($(CONFIGURE_COMMAND_LINE), )
|
||||||
@ -188,26 +237,29 @@ else # HAS_SPEC=true
|
|||||||
( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
|
( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
|
||||||
$(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
|
$(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
|
||||||
|
|
||||||
main-init:
|
##############################################################################
|
||||||
$(call RotateLogFiles)
|
# The main target, for delegating into Main.gmk
|
||||||
$(BUILD_LOG_WRAPPER) $(PRINTF) "Building target(s) '$(strip \
|
##############################################################################
|
||||||
$(INIT_TARGETS) $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) \
|
|
||||||
)' in configuration '$(CONF_NAME)'\n"
|
|
||||||
|
|
||||||
|
MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS)
|
||||||
|
TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \
|
||||||
|
'$(strip $(MAIN_TARGETS))' in configuration '$(CONF_NAME)'
|
||||||
|
|
||||||
# MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls.
|
# 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
|
# We need to clear it of the init-specific variables. The user-specified
|
||||||
# variables are explicitely propagated using $(USER_MAKE_VARS).
|
# variables are explicitely propagated using $(USER_MAKE_VARS).
|
||||||
main: MAKEOVERRIDES :=
|
main: MAKEOVERRIDES :=
|
||||||
|
|
||||||
main: $(INIT_TARGETS) main-init
|
main: $(INIT_TARGETS)
|
||||||
|
ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
|
||||||
|
$(call RotateLogFiles)
|
||||||
|
$(BUILD_LOG_WRAPPER) $(PRINTF) "Building $(TARGET_DESCRIPTION)\n"
|
||||||
ifneq ($(SEQUENTIAL_TARGETS), )
|
ifneq ($(SEQUENTIAL_TARGETS), )
|
||||||
# Don't touch build output dir since we might be cleaning. That means
|
# Don't touch build output dir since we might be cleaning. That
|
||||||
# no log wrapper.
|
# means no log wrapper.
|
||||||
( cd $(TOPDIR) && \
|
( cd $(TOPDIR) && \
|
||||||
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
|
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
|
||||||
$(SEQUENTIAL_TARGETS) \
|
$(SEQUENTIAL_TARGETS) )
|
||||||
)
|
|
||||||
endif
|
endif
|
||||||
ifneq ($(PARALLEL_TARGETS), )
|
ifneq ($(PARALLEL_TARGETS), )
|
||||||
$(call StartGlobalTimer)
|
$(call StartGlobalTimer)
|
||||||
@ -215,15 +267,13 @@ else # HAS_SPEC=true
|
|||||||
( cd $(TOPDIR) && \
|
( cd $(TOPDIR) && \
|
||||||
$(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
|
$(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
|
||||||
-j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
|
-j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
|
||||||
$(PARALLEL_TARGETS) \
|
$(PARALLEL_TARGETS) )
|
||||||
)
|
|
||||||
$(call CleanupSmartJavac)
|
$(call CleanupSmartJavac)
|
||||||
$(call StopGlobalTimer)
|
$(call StopGlobalTimer)
|
||||||
$(call ReportBuildTimes)
|
$(call ReportBuildTimes)
|
||||||
endif
|
endif
|
||||||
$(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building target(s) '$(strip \
|
$(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n"
|
||||||
$(INIT_TARGETS) $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) \
|
endif
|
||||||
)' in configuration '$(CONF_NAME)'\n"
|
|
||||||
|
|
||||||
.PHONY: reconfigure main-init main
|
.PHONY: print-targets print-modules reconfigure main
|
||||||
endif
|
endif
|
||||||
|
@ -32,13 +32,6 @@
|
|||||||
ifndef _INITSUPPORT_GMK
|
ifndef _INITSUPPORT_GMK
|
||||||
_INITSUPPORT_GMK := 1
|
_INITSUPPORT_GMK := 1
|
||||||
|
|
||||||
# Setup information about available configurations, if any.
|
|
||||||
build_dir=$(topdir)/build
|
|
||||||
all_spec_files=$(wildcard $(build_dir)/*/spec.gmk)
|
|
||||||
# Extract the configuration names from the path
|
|
||||||
all_confs=$(patsubst %/spec.gmk, %, $(patsubst $(build_dir)/%, %, $(all_spec_files)))
|
|
||||||
any_spec_file=$(firstword $(all_spec_files))
|
|
||||||
|
|
||||||
ifeq ($(HAS_SPEC),)
|
ifeq ($(HAS_SPEC),)
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Helper functions for the initial part of Init.gmk, before the spec file is
|
# Helper functions for the initial part of Init.gmk, before the spec file is
|
||||||
@ -62,17 +55,24 @@ ifeq ($(HAS_SPEC),)
|
|||||||
# line, but in reverse order to what the user entered.
|
# line, but in reverse order to what the user entered.
|
||||||
COMMAND_LINE_VARIABLES := $(subst \#,\ , $(call reverse, $(subst \ ,\#,$(MAKEOVERRIDES))))
|
COMMAND_LINE_VARIABLES := $(subst \#,\ , $(call reverse, $(subst \ ,\#,$(MAKEOVERRIDES))))
|
||||||
|
|
||||||
# A list like FOO="val1" BAR="val2" containing all user-supplied make variables
|
# A list like FOO="val1" BAR="val2" containing all user-supplied make
|
||||||
# that we should propagate.
|
# variables that we should propagate.
|
||||||
USER_MAKE_VARS := $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \
|
USER_MAKE_VARS := $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \
|
||||||
$(MAKEOVERRIDES))
|
$(MAKEOVERRIDES))
|
||||||
|
|
||||||
|
# Setup information about available configurations, if any.
|
||||||
|
build_dir=$(topdir)/build
|
||||||
|
all_spec_files=$(wildcard $(build_dir)/*/spec.gmk)
|
||||||
|
# Extract the configuration names from the path
|
||||||
|
all_confs=$(patsubst %/spec.gmk, %, $(patsubst $(build_dir)/%, %, $(all_spec_files)))
|
||||||
|
|
||||||
# Check for unknown command-line variables
|
# Check for unknown command-line variables
|
||||||
define CheckControlVariables
|
define CheckControlVariables
|
||||||
command_line_variables := $$(strip $$(foreach var, \
|
command_line_variables := $$(strip $$(foreach var, \
|
||||||
$$(subst \ ,_,$$(MAKEOVERRIDES)), \
|
$$(subst \ ,_,$$(MAKEOVERRIDES)), \
|
||||||
$$(firstword $$(subst =, , $$(var)))))
|
$$(firstword $$(subst =, , $$(var)))))
|
||||||
unknown_command_line_variables := $$(strip $$(filter-out $$(MAKE_CONTROL_VARIABLES), $$(command_line_variables)))
|
unknown_command_line_variables := $$(strip \
|
||||||
|
$$(filter-out $$(MAKE_CONTROL_VARIABLES), $$(command_line_variables)))
|
||||||
ifneq ($$(unknown_command_line_variables), )
|
ifneq ($$(unknown_command_line_variables), )
|
||||||
$$(info Note: Command line contains non-control variables:)
|
$$(info Note: Command line contains non-control variables:)
|
||||||
$$(foreach var, $$(unknown_command_line_variables), $$(info * $$(var)=$$($$(var))))
|
$$(foreach var, $$(unknown_command_line_variables), $$(info * $$(var)=$$($$(var))))
|
||||||
@ -182,7 +182,7 @@ ifeq ($(HAS_SPEC),)
|
|||||||
override SPEC :=
|
override SPEC :=
|
||||||
else
|
else
|
||||||
# Use spec.gmk files in the build output directory
|
# Use spec.gmk files in the build output directory
|
||||||
ifeq ($$(any_spec_file),)
|
ifeq ($$(all_spec_files),)
|
||||||
$$(info Error: No configurations found for $$(topdir).)
|
$$(info Error: No configurations found for $$(topdir).)
|
||||||
$$(info Please run 'bash configure' to create a configuration.)
|
$$(info Please run 'bash configure' to create a configuration.)
|
||||||
$$(info )
|
$$(info )
|
||||||
@ -196,7 +196,8 @@ ifeq ($(HAS_SPEC),)
|
|||||||
matching_confs := $$(strip $$(all_confs))
|
matching_confs := $$(strip $$(all_confs))
|
||||||
else
|
else
|
||||||
# Otherwise select those that contain the given CONF string
|
# Otherwise select those that contain the given CONF string
|
||||||
matching_confs := $$(strip $$(foreach var, $$(all_confs), $$(if $$(findstring $$(CONF), $$(var)), $$(var))))
|
matching_confs := $$(strip $$(foreach var, $$(all_confs), \
|
||||||
|
$$(if $$(findstring $$(CONF), $$(var)), $$(var))))
|
||||||
endif
|
endif
|
||||||
ifeq ($$(matching_confs),)
|
ifeq ($$(matching_confs),)
|
||||||
$$(info Error: No configurations found matching CONF=$$(CONF).)
|
$$(info Error: No configurations found matching CONF=$$(CONF).)
|
||||||
@ -231,6 +232,37 @@ ifeq ($(HAS_SPEC),)
|
|||||||
endif
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# Extract main targets from Main.gmk using the spec provided in $2.
|
||||||
|
#
|
||||||
|
# Param 1: FORCE = force generation of main-targets.gmk or LAZY = do not force.
|
||||||
|
# Param 2: The SPEC file to use.
|
||||||
|
define DefineMainTargets
|
||||||
|
|
||||||
|
# We will start by making sure the main-targets.gmk file is removed, if
|
||||||
|
# make has not been restarted. By the -include, we will trigger the
|
||||||
|
# rule for generating the file (which is never there since we removed it),
|
||||||
|
# thus generating it fresh, and make will restart, incrementing the restart
|
||||||
|
# count.
|
||||||
|
main_targets_file := $$(dir $(strip $2))make-support/main-targets.gmk
|
||||||
|
|
||||||
|
ifeq ($$(MAKE_RESTARTS),)
|
||||||
|
# Only do this if make has not been restarted, and if we do not force it.
|
||||||
|
ifeq ($(strip $1), FORCE)
|
||||||
|
$$(shell rm -f $$(main_targets_file))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
$$(main_targets_file):
|
||||||
|
@( cd $$(topdir) && \
|
||||||
|
$$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \
|
||||||
|
-I $$(topdir)/make/common SPEC=$(strip $2) NO_RECIPES=true \
|
||||||
|
LOG_LEVEL=$$(LOG_LEVEL) \
|
||||||
|
create-main-targets-include )
|
||||||
|
|
||||||
|
# Now include main-targets.gmk. This will define ALL_MAIN_TARGETS.
|
||||||
|
-include $$(main_targets_file)
|
||||||
|
endef
|
||||||
|
|
||||||
define PrintConfCheckFailed
|
define PrintConfCheckFailed
|
||||||
@echo ' '
|
@echo ' '
|
||||||
@echo "Please rerun configure! Easiest way to do this is by running"
|
@echo "Please rerun configure! Easiest way to do this is by running"
|
||||||
@ -242,10 +274,9 @@ ifeq ($(HAS_SPEC),)
|
|||||||
else # $(HAS_SPEC)=true
|
else # $(HAS_SPEC)=true
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Helper functions for the 'main' target. These functions assume a single,
|
# Helper functions for the 'main' target. These functions assume a single,
|
||||||
# proper and existing SPEC is provided, and will load it.
|
# proper and existing SPEC is included.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
include $(SPEC)
|
|
||||||
include $(SRC_ROOT)/make/common/MakeBase.gmk
|
include $(SRC_ROOT)/make/common/MakeBase.gmk
|
||||||
|
|
||||||
# Define basic logging setup
|
# Define basic logging setup
|
||||||
@ -263,11 +294,11 @@ else # $(HAS_SPEC)=true
|
|||||||
|
|
||||||
# Sanity check the spec file, so it matches this source code
|
# Sanity check the spec file, so it matches this source code
|
||||||
define CheckSpecSanity
|
define CheckSpecSanity
|
||||||
ifneq ($$(topdir), $$(TOPDIR))
|
ifneq ($$(ACTUAL_TOPDIR), $$(TOPDIR))
|
||||||
ifneq ($$(topdir), $$(ORIGINAL_TOPDIR))
|
ifneq ($$(ACTUAL_TOPDIR), $$(ORIGINAL_TOPDIR))
|
||||||
ifneq ($$(topdir), $$(CANONICAL_TOPDIR))
|
ifneq ($$(ACTUAL_TOPDIR), $$(CANONICAL_TOPDIR))
|
||||||
$$(info Error: SPEC mismatch! Current working directory)
|
$$(info Error: SPEC mismatch! Current working directory)
|
||||||
$$(info $$(topdir))
|
$$(info $$(ACTUAL_TOPDIR))
|
||||||
$$(info does not match either TOPDIR, ORIGINAL_TOPDIR or CANONICAL_TOPDIR)
|
$$(info does not match either TOPDIR, ORIGINAL_TOPDIR or CANONICAL_TOPDIR)
|
||||||
$$(info $$(TOPDIR))
|
$$(info $$(TOPDIR))
|
||||||
$$(info $$(ORIGINAL_TOPDIR))
|
$$(info $$(ORIGINAL_TOPDIR))
|
||||||
|
@ -607,14 +607,19 @@ include $(SRC_ROOT)/make/Jprt.gmk
|
|||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
# The following targets are intentionally not added to ALL_TARGETS since they
|
||||||
|
# are internal only, to support Init.gmk.
|
||||||
|
|
||||||
print-targets:
|
print-targets:
|
||||||
@$(ECHO) $(sort $(ALL_TARGETS))
|
@$(ECHO) $(sort $(ALL_TARGETS))
|
||||||
|
|
||||||
print-modules:
|
print-modules:
|
||||||
@$(ECHO) $(sort $(ALL_MODULES))
|
@$(ECHO) $(sort $(ALL_MODULES))
|
||||||
|
|
||||||
# print-* targets intentionally not added to ALL_TARGETS since they are internal only.
|
create-main-targets-include:
|
||||||
# The corresponding external targets are in Help.gmk
|
@$(ECHO) $(LOG_INFO) Generating main target list
|
||||||
|
@$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
|
||||||
|
$(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user