--- old/make/InitSupport.gmk 2016-01-13 14:41:04.458515294 +0100 +++ new/make/InitSupport.gmk 2016-01-13 14:41:04.378511933 +0100 @@ -155,7 +155,7 @@ else ifeq ($$(LOG_LEVEL), debug) MAKE_LOG_FLAGS := else ifeq ($$(LOG_LEVEL), trace) - MAKE_LOG_FLAGS := -d + MAKE_LOG_FLAGS := else $$(info Error: LOG must be one of: warn, info, debug or trace.) $$(error Cannot continue) @@ -235,11 +235,15 @@ $$(foreach var, $$(all_confs), $$(info * $$(var))) $$(error Cannot continue) else - 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))) + # 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 @@ -262,6 +266,13 @@ 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. @@ -274,17 +285,21 @@ # 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)) + $$(shell rm -f $$(main_targets_file) $$(module_deps_file)) endif endif - $$(main_targets_file): + $$(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 \ + $$(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 ) @@ -313,7 +328,7 @@ 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) + 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 @@ -455,7 +470,7 @@ endef define RotateLogFiles - $(RM) $(BUILD_LOG).old 2> /dev/null + $(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 && \ @@ -464,7 +479,7 @@ endef define PrepareFailureLogs - $(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null + $(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \ $(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs endef @@ -483,8 +498,8 @@ endef define StartGlobalTimer - $(RM) -r $(BUILDTIMESDIR) 2> /dev/null - $(MKDIR) -p $(BUILDTIMESDIR) + $(RM) -r $(BUILDTIMESDIR) 2> /dev/null && \ + $(MKDIR) -p $(BUILDTIMESDIR) && \ $(call RecordStartTime,TOTAL) endef @@ -495,13 +510,14 @@ # 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) -- \ + $(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`" + "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \ + $(BUILD_LOG_PIPE) endef endif # HAS_SPEC