equal
deleted
inserted
replaced
1 # |
1 # |
2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
2 # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. |
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 # |
4 # |
5 # This code is free software; you can redistribute it and/or modify it |
5 # This code is free software; you can redistribute it and/or modify it |
6 # under the terms of the GNU General Public License version 2 only, as |
6 # under the terms of the GNU General Public License version 2 only, as |
7 # published by the Free Software Foundation. Oracle designates this |
7 # published by the Free Software Foundation. Oracle designates this |
51 # Make control variables, handled by Init.gmk |
51 # Make control variables, handled by Init.gmk |
52 INIT_CONTROL_VARIABLES += LOG CONF CONF_NAME SPEC JOBS TEST_JOBS CONF_CHECK \ |
52 INIT_CONTROL_VARIABLES += LOG CONF CONF_NAME SPEC JOBS TEST_JOBS CONF_CHECK \ |
53 COMPARE_BUILD JTREG GTEST MICRO TEST_OPTS TEST_VM_OPTS |
53 COMPARE_BUILD JTREG GTEST MICRO TEST_OPTS TEST_VM_OPTS |
54 |
54 |
55 # All known make control variables |
55 # All known make control variables |
56 MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER |
56 MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER SPEC_FILTER |
57 |
57 |
58 # Define a simple reverse function. |
58 # Define a simple reverse function. |
59 # Should maybe move to MakeBase.gmk, but we can't include that file now. |
59 # Should maybe move to MakeBase.gmk, but we can't include that file now. |
60 reverse = \ |
60 reverse = \ |
61 $(if $(strip $(1)), $(call reverse, $(wordlist 2, $(words $(1)), $(1)))) \ |
61 $(if $(strip $(1)), $(call reverse, $(wordlist 2, $(words $(1)), $(1)))) \ |
262 ifeq ($(strip $1), FORCE) |
262 ifeq ($(strip $1), FORCE) |
263 $$(shell rm -f $$(main_targets_file)) |
263 $$(shell rm -f $$(main_targets_file)) |
264 endif |
264 endif |
265 endif |
265 endif |
266 |
266 |
267 # The --no-print-directory is needed to make the call from |
|
268 # FindTest.gmk to Test.gmk work with LOG=debug/trace. See |
|
269 # JDK-8213736 |
|
270 $$(main_targets_file): |
267 $$(main_targets_file): |
271 @( cd $$(topdir) && \ |
268 @( cd $$(topdir) && \ |
272 $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R --no-print-directory \ |
269 $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \ |
273 -f $$(topdir)/make/Main.gmk \ |
|
274 -I $$(topdir)/make/common SPEC=$(strip $2) NO_RECIPES=true \ |
270 -I $$(topdir)/make/common SPEC=$(strip $2) NO_RECIPES=true \ |
275 $$(MAKE_LOG_VARS) \ |
271 $$(MAKE_LOG_VARS) \ |
276 create-main-targets-include ) |
272 create-main-targets-include ) |
277 |
273 |
278 # Now include main-targets.gmk. This will define ALL_MAIN_TARGETS. |
274 # Now include main-targets.gmk. This will define ALL_MAIN_TARGETS. |
298 # Define basic logging setup |
294 # Define basic logging setup |
299 BUILD_LOG := $(OUTPUTDIR)/build.log |
295 BUILD_LOG := $(OUTPUTDIR)/build.log |
300 BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log |
296 BUILD_PROFILE_LOG := $(OUTPUTDIR)/build-profile.log |
301 |
297 |
302 BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait |
298 BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2) && wait |
|
299 # Use this for simple echo/printf commands that are never expected to print |
|
300 # to stderr. |
|
301 BUILD_LOG_PIPE_SIMPLE := | $(TEE) -a $(BUILD_LOG) |
303 |
302 |
304 ifneq ($(CUSTOM_ROOT), ) |
303 ifneq ($(CUSTOM_ROOT), ) |
305 topdir=$(CUSTOM_ROOT) |
304 topdir=$(CUSTOM_ROOT) |
306 else |
305 else |
307 topdir=$(TOPDIR) |
306 topdir=$(TOPDIR) |
386 else \ |
385 else \ |
387 $(MKDIR) -p $(OUTPUTDIR); \ |
386 $(MKDIR) -p $(OUTPUTDIR); \ |
388 fi |
387 fi |
389 # Re-run configure with the same arguments (and possibly some additional), |
388 # Re-run configure with the same arguments (and possibly some additional), |
390 # must be done after patching. |
389 # must be done after patching. |
391 ( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \ |
390 ( cd $(CONFIGURE_START_DIR) && PATH="$(ORIGINAL_PATH)" \ |
392 $(BASH) $(topdir)/configure $(CONFIGURE_COMMAND_LINE) $(COMPARE_BUILD_CONF)) |
391 $(BASH) $(topdir)/configure $(CONFIGURE_COMMAND_LINE) $(COMPARE_BUILD_CONF)) |
393 endef |
392 endef |
394 |
393 |
395 # Cleanup after a compare build |
394 # Cleanup after a compare build |
396 define CleanupCompareBuild |
395 define CleanupCompareBuild |
423 $(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log)), \ |
422 $(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log)), \ |
424 $(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(NEWLINE) \ |
423 $(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(NEWLINE) \ |
425 $(if $(filter all, $(LOG_REPORT)), \ |
424 $(if $(filter all, $(LOG_REPORT)), \ |
426 $(GREP) -v -e "^Note: including file:" < $(logfile) || true $(NEWLINE) \ |
425 $(GREP) -v -e "^Note: including file:" < $(logfile) || true $(NEWLINE) \ |
427 , \ |
426 , \ |
428 ($(GREP) -v -e "^Note: including file:" < $(logfile) || true) | $(HEAD) -n 12 $(NEWLINE) \ |
427 ($(GREP) -v -e "^Note: including file:" < $(logfile) || true) | $(HEAD) -n 15 $(NEWLINE) \ |
429 if test `$(WC) -l < $(logfile)` -gt 12; then \ |
428 if test `$(WC) -l < $(logfile)` -gt 15; then \ |
430 $(ECHO) " ... (rest of output omitted)" ; \ |
429 $(ECHO) " ... (rest of output omitted)" ; \ |
431 fi $(NEWLINE) \ |
430 fi $(NEWLINE) \ |
432 ) \ |
431 ) \ |
433 ) \ |
432 ) \ |
434 $(PRINTF) "\n* All command lines available in $(MAKESUPPORT_OUTPUTDIR)/failure-logs.\n" $(NEWLINE) \ |
433 $(PRINTF) "\n* All command lines available in $(MAKESUPPORT_OUTPUTDIR)/failure-logs.\n" $(NEWLINE) \ |
516 "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \ |
515 "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \ |
517 "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \ |
516 "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \ |
518 "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \ |
517 "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \ |
519 $(XARGS) $(CAT) | $(SORT) -k 2`" \ |
518 $(XARGS) $(CAT) | $(SORT) -k 2`" \ |
520 "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \ |
519 "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \ |
521 $(BUILD_LOG_PIPE) |
520 $(BUILD_LOG_PIPE_SIMPLE) |
522 endef |
521 endef |
523 |
522 |
524 define ReportProfileTimes |
523 define ReportProfileTimes |
525 $(if $(findstring true, $(LOG_PROFILE_TIMES_LOG)), \ |
524 $(if $(findstring true, $(LOG_PROFILE_TIMES_LOG)), \ |
526 [ ! -f $(BUILD_PROFILE_LOG) ] || \ |
525 [ ! -f $(BUILD_PROFILE_LOG) ] || \ |
527 { $(ECHO) Begin $(notdir $(BUILD_PROFILE_LOG)) && \ |
526 { $(ECHO) Begin $(notdir $(BUILD_PROFILE_LOG)) && \ |
528 $(CAT) $(BUILD_PROFILE_LOG) && \ |
527 $(CAT) $(BUILD_PROFILE_LOG) && \ |
529 $(ECHO) End $(notdir $(BUILD_PROFILE_LOG)); \ |
528 $(ECHO) End $(notdir $(BUILD_PROFILE_LOG)); \ |
530 } \ |
529 } \ |
531 $(BUILD_LOG_PIPE) |
530 $(BUILD_LOG_PIPE_SIMPLE) |
532 ) |
531 ) |
533 endef |
532 endef |
534 |
533 |
535 endif # HAS_SPEC |
534 endif # HAS_SPEC |
536 |
535 |