--- old/make/InitSupport.gmk 2016-01-04 16:03:17.623692471 +0100 +++ new/make/InitSupport.gmk 2016-01-04 16:03:17.539688928 +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) @@ -274,17 +274,22 @@ # 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): + @( cd $$(topdir) && \ + $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/GenerateModuleDeps.gmk \ + -I $$(topdir)/make/common SPEC=$(strip $2) LOG_LEVEL=$$(LOG_LEVEL) ) + + $$(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 +318,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 +460,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 +469,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 +488,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 +500,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