< prev index next >
make/InitSupport.gmk
Print this page
*** 153,163 ****
else ifeq ($$(LOG_LEVEL), info)
MAKE_LOG_FLAGS := -s
else ifeq ($$(LOG_LEVEL), debug)
MAKE_LOG_FLAGS :=
else ifeq ($$(LOG_LEVEL), trace)
! MAKE_LOG_FLAGS := -d
else
$$(info Error: LOG must be one of: warn, info, debug or trace.)
$$(error Cannot continue)
endif
endef
--- 153,163 ----
else ifeq ($$(LOG_LEVEL), info)
MAKE_LOG_FLAGS := -s
else ifeq ($$(LOG_LEVEL), debug)
MAKE_LOG_FLAGS :=
else ifeq ($$(LOG_LEVEL), trace)
! MAKE_LOG_FLAGS :=
else
$$(info Error: LOG must be one of: warn, info, debug or trace.)
$$(error Cannot continue)
endif
endef
*** 233,249 ****
--- 233,253 ----
$$(info Error: No configurations found matching CONF=$$(CONF).)
$$(info Available configurations in $$(build_dir):)
$$(foreach var, $$(all_confs), $$(info * $$(var)))
$$(error Cannot continue)
else
+ # Don't repeat this output on make restarts caused by including
+ # generated files.
+ ifeq ($$(MAKE_RESTARTS),)
ifeq ($$(words $$(matching_confs)), 1)
$$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
else
$$(info Building these configurations (matching CONF=$$(CONF)):)
$$(foreach var, $$(matching_confs), $$(info * $$(var)))
endif
endif
+ endif
# Create a SPEC definition. This will contain the path to one or more spec.gmk files.
SPECS := $$(addsuffix /spec.gmk, $$(addprefix $$(build_dir)/, $$(matching_confs)))
else
# No CONF or SPEC given, check the available configurations
*** 260,269 ****
--- 264,280 ----
SPECS := $$(strip $$(all_spec_files))
endif
endif
endef
+ # Param 1: SPEC file to use
+ define GenerateModuleDeps
+ ( cd $(topdir) && \
+ $(MAKE) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/GenerateModuleDeps.gmk \
+ -I $(topdir)/make/common SPEC=$(strip $1) LOG_LEVEL=$(LOG_LEVEL) )
+ 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
*** 272,290 ****
# 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 )
--- 283,305 ----
# 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
+ module_deps_file := $$(dir $(strip $2))make-support/module-deps.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) $$(module_deps_file))
endif
endif
! $$(module_deps_file):
! @$$(call GenerateModuleDeps, $2)
!
! $$(main_targets_file): $$(module_deps_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 )
*** 311,321 ****
# Define basic logging setup
BUILD_LOG := $(OUTPUT_ROOT)/build.log
BUILD_TRACE_LOG := $(OUTPUT_ROOT)/build-trace-time.log
! BUILD_LOG_WRAPPER := $(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)
# Sanity check the spec file, so it matches this source code
define CheckSpecSanity
ifneq ($$(ACTUAL_TOPDIR), $$(TOPDIR))
ifneq ($$(ACTUAL_TOPDIR), $$(ORIGINAL_TOPDIR))
--- 326,336 ----
# Define basic logging setup
BUILD_LOG := $(OUTPUT_ROOT)/build.log
BUILD_TRACE_LOG := $(OUTPUT_ROOT)/build-trace-time.log
! BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2)
# Sanity check the spec file, so it matches this source code
define CheckSpecSanity
ifneq ($$(ACTUAL_TOPDIR), $$(TOPDIR))
ifneq ($$(ACTUAL_TOPDIR), $$(ORIGINAL_TOPDIR))
*** 453,472 ****
$(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \
fi
endef
define RotateLogFiles
! $(RM) $(BUILD_LOG).old 2> /dev/null
$(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
$(if $(findstring trace, $(LOG_LEVEL)), \
$(RM) $(BUILD_TRACE_LOG).old 2> /dev/null && \
$(MV) $(BUILD_TRACE_LOG) $(BUILD_TRACE_LOG).old 2> /dev/null || true \
)
endef
define PrepareFailureLogs
! $(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null
$(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs
endef
# Remove any javac server logs and port files. This
# prevents a new make run to reuse the previous servers.
--- 468,487 ----
$(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \
fi
endef
define RotateLogFiles
! $(RM) $(BUILD_LOG).old 2> /dev/null && \
$(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
$(if $(findstring trace, $(LOG_LEVEL)), \
$(RM) $(BUILD_TRACE_LOG).old 2> /dev/null && \
$(MV) $(BUILD_TRACE_LOG) $(BUILD_TRACE_LOG).old 2> /dev/null || true \
)
endef
define PrepareFailureLogs
! $(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \
$(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs
endef
# Remove any javac server logs and port files. This
# prevents a new make run to reuse the previous servers.
*** 481,509 ****
[ -f $(SJAVAC_SERVER_DIR)/server.port ] && $(ECHO) Stopping sjavac server && \
$(TOUCH) $(SJAVAC_SERVER_DIR)/server.port.stop; true
endef
define StartGlobalTimer
! $(RM) -r $(BUILDTIMESDIR) 2> /dev/null
! $(MKDIR) -p $(BUILDTIMESDIR)
$(call RecordStartTime,TOTAL)
endef
define StopGlobalTimer
$(call RecordEndTime,TOTAL)
endef
# Find all build_time_* files and print their contents in a list sorted
# on the name of the sub repository.
define ReportBuildTimes
! $(BUILD_LOG_WRAPPER) $(PRINTF) $(LOG_INFO) -- \
"----- Build times -------\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
"`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
$(XARGS) $(CAT) | $(SORT) -k 2`" \
! "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
endef
endif # HAS_SPEC
endif # _INITSUPPORT_GMK
--- 496,525 ----
[ -f $(SJAVAC_SERVER_DIR)/server.port ] && $(ECHO) Stopping sjavac server && \
$(TOUCH) $(SJAVAC_SERVER_DIR)/server.port.stop; true
endef
define StartGlobalTimer
! $(RM) -r $(BUILDTIMESDIR) 2> /dev/null && \
! $(MKDIR) -p $(BUILDTIMESDIR) && \
$(call RecordStartTime,TOTAL)
endef
define StopGlobalTimer
$(call RecordEndTime,TOTAL)
endef
# Find all build_time_* files and print their contents in a list sorted
# on the name of the sub repository.
define ReportBuildTimes
! $(PRINTF) $(LOG_INFO) -- \
"----- Build times -------\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
"`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
$(XARGS) $(CAT) | $(SORT) -k 2`" \
! "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \
! $(BUILD_LOG_PIPE)
endef
endif # HAS_SPEC
endif # _INITSUPPORT_GMK
< prev index next >