359 BUILD_LOG := $(OUTPUTDIR)/build.log |
359 BUILD_LOG := $(OUTPUTDIR)/build.log |
360 BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log |
360 BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log |
361 |
361 |
362 BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait |
362 BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait |
363 |
363 |
|
364 ifneq ($(CUSTOM_ROOT), ) |
|
365 topdir=$(CUSTOM_ROOT) |
|
366 else |
|
367 topdir=$(TOPDIR) |
|
368 endif |
|
369 |
364 # Parse COMPARE_BUILD into COMPARE_BUILD_* |
370 # Parse COMPARE_BUILD into COMPARE_BUILD_* |
365 # Syntax: COMPARE_BUILD=CONF=<configure options>:PATCH=<patch file>: |
371 # Syntax: COMPARE_BUILD=CONF=<configure options>:PATCH=<patch file>: |
366 # MAKE=<make targets>:COMP_OPTS=<compare script options>: |
372 # MAKE=<make targets>:COMP_OPTS=<compare script options>: |
367 # COMP_DIR=<compare script base dir>|<default>: |
373 # COMP_DIR=<compare script base dir>|<default>: |
368 # FAIL=<bool> |
374 # FAIL=<bool> |
371 # MAKE and COMP_OPTS can only be used with CONF and/or PATCH specified. |
377 # MAKE and COMP_OPTS can only be used with CONF and/or PATCH specified. |
372 # If any value contains "+", it will be replaced by space. |
378 # If any value contains "+", it will be replaced by space. |
373 # FAIL can be set to false to have the return value of compare be ignored. |
379 # FAIL can be set to false to have the return value of compare be ignored. |
374 define ParseCompareBuild |
380 define ParseCompareBuild |
375 ifneq ($$(COMPARE_BUILD), ) |
381 ifneq ($$(COMPARE_BUILD), ) |
376 COMPARE_BUILD_OUTPUTDIR := $(TOPDIR)/build/compare-build/$(CONF_NAME) |
382 COMPARE_BUILD_OUTPUTDIR := $(topdir)/build/compare-build/$(CONF_NAME) |
377 COMPARE_BUILD_FAIL := true |
383 COMPARE_BUILD_FAIL := true |
378 |
384 |
379 ifneq ($$(findstring :, $$(COMPARE_BUILD)), ) |
385 ifneq ($$(findstring :, $$(COMPARE_BUILD)), ) |
380 $$(foreach part, $$(subst :, , $$(COMPARE_BUILD)), \ |
386 $$(foreach part, $$(subst :, , $$(COMPARE_BUILD)), \ |
381 $$(if $$(filter PATCH=%, $$(part)), \ |
387 $$(if $$(filter PATCH=%, $$(part)), \ |
410 # Otherwise assume patch file |
416 # Otherwise assume patch file |
411 COMPARE_BUILD_PATCH=$$(strip $$(COMPARE_BUILD)) |
417 COMPARE_BUILD_PATCH=$$(strip $$(COMPARE_BUILD)) |
412 endif |
418 endif |
413 endif |
419 endif |
414 ifneq ($$(COMPARE_BUILD_PATCH), ) |
420 ifneq ($$(COMPARE_BUILD_PATCH), ) |
415 ifneq ($$(wildcard $$(TOPDIR)/$$(COMPARE_BUILD_PATCH)), ) |
421 ifneq ($$(wildcard $$(topdir)/$$(COMPARE_BUILD_PATCH)), ) |
416 # Assume relative path, if file exists |
422 # Assume relative path, if file exists |
417 COMPARE_BUILD_PATCH := $$(wildcard $$(TOPDIR)/$$(COMPARE_BUILD_PATCH)) |
423 COMPARE_BUILD_PATCH := $$(wildcard $$(topdir)/$$(COMPARE_BUILD_PATCH)) |
418 else ifeq ($$(wildcard $$(COMPARE_BUILD_PATCH)), ) |
424 else ifeq ($$(wildcard $$(COMPARE_BUILD_PATCH)), ) |
419 $$(error Patch file $$(COMPARE_BUILD_PATCH) does not exist) |
425 $$(error Patch file $$(COMPARE_BUILD_PATCH) does not exist) |
420 endif |
426 endif |
421 endif |
427 endif |
422 ifneq ($$(COMPARE_BUILD_FAIL), true) |
428 ifneq ($$(COMPARE_BUILD_FAIL), true) |
429 define PrepareCompareBuild |
435 define PrepareCompareBuild |
430 $(ECHO) "Preparing for comparison rebuild" |
436 $(ECHO) "Preparing for comparison rebuild" |
431 # Apply patch, if any |
437 # Apply patch, if any |
432 $(if $(COMPARE_BUILD_PATCH), $(PATCH) -p1 < $(COMPARE_BUILD_PATCH)) |
438 $(if $(COMPARE_BUILD_PATCH), $(PATCH) -p1 < $(COMPARE_BUILD_PATCH)) |
433 # Move the first build away temporarily |
439 # Move the first build away temporarily |
434 $(RM) -r $(TOPDIR)/build/.compare-build-temp |
440 $(RM) -r $(topdir)/build/.compare-build-temp |
435 $(MKDIR) -p $(TOPDIR)/build/.compare-build-temp |
441 $(MKDIR) -p $(topdir)/build/.compare-build-temp |
436 $(MV) $(OUTPUTDIR) $(TOPDIR)/build/.compare-build-temp |
442 $(MV) $(OUTPUTDIR) $(topdir)/build/.compare-build-temp |
437 # Restore an old compare-build, or create a new compare-build directory. |
443 # Restore an old compare-build, or create a new compare-build directory. |
438 if test -d $(COMPARE_BUILD_OUTPUTDIR); then \ |
444 if test -d $(COMPARE_BUILD_OUTPUTDIR); then \ |
439 $(MV) $(COMPARE_BUILD_OUTPUTDIR) $(OUTPUTDIR); \ |
445 $(MV) $(COMPARE_BUILD_OUTPUTDIR) $(OUTPUTDIR); \ |
440 else \ |
446 else \ |
441 $(MKDIR) -p $(OUTPUTDIR); \ |
447 $(MKDIR) -p $(OUTPUTDIR); \ |
442 fi |
448 fi |
443 # Re-run configure with the same arguments (and possibly some additional), |
449 # Re-run configure with the same arguments (and possibly some additional), |
444 # must be done after patching. |
450 # must be done after patching. |
445 ( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \ |
451 ( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \ |
446 $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) $(COMPARE_BUILD_CONF)) |
452 $(BASH) $(topdir)/configure $(CONFIGURE_COMMAND_LINE) $(COMPARE_BUILD_CONF)) |
447 endef |
453 endef |
448 |
454 |
449 # Cleanup after a compare build |
455 # Cleanup after a compare build |
450 define CleanupCompareBuild |
456 define CleanupCompareBuild |
451 # If running with a COMPARE_BUILD patch, reverse-apply it |
457 # If running with a COMPARE_BUILD patch, reverse-apply it |
452 $(if $(COMPARE_BUILD_PATCH), $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH)) |
458 $(if $(COMPARE_BUILD_PATCH), $(PATCH) -R -p1 < $(COMPARE_BUILD_PATCH)) |
453 # Move this build away and restore the original build |
459 # Move this build away and restore the original build |
454 $(MKDIR) -p $(TOPDIR)/build/compare-build |
460 $(MKDIR) -p $(topdir)/build/compare-build |
455 $(MV) $(OUTPUTDIR) $(COMPARE_BUILD_OUTPUTDIR) |
461 $(MV) $(OUTPUTDIR) $(COMPARE_BUILD_OUTPUTDIR) |
456 $(MV) $(TOPDIR)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUTDIR) |
462 $(MV) $(topdir)/build/.compare-build-temp/$(CONF_NAME) $(OUTPUTDIR) |
457 $(RM) -r $(TOPDIR)/build/.compare-build-temp |
463 $(RM) -r $(topdir)/build/.compare-build-temp |
458 endef |
464 endef |
459 |
465 |
460 # Do the actual comparison of two builds |
466 # Do the actual comparison of two builds |
461 define CompareBuildDoComparison |
467 define CompareBuildDoComparison |
462 # Compare first and second build. Ignore any error code from compare.sh. |
468 # Compare first and second build. Ignore any error code from compare.sh. |