< prev index next >
make/common/MakeBase.gmk
Print this page
@@ -84,12 +84,11 @@
# Store the build times in this directory.
BUILDTIMESDIR=$(OUTPUT_ROOT)/make-support/build-times
# 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_$(strip $1)
+ $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1) && \
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)_human_readable
endef
# Record ending time and calculate the difference and store it in a
# easy to read format. Handles builds that cross midnight. Expects
@@ -231,10 +230,11 @@
$$(call ListPathsSafely_IfPrintf,$1,$2,9501,9750)
$$(call ListPathsSafely_IfPrintf,$1,$2,9751,10000)
endef
endif # HAS_FILE_FUNCTION
+################################################################################
# The source tips can come from the Mercurial repository, or in the files
# $(HGTIP_FILENAME) which contains the tip but is also positioned in the same
# directory as the original $(HGDIR) directory.
# These should not be := assignments, only used from the root Makefile.
HG_VERSION = $(shell $(HG) version 2> /dev/null)
@@ -262,16 +262,18 @@
fi; \
done >> $@
$(PRINTF) "\n" >> $@
endef
-# Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk
+# Create the HGTIP_FILENAME file. Called from closed/make/SourceBundles.gmk
define CreateHgTip
$(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME); \
$(ECHO) $1/$(HGTIP_FILENAME)
endef
+################################################################################
+
define SetupLogging
ifeq ($$(LOG_LEVEL), trace)
# 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)
@@ -366,13 +368,13 @@
$(call $(0)Body,$(strip $1))
endef
################################################################################
# Make directory without forking mkdir if not needed
+# 1: List of directories to create
MakeDir = \
- $(strip $(if $(subst $(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),,$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9)),\
- $(shell $(MKDIR) -p $1 $2 $3 $4 $5 $6 $7 $8 $9)))
+ $(strip $(if $(wildcard $1), , $(shell $(MKDIR) -p $1)))
################################################################################
# Assign a variable only if it is empty
# Param 1 - Variable to assign
# Param 2 - Value to assign
@@ -416,11 +418,12 @@
endef
else
# Running mkdir and cp in the same shell speeds up copy intensive tasks in Cygwin
# significantly.
define install-file
- $(MKDIR) -p '$(@D)' && $(CP) -fP '$<' '$@'
+ $(call MakeDir, $(@D))
+ $(CP) -fP '$<' '$@'
endef
endif
################################################################################
# Filter out duplicate sub strings while preserving order. Keeps the first occurance.
@@ -539,11 +542,11 @@
# 1 : Source file
# 2 : Dest file
# 3 : Variable to add targets to
# 4 : Macro to call for copy operation
$2: $1
- $(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
+ $$(call LogInfo, Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@))
$$($$(strip $4))
$3 += $2
endef
@@ -684,12 +687,14 @@
# failure-logs directory.
# Param 1 - The log file of the failed command
# Param 2 - A compact but representative name to describe this command
# Param 3 - Command to run
LogFailures = \
- ( ($(BASH) $(SRC_ROOT)/common/bin/logger.sh $1 $3 && $(RM) $1) || \
- (exitcode=$(DOLLAR)$(DOLLAR)? && $(MV) $1 $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(strip $2).log && exit $(DOLLAR)$(DOLLAR)exitcode) )
+ ( $3 > >($(TEE) $1) 2> >($(TEE) $1 >&2) || \
+ (exitcode=$(DOLLAR)$(DOLLAR)? && \
+ $(CP) $1 $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(strip $2).log && \
+ exit $(DOLLAR)$(DOLLAR)exitcode) )
################################################################################
# Find lib dir for module
# Param 1 - module name
ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
< prev index next >