diff --git a/Makefile b/Makefile index 2aec754e6f8f0af6065df417112d48dbc0a75aa3..d93b3195ec5150705b76821eb5def61f918c53f7 100644 --- a/Makefile +++ b/Makefile @@ -36,12 +36,6 @@ ifndef JDK_MAKE_SHARED_DIR JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared endif -# For start and finish echo lines -TITLE_TEXT = Control $(PLATFORM) $(ARCH) $(RELEASE) -DATE_STAMP = `$(DATE) '+%y-%m-%d %H:%M'` -START_ECHO = echo "$(TITLE_TEXT) $@ build started: $(DATE_STAMP)" -FINISH_ECHO = echo "$(TITLE_TEXT) $@ build finished: $(DATE_STAMP)" - default: all include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk @@ -57,10 +51,6 @@ include ./make/install-rules.gmk include ./make/sponsors-rules.gmk include ./make/deploy-rules.gmk -# What "all" means -all:: - @$(START_ECHO) - all:: sanity ifeq ($(SKIP_FASTDEBUG_BUILD), false) @@ -73,40 +63,42 @@ endif all:: all_product_build -all:: - @$(FINISH_ECHO) - # Everything for a full product build -all_product_build:: - @$(START_ECHO) - ifeq ($(SKIP_PRODUCT_BUILD), false) - + all_product_build:: product_build ifeq ($(BUILD_INSTALL), true) all_product_build:: $(INSTALL) clobber:: install-clobber endif - + ifeq ($(BUILD_SPONSORS), true) all_product_build:: $(SPONSORS) clobber:: sponsors-clobber endif - + ifneq ($(SKIP_COMPARE_IMAGES), true) all_product_build:: compare-image endif endif -all_product_build:: - @$(FINISH_ECHO) +define StartTimer + $(MKDIR) -p $(BUILDTIMESDIR) + $(RM) $(BUILDTIMESDIR)/build_time_* + $(call RecordStartTime,TOTAL) +endef + +define StopTimer + $(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),) +endef # Generic build of basic repo series generic_build_repo_series:: $(MKDIR) -p $(OUTPUTDIR) $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image + @$(call StartTimer) ifeq ($(BUILD_LANGTOOLS), true) generic_build_repo_series:: langtools @@ -143,6 +135,9 @@ ifeq ($(BUILD_DEPLOY), true) clobber:: deploy-clobber endif +generic_build_repo_series:: + @$(call StopTimer,$(if $(DEBUG_NAME),$(DEBUG_NAME)_build,all_product_build)) + # The debug build, fastdebug or debug. Needs special handling. # Note that debug builds do NOT do INSTALL steps, but must be done # after the product build and before the INSTALL step of the product build. @@ -167,28 +162,22 @@ FRESH_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/j2sdk-image FRESH_DEBUG_BOOTDIR=$(ABS_BOOTDIR_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME)/j2sdk-image create_fresh_product_bootdir: FRC - @$(START_ECHO) $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ GENERATE_DOCS=false \ BOOT_CYCLE_SETTINGS= \ build_product_image - @$(FINISH_ECHO) create_fresh_debug_bootdir: FRC - @$(START_ECHO) $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ GENERATE_DOCS=false \ BOOT_CYCLE_DEBUG_SETTINGS= \ build_debug_image - @$(FINISH_ECHO) create_fresh_fastdebug_bootdir: FRC - @$(START_ECHO) $(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \ GENERATE_DOCS=false \ BOOT_CYCLE_DEBUG_SETTINGS= \ build_fastdebug_image - @$(FINISH_ECHO) # Create boot image? ifeq ($(SKIP_BOOT_CYCLE),false) @@ -197,6 +186,8 @@ ifeq ($(SKIP_BOOT_CYCLE),false) endif endif + + ifeq ($(DO_BOOT_CYCLE),true) # Create the bootdir to use in the build @@ -221,27 +212,23 @@ else endif build_product_image: - @$(START_ECHO) $(MAKE) \ SKIP_FASTDEBUG_BUILD=true \ SKIP_DEBUG_BUILD=true \ $(BOOT_CYCLE_SETTINGS) \ generic_build_repo_series - @$(FINISH_ECHO) # NOTE: On windows, do not use $(ABS_OUTPUTDIR)-$(DEBUG_NAME). # Due to the use of short paths in $(ABS_OUTPUTDIR), this may # not be the same location. generic_debug_build: - @$(START_ECHO) $(MAKE) \ ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-$(DEBUG_NAME) \ DEBUG_NAME=$(DEBUG_NAME) \ GENERATE_DOCS=false \ $(BOOT_CYCLE_DEBUG_SETTINGS) \ generic_build_repo_series - @$(FINISH_ECHO) build_debug_image: $(MAKE) DEBUG_NAME=debug generic_debug_build @@ -254,7 +241,8 @@ product_build:: build_product_image debug_build:: build_debug_image fastdebug_build:: build_fastdebug_image -clobber:: +clobber:: REPORT_BUILD_TIMES= +clobber:: $(RM) -r $(OUTPUTDIR)/* $(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-debug/* $(RM) -r $(OUTPUTDIR)/../$(PLATFORM)-$(ARCH)-fastdebug/* diff --git a/make/Defs-internal.gmk b/make/Defs-internal.gmk index 8cb28b8191addbededcb94f01e6cabc08c7f0415..c55675f79e01d7870d48c93fde3b0db2a055cbf2 100644 --- a/make/Defs-internal.gmk +++ b/make/Defs-internal.gmk @@ -28,21 +28,63 @@ # not contain rules. # -# Indicate that we are visiting a separate repo or component +# The build times report is turned off by setting REPORT_BUILD_TIMES to nothing. +# This is necessary for the target clobber/clean which will erase the +# directories where the buildtimes are stored. +REPORT_BUILD_TIMES=1 +# Store the build times in this directory. +BUILDTIMESDIR=$(ABS_OUTPUTDIR)/tmp/buildtimes + +# Record starting time for build of a sub repository. +define RecordStartTime +$(MKDIR) -p $(BUILDTIMESDIR) +$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$1 +$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$1_human_readable +endef + +# Indicate that we started to build a sub repository and record starting time. define MakeStart -$(PRINTF) "\n\n%s\n%s\n##### %-60.60s #####\n%s\n" \ +$(call RecordStartTime,$1) +$(PRINTF) "\n\n%s\n%s\n##### %-60.60s #####\n%s\n\n" \ "########################################################################" \ "########################################################################" \ -"Entering $1 for target $2" \ +"Entering $1 for target(s) $2" \ "########################################################################" endef -define MakeFinish -$(PRINTF) "%s\n##### %-60.60s #####\n%s\n%s\n\n" \ +# Record ending time and calculate the difference and store it in a +# easy to read format. Handles builds that cross midnight. Expects +# that a build will never take 24 hours or more. +define RecordEndTime +$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$1 +$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$1_human_readable +$(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$1` $1 | \ + $(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \ + M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \ + > $(BUILDTIMESDIR)/build_time_diff_$1 +endef + +# Indicate that we are done. +# Record ending time and print out the total time it took to build. +define MakeFinish +$(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,$1),) +$(PRINTF) "%s\n##### %-60.60s #####\n%s\n##### %-60.60s #####\n%s\n\n" \ "########################################################################" \ -"Leaving $1 for target $2" \ +"Leaving $1 for target(s) $2" \ "########################################################################" \ -"########################################################################" +$(if $(REPORT_BUILD_TIMES),"Build time `$(CAT) $(BUILDTIMESDIR)/build_time_diff_$1` for target(s) $2","") \ +"########################################################################" +endef + +# Find all build_time_* files and print their contents in a list sorted +# on the name of the sub repository. +define ReportBuildTimes +$(PRINTF) "-- Build times ----------\nTarget %s\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \ +$1 \ +"`$(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`" endef ifdef OPENJDK diff --git a/make/corba-rules.gmk b/make/corba-rules.gmk index 2cdeeb4eae11cc8e304e03cabad3585dfbd466a8..13671ee6eca8484c1de2855e90f73d7912589f05 100644 --- a/make/corba-rules.gmk +++ b/make/corba-rules.gmk @@ -40,17 +40,17 @@ endif corba: corba-build corba-build: $(MKDIR) -p $(CORBA_OUTPUTDIR) - @$(call MakeStart, corba, all) + @$(call MakeStart,corba,all) ($(CD) $(CORBA_TOPDIR)/make && \ $(MAKE) $(CORBA_BUILD_ARGUMENTS) all) - @$(call MakeFinish, corba, all) + @$(call MakeFinish,corba,all) corba-clobber:: $(MKDIR) -p $(CORBA_OUTPUTDIR) - @$(call MakeStart, corba, clobber) + @$(call MakeStart,corba,clobber) ($(CD) $(CORBA_TOPDIR)/make && \ $(MAKE) $(CORBA_BUILD_ARGUMENTS) clobber) - @$(call MakeFinish, corba, clobber) + @$(call MakeFinish,corba,clobber) .PHONY: corba corba-build corba-clobber diff --git a/make/deploy-rules.gmk b/make/deploy-rules.gmk index d05d4097e3c81102acffaf55f294d8101bd1ee94..003698cf56e397a701643b080609f747823ed119 100644 --- a/make/deploy-rules.gmk +++ b/make/deploy-rules.gmk @@ -116,18 +116,18 @@ endif deploy-build: ifeq ($(BUILD_DEPLOY), true) - @$(call MakeStart, deploy, $(DEPLOY_BUILD_TARGETS)) + @$(call MakeStart,deploy,$(DEPLOY_BUILD_TARGETS)) ($(CD) $(DEPLOY_TOPDIR)/make && \ $(MAKE) $(DEPLOY_BUILD_TARGETS) $(DEPLOY_BUILD_ARGUMENTS)) - @$(call MakeFinish, deploy, $(DEPLOY_BUILD_TARGETS)) + @$(call MakeFinish,deploy,$(DEPLOY_BUILD_TARGETS)) endif deploy-clobber:: ifeq ($(BUILD_DEPLOY), true) - @$(call MakeStart, deploy, clobber) + @$(call MakeStart,deploy,clobber) ($(CD) $(DEPLOY_TOPDIR)/make && \ $(MAKE) clobber $(DEPLOY_BUILD_ARGUMENTS)) - @$(call MakeFinish, deploy, clobber) + @$(call MakeFinish,deploy,clobber) endif deploy-sanity:: diff --git a/make/hotspot-rules.gmk b/make/hotspot-rules.gmk index 674ce633da0a0acb8bcd30b0de15d6ca2aaa79b9..8bc6e75a6664827fec97eaa902fbe2e0051b95da 100644 --- a/make/hotspot-rules.gmk +++ b/make/hotspot-rules.gmk @@ -96,10 +96,10 @@ endif hotspot-build:: $(MKDIR) -p $(HOTSPOT_OUTPUTDIR) $(MKDIR) -p $(HOTSPOT_EXPORT_PATH) - @$(call MakeStart, hotspot, $(HOTSPOT_TARGET)) + @$(call MakeStart,hotspot,$(HOTSPOT_TARGET)) $(CD) $(HOTSPOT_TOPDIR)/make && \ $(MAKE) $(HOTSPOT_BUILD_ARGUMENTS) $(HOTSPOT_TARGET) - @$(call MakeFinish, hotspot, $(HOTSPOT_TARGET)) + @$(call MakeFinish,hotspot,$(HOTSPOT_TARGET)) ##################### # .PHONY diff --git a/make/install-rules.gmk b/make/install-rules.gmk index 8e1f189d52178fbe70f03611c70ebae51f045fab..932985ed07da7fe3eb3a33b85604f3756fc115fa 100644 --- a/make/install-rules.gmk +++ b/make/install-rules.gmk @@ -57,39 +57,39 @@ install: install-build install-build: ifeq ($(BUILD_INSTALL), true) - @$(call MakeStart, install, $(INSTALL_BUILD_TARGETS)) + @$(call MakeStart,install,$(INSTALL_BUILD_TARGETS)) ($(CD) $(INSTALL_TOPDIR)/make && \ $(MAKE) $(INSTALL_BUILD_TARGETS) $(INSTALL_BUILD_ARGUMENTS)) - @$(call MakeFinish, install, $(INSTALL_BUILD_TARGETS)) + @$(call MakeFinish,install,$(INSTALL_BUILD_TARGETS)) endif update-patcher: ifeq ($(BUILD_INSTALL), true) if [ -r $(INSTALL_TOPDIR)/make/update/Makefile ]; then \ - $(call MakeStart, install update, all); \ + $(call MakeStart,install_update,all); \ ( $(CD) $(INSTALL_TOPDIR)/make/update && \ $(MAKE) all $(INSTALL_BUILD_ARGUMENTS) ); \ - $(call MakeFinish, install, all); \ + $(call MakeFinish,install_update,all); \ fi endif update-patchgen: ifeq ($(BUILD_INSTALL), true) if [ -r $(INSTALL_TOPDIR)/make/update/Makefile ]; then \ - $(call MakeStart, install update, patchgen); \ + $(call MakeStart,install_update,patchgen); \ ( $(CD) $(INSTALL_TOPDIR)/make/update && \ $(MAKE) patchgen $(INSTALL_BUILD_ARGUMENTS) ); \ - $(call MakeFinish, install, patchgen); \ + $(call MakeFinish,install_update,patchgen); \ fi endif installer: ifeq ($(BUILD_INSTALL), true) if [ -r $(INSTALL_TOPDIR)/make/installer/Makefile ]; then \ - $(call MakeStart, install installer, all); \ + $(call MakeStart,install_installer,all); \ ( $(CD) $(INSTALL_TOPDIR)/make/installer && \ $(MAKE) all $(INSTALL_BUILD_ARGUMENTS) ); \ - $(call MakeFinish, install, all); \ + $(call MakeFinish,install_installer,all); \ fi endif @@ -99,10 +99,10 @@ combo_build: install-clobber: ifeq ($(BUILD_INSTALL), true) - @$(call MakeStart, install, clobber) + @$(call MakeStart,install,clobber) ($(CD) $(INSTALL_TOPDIR)/make && \ $(MAKE) clobber $(INSTALL_BUILD_ARGUMENTS)) - @$(call MakeFinish, install, clobber) + @$(call MakeFinish,install,clobber) endif install-sanity:: diff --git a/make/jaxp-rules.gmk b/make/jaxp-rules.gmk index b37026b1dc51ea1e20cb26774e7e7a25e3b15ea5..625b2ec7bc8efd3f3fdc89731411ebf150a35321 100644 --- a/make/jaxp-rules.gmk +++ b/make/jaxp-rules.gmk @@ -40,17 +40,17 @@ endif jaxp: jaxp-build jaxp-build: $(MKDIR) -p $(JAXP_OUTPUTDIR) - @$(call MakeStart, jaxp, all) + @$(call MakeStart,jaxp,all) ($(CD) $(JAXP_TOPDIR)/make && \ $(MAKE) $(JAXP_BUILD_ARGUMENTS) all) - @$(call MakeFinish, jaxp, all) + @$(call MakeFinish,jaxp,all) jaxp-clobber:: $(MKDIR) -p $(JAXP_OUTPUTDIR) - @$(call MakeStart, jaxp, clobber) + @$(call MakeStart,jaxp,clobber) ($(CD) $(JAXP_TOPDIR)/make && \ $(MAKE) $(JAXP_BUILD_ARGUMENTS) clobber) - @$(call MakeFinish, jaxp, clobber) + @$(call MakeFinish,jaxp,clobber) .PHONY: jaxp jaxp-build jaxp-clobber diff --git a/make/jaxws-rules.gmk b/make/jaxws-rules.gmk index 981ddb06333d386cc52d3afb42f1d2ec187a0544..4956a983b91aceec92dbf5d491102a89ed13ceb6 100644 --- a/make/jaxws-rules.gmk +++ b/make/jaxws-rules.gmk @@ -40,17 +40,17 @@ endif jaxws: jaxws-build jaxws-build: $(MKDIR) -p $(JAXWS_OUTPUTDIR) - @$(call MakeStart, jaxws, all) + @$(call MakeStart,jaxws,all) ($(CD) $(JAXWS_TOPDIR)/make && \ $(MAKE) $(JAXWS_BUILD_ARGUMENTS) all) - @$(call MakeFinish, jaxws, all) + @$(call MakeFinish,jaxws,all) jaxws-clobber:: $(MKDIR) -p $(JAXWS_OUTPUTDIR) - @$(call MakeStart, jaxws, clobber) + @$(call MakeStart,jaxws,clobber) ($(CD) $(JAXWS_TOPDIR)/make && \ $(MAKE) $(JAXWS_BUILD_ARGUMENTS) clobber) - @$(call MakeFinish, jaxws, clobber) + @$(call MakeFinish,jaxws,clobber) .PHONY: jaxws jaxws-build jaxws-clobber diff --git a/make/jdk-rules.gmk b/make/jdk-rules.gmk index e814918a0273791dfd4a5c774c4b551b8f1a8ac9..cfc56ed127e3b0443a2929c9ac21e884ed79a90e 100644 --- a/make/jdk-rules.gmk +++ b/make/jdk-rules.gmk @@ -75,16 +75,16 @@ $(JDK_JAVA_EXE):: jdk-build jdk: jdk-build jdk-build: - @$(call MakeStart, jdk, $(JDK_BUILD_TARGETS)) + @$(call MakeStart,jdk,$(JDK_BUILD_TARGETS)) ( $(CD) $(JDK_TOPDIR)/make && \ $(MAKE) $(JDK_BUILD_TARGETS) $(JDK_BUILD_ARGUMENTS) ; ) - @$(call MakeFinish, jdk, $(JDK_BUILD_TARGETS)) + @$(call MakeFinish,jdk,$(JDK_BUILD_TARGETS)) jdk-clobber:: - @$(call MakeStart, jdk, $(JDK_CLOBBER_TARGETS)) + @$(call MakeStart,jdk,$(JDK_CLOBBER_TARGETS)) ( $(CD) $(JDK_TOPDIR)/make && \ $(MAKE) $(JDK_CLOBBER_TARGETS) $(JDK_BUILD_ARGUMENTS) ; ) - @$(call MakeFinish, jdk, $(JDK_CLOBBER_TARGETS)) + @$(call MakeFinish,jdk,$(JDK_CLOBBER_TARGETS)) jdk-sanity:: ( $(CD) $(JDK_TOPDIR)/make && \ @@ -92,17 +92,17 @@ jdk-sanity:: compare-images: compare-image compare-image: - @$(call MakeStart, jdk, compare-image) + @$(call MakeStart,jdk,compare-image) ( $(CD) $(JDK_TOPDIR)/make && \ $(MAKE) ALT_OUTPUTDIR=$(ABS_OUTPUTDIR) compare-image ) - @$(call MakeFinish, jdk, compare-image) + @$(call MakeFinish,jdk,compare-image) compare-images-clobber: compare-image-clobber compare-image-clobber: - @$(call MakeStart, jdk, compare-image-clobber) + @$(call MakeStart,jdk,compare-image-clobber) ( $(CD) $(JDK_TOPDIR)/make && \ $(MAKE) ALT_OUTPUTDIR=$(ABS_OUTPUTDIR) compare-image-clobber ) - @$(call MakeFinish, jdk, compare-image-clobber) + @$(call MakeFinish,jdk,compare-image-clobber) .PHONY: jdk jdk-build jdk-clobber jdk-sanity diff --git a/make/langtools-rules.gmk b/make/langtools-rules.gmk index 99ce0c1ce94b9c27905581bc5c3dfd6600638bb7..a0b2649ec47abe72013fc628eeac3319ea6ed322 100644 --- a/make/langtools-rules.gmk +++ b/make/langtools-rules.gmk @@ -35,17 +35,17 @@ LANGTOOLS_BUILD_ARGUMENTS = \ langtools: langtools-build langtools-build: $(MKDIR) -p $(LANGTOOLS_OUTPUTDIR) - @$(call MakeStart, langtools, all) + @$(call MakeStart,langtools,all) ($(CD) $(LANGTOOLS_TOPDIR)/make && \ $(MAKE) $(LANGTOOLS_BUILD_ARGUMENTS) all) - @$(call MakeFinish, langtools, all) + @$(call MakeFinish,langtools,all) langtools-clobber:: $(MKDIR) -p $(LANGTOOLS_OUTPUTDIR) - @$(call MakeStart, langtools, clobber) + @$(call MakeStart,langtools,clobber) ($(CD) $(LANGTOOLS_TOPDIR)/make && \ $(MAKE) $(LANGTOOLS_BUILD_ARGUMENTS) clobber) - @$(call MakeFinish, langtools, clobber) + @$(call MakeFinish,langtools,clobber) .PHONY: langtools langtools-build langtools-clobber diff --git a/make/sponsors-rules.gmk b/make/sponsors-rules.gmk index fd7fb4048b90224c7367ed963459a306857528a5..4fd60ea684d68dbf033a9346de8cece1c9ed1d82 100644 --- a/make/sponsors-rules.gmk +++ b/make/sponsors-rules.gmk @@ -59,10 +59,10 @@ endif sponsors-build: ifeq ($(ARCH_DATA_MODEL), 32) ifeq ($(BUILD_SPONSORS), true) - @$(call MakeStart, sponsors, $(SPONSORS_BUILD_TARGETS)) + @$(call MakeStart,sponsors,$(SPONSORS_BUILD_TARGETS)) ($(CD) $(SPONSORS_TOPDIR)/make && \ $(MAKE) $(SPONSORS_BUILD_TARGETS) $(SPONSORS_BUILD_ARGUMENTS)) - @$(call MakeFinish, sponsors, $(SPONSORS_BUILD_TARGETS)) + @$(call MakeFinish,sponsors,$(SPONSORS_BUILD_TARGETS)) endif endif