changeset 753:78aaf5d3314d

8010385: build with LOG=trace broken on mac Reviewed-by: dholmes, tbell, prr
author erikj
date Fri, 28 Jun 2013 12:02:37 +0200
parents 0e533ceee717
children dd3b314f4471
files common/autoconf/basics.m4 common/autoconf/generated-configure.sh common/autoconf/spec.gmk.in common/makefiles/MakeBase.gmk
diffstat 4 files changed, 24 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/common/autoconf/basics.m4	Fri Jun 28 12:00:03 2013 +0200
+++ b/common/autoconf/basics.m4	Fri Jun 28 12:02:37 2013 +0200
@@ -622,6 +622,14 @@
 AC_PATH_PROG(HG, hg)
 AC_PATH_PROG(STAT, stat)
 AC_PATH_PROG(TIME, time)
+# Check if it's GNU time
+IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'`
+if test "x$IS_GNU_TIME" != x; then
+  IS_GNU_TIME=yes
+else
+  IS_GNU_TIME=no
+fi
+AC_SUBST(IS_GNU_TIME)
 
 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   BASIC_REQUIRE_PROG(COMM, comm)
--- a/common/autoconf/generated-configure.sh	Fri Jun 28 12:00:03 2013 +0200
+++ b/common/autoconf/generated-configure.sh	Fri Jun 28 12:02:37 2013 +0200
@@ -799,6 +799,7 @@
 PKG_CONFIG
 CODESIGN
 XATTR
+IS_GNU_TIME
 TIME
 STAT
 HG
@@ -3785,7 +3786,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1372413413
+DATE_WHEN_GENERATED=1372413705
 
 ###############################################################################
 #
@@ -10472,6 +10473,14 @@
 fi
 
 
+# Check if it's GNU time
+IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'`
+if test "x$IS_GNU_TIME" != x; then
+  IS_GNU_TIME=yes
+else
+  IS_GNU_TIME=no
+fi
+
 
 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
 
--- a/common/autoconf/spec.gmk.in	Fri Jun 28 12:00:03 2013 +0200
+++ b/common/autoconf/spec.gmk.in	Fri Jun 28 12:02:37 2013 +0200
@@ -510,6 +510,7 @@
 TAIL:=@TAIL@
 TEE:=@TEE@
 TIME:=@TIME@
+IS_GNU_TIME:=@IS_GNU_TIME@
 TR:=@TR@
 TOUCH:=@TOUCH@
 UNIQ:=@UNIQ@
--- a/common/makefiles/MakeBase.gmk	Fri Jun 28 12:00:03 2013 +0200
+++ b/common/makefiles/MakeBase.gmk	Fri Jun 28 12:02:37 2013 +0200
@@ -332,9 +332,11 @@
         # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
         # For each target executed, will print
         # Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer)
-        # but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much (and causing a crash on Cygwin).
-        OLD_SHELL:=$$(SHELL)
-        WRAPPER_SHELL:=$$(OLD_SHELL) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(TIME),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(OLD_SHELL)
+        # but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much 
+        # (and causing a crash on Cygwin).
+        # Default shell seems to always be /bin/sh. Must override with bash to get this to work on Solaris.
+        # Only use time if it's GNU time which supports format and output file.
+        WRAPPER_SHELL:=/bin/bash $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(findstring yes,$$(IS_GNU_TIME)),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log /bin/bash
         SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL)
     endif
     # Never remove warning messages; this is just for completeness