347 ############################################################################## |
347 ############################################################################## |
348 |
348 |
349 include $(TOPDIR)/make/common/MakeBase.gmk |
349 include $(TOPDIR)/make/common/MakeBase.gmk |
350 |
350 |
351 # Define basic logging setup |
351 # Define basic logging setup |
352 BUILD_LOG := $(OUTPUT_ROOT)/build.log |
352 BUILD_LOG := $(OUTPUTDIR)/build.log |
353 BUILD_PROFILE_LOG := $(OUTPUT_ROOT)/build-profile.log |
353 BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log |
354 |
354 |
355 BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait |
355 BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait |
356 |
356 |
357 # Sanity check the spec file, so it matches this source code |
357 # Sanity check the spec file, so it matches this source code |
358 define CheckSpecSanity |
358 define CheckSpecSanity |
381 # MAKE and COMP_OPTS can only be used with CONF and/or PATCH specified. |
381 # MAKE and COMP_OPTS can only be used with CONF and/or PATCH specified. |
382 # If any value contains "+", it will be replaced by space. |
382 # If any value contains "+", it will be replaced by space. |
383 # FAIL can be set to false to have the return value of compare be ignored. |
383 # FAIL can be set to false to have the return value of compare be ignored. |
384 define ParseCompareBuild |
384 define ParseCompareBuild |
385 ifneq ($$(COMPARE_BUILD), ) |
385 ifneq ($$(COMPARE_BUILD), ) |
386 COMPARE_BUILD_OUTPUT_ROOT := $(TOPDIR)/build/compare-build/$(CONF_NAME) |
386 COMPARE_BUILD_OUTPUTDIR := $(TOPDIR)/build/compare-build/$(CONF_NAME) |
387 COMPARE_BUILD_FAIL := true |
387 COMPARE_BUILD_FAIL := true |
388 |
388 |
389 ifneq ($$(findstring :, $$(COMPARE_BUILD)), ) |
389 ifneq ($$(findstring :, $$(COMPARE_BUILD)), ) |
390 $$(foreach part, $$(subst :, , $$(COMPARE_BUILD)), \ |
390 $$(foreach part, $$(subst :, , $$(COMPARE_BUILD)), \ |
391 $$(if $$(filter PATCH=%, $$(part)), \ |
391 $$(if $$(filter PATCH=%, $$(part)), \ |
441 # Apply patch, if any |
441 # Apply patch, if any |
442 $(if $(COMPARE_BUILD_PATCH), $(PATCH) -p1 < $(COMPARE_BUILD_PATCH)) |
442 $(if $(COMPARE_BUILD_PATCH), $(PATCH) -p1 < $(COMPARE_BUILD_PATCH)) |
443 # Move the first build away temporarily |
443 # Move the first build away temporarily |
444 $(RM) -r $(TOPDIR)/build/.compare-build-temp |
444 $(RM) -r $(TOPDIR)/build/.compare-build-temp |
445 $(MKDIR) -p $(TOPDIR)/build/.compare-build-temp |
445 $(MKDIR) -p $(TOPDIR)/build/.compare-build-temp |
446 $(MV) $(OUTPUT_ROOT) $(TOPDIR)/build/.compare-build-temp |
446 $(MV) $(OUTPUTDIR) $(TOPDIR)/build/.compare-build-temp |
447 # Restore an old compare-build, or create a new compare-build directory. |
447 # Restore an old compare-build, or create a new compare-build directory. |
448 if test -d $(COMPARE_BUILD_OUTPUT_ROOT); then \ |
448 if test -d $(COMPARE_BUILD_OUTPUTDIR); then \ |
449 $(MV) $(COMPARE_BUILD_OUTPUT_ROOT) $(OUTPUT_ROOT); \ |
449 $(MV) $(COMPARE_BUILD_OUTPUTDIR) $(OUTPUTDIR); \ |
450 else \ |
450 else \ |
451 $(MKDIR) -p $(OUTPUT_ROOT); \ |
451 $(MKDIR) -p $(OUTPUTDIR); \ |
452 fi |
452 fi |
453 # Re-run configure with the same arguments (and possibly some additional), |
453 # Re-run configure with the same arguments (and possibly some additional), |
454 # must be done after patching. |
454 # must be done after patching. |
455 ( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \ |
455 ( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \ |
456 $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) $(COMPARE_BUILD_CONF)) |
456 $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) $(COMPARE_BUILD_CONF)) |
457 endef |
457 endef |
458 |
458 |
459 # Cleanup after a compare build |
459 # Cleanup after a compare build |
460 define CleanupCompareBuild |
460 define CleanupCompareBuild |
461 # If running with a COMPARE_BUILD patch, reverse-apply it |
461 # If running with a COMPARE_BUILD patch, reverse-apply it |
462 $(if $(COMPARE_BUILD_PATCH), $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH)) |
462 $(if $(COMPARE_BUILD_PATCH), $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH)) |
463 # Move this build away and restore the original build |
463 # Move this build away and restore the original build |
464 $(MKDIR) -p $(TOPDIR)/build/compare-build |
464 $(MKDIR) -p $(TOPDIR)/build/compare-build |
465 $(MV) $(OUTPUT_ROOT) $(COMPARE_BUILD_OUTPUT_ROOT) |
465 $(MV) $(OUTPUTDIR) $(COMPARE_BUILD_OUTPUTDIR) |
466 $(MV) $(TOPDIR)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUT_ROOT) |
466 $(MV) $(TOPDIR)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUTDIR) |
467 $(RM) -r $(TOPDIR)/build/.compare-build-temp |
467 $(RM) -r $(TOPDIR)/build/.compare-build-temp |
468 endef |
468 endef |
469 |
469 |
470 # Do the actual comparison of two builds |
470 # Do the actual comparison of two builds |
471 define CompareBuildDoComparison |
471 define CompareBuildDoComparison |
472 # Compare first and second build. Ignore any error code from compare.sh. |
472 # Compare first and second build. Ignore any error code from compare.sh. |
473 $(ECHO) "Comparing between comparison rebuild (this/new) and baseline (other/old)" |
473 $(ECHO) "Comparing between comparison rebuild (this/new) and baseline (other/old)" |
474 $(if $(COMPARE_BUILD_COMP_DIR), \ |
474 $(if $(COMPARE_BUILD_COMP_DIR), \ |
475 +(cd $(COMPARE_BUILD_OUTPUT_ROOT) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \ |
475 +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \ |
476 -2dirs $(COMPARE_BUILD_OUTPUT_ROOT)/$(COMPARE_BUILD_COMP_DIR) \ |
476 -2dirs $(COMPARE_BUILD_OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) \ |
477 $(OUTPUT_ROOT)/$(COMPARE_BUILD_COMP_DIR) $(COMPARE_BUILD_IGNORE_RESULT)), \ |
477 $(OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) $(COMPARE_BUILD_IGNORE_RESULT)), \ |
478 +(cd $(COMPARE_BUILD_OUTPUT_ROOT) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \ |
478 +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh $(COMPARE_BUILD_COMP_OPTS) \ |
479 -o $(OUTPUT_ROOT) $(COMPARE_BUILD_IGNORE_RESULT)) \ |
479 -o $(OUTPUTDIR) $(COMPARE_BUILD_IGNORE_RESULT)) \ |
480 ) |
480 ) |
481 endef |
481 endef |
482 |
482 |
483 define PrintFailureReports |
483 define PrintFailureReports |
484 $(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log), \ |
484 $(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log), \ |