--- a/common/bin/compare.sh Wed Jul 05 22:17:45 2017 +0200
+++ b/common/bin/compare.sh Wed Oct 05 10:49:21 2016 +0200
@@ -654,10 +654,10 @@
OTHER_DIZ_FILE="$OTHER/support/native/java.base/java_objs/java.diz"
elif [ "$NAME" = "jimage.exe" ] \
&& [ -f "$OTHER/support/native/jdk.jlink/jimage_objs/jimage.diz" ]; then
- OTHER_DIZ_FILE="$OTHER/support/native/jdk.jlink/jimage_objs/jimage.diz"
+ OTHER_DIZ_FILE="$OTHER/support/modules_cmds/jdk.jlink/jimage.diz"
elif [ "$NAME" = "javacpl.exe" ] \
&& [ -f "$OTHER/support/native/jdk.plugin/javacpl/javacpl.diz" ]; then
- OTHER_DIZ_FILE="$OTHER/support/native/jdk.plugin/javacpl/javacpl.diz"
+ OTHER_DIZ_FILE="$OTHER/support/modules_cmds/jdk.deploy.controlpanel/javacpl.diz"
elif [ -f "${OTHER_FILE_BASE}.diz" ]; then
OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz
else
@@ -686,10 +686,10 @@
THIS_DIZ_FILE="$THIS/support/native/java.base/java_objs/java.diz"
elif [ "$NAME" = "jimage.exe" ] \
&& [ -f "$THIS/support/native/jdk.jlink/jimage_objs/jimage.diz" ]; then
- THIS_DIZ_FILE="$THIS/support/native/jdk.jlink/jimage_objs/jimage.diz"
+ THIS_DIZ_FILE="$THIS/support/modules_cmds/jdk.jlink/jimage.diz"
elif [ "$NAME" = "javacpl.exe" ] \
&& [ -f "$THIS/support/native/jdk.plugin/javacpl/javacpl.diz" ]; then
- THIS_DIZ_FILE="$THIS/support/native/jdk.plugin/javacpl/javacpl.diz"
+ THIS_DIZ_FILE="$THIS/support/modules_cmds/jdk.deploy.controlpanel/javacpl.diz"
elif [ -f "${THIS_FILE_BASE}.diz" ]; then
THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz
else
--- a/make/CopyImportModules.gmk Wed Jul 05 22:17:45 2017 +0200
+++ b/make/CopyImportModules.gmk Wed Oct 05 10:49:21 2016 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -59,9 +59,24 @@
$(eval $(call SetupCopyFiles, COPY_LIBS, \
SRC := $(LIBS_DIR), \
DEST := $(JDK_OUTPUTDIR)/lib, \
- FILES := $(call CacheFind, $(LIBS_DIR)), \
+ FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
))
- TARGETS += $(COPY_LIBS)
+
+ # Use relative links if the import dir is inside the OUTPUT_ROOT, otherwise
+ # copy to avoid having automated systems following symlinks when deleting files,
+ # or risk invalidating the build output from external changes.
+ ifeq ($(filter $(OUTPUT_ROOT)/%, $(LIBS_DIR)), )
+ LINK_MACRO := install-file
+ else
+ LINK_MACRO := link-file-relative
+ endif
+ $(eval $(call SetupCopyFiles, LINK_LIBS, \
+ SRC := $(LIBS_DIR), \
+ DEST := $(JDK_OUTPUTDIR)/lib, \
+ FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(LIBS_DIR))), \
+ MACRO := $(LINK_MACRO), \
+ ))
+ TARGETS += $(COPY_LIBS) $(LINK_LIBS)
endif
endif
--- a/make/CreateJmods.gmk Wed Jul 05 22:17:45 2017 +0200
+++ b/make/CreateJmods.gmk Wed Oct 05 10:49:21 2016 +0200
@@ -38,9 +38,9 @@
JMODS_DIR := $(IMAGES_OUTPUTDIR)/jmods
LIBS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
- $(SUPPORT_OUTPUTDIR)/modules_libs-stripped $(IMPORT_MODULES_LIBS))))
+ $(SUPPORT_OUTPUTDIR)/modules_libs $(IMPORT_MODULES_LIBS))))
CMDS_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
- $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped $(IMPORT_MODULES_CMDS))))
+ $(SUPPORT_OUTPUTDIR)/modules_cmds $(IMPORT_MODULES_CMDS))))
CONF_DIR := $(firstword $(wildcard $(addsuffix /$(MODULE), \
$(SUPPORT_OUTPUTDIR)/modules_conf $(IMPORT_MODULES_CONF))))
CLASSES_DIR := $(wildcard $(JDK_OUTPUTDIR)/modules/$(MODULE))
@@ -103,7 +103,7 @@
--os-arch $(OPENJDK_TARGET_CPU_LEGACY) \
--os-version $(REQUIRED_OS_VERSION) \
--module-path $(JMODS_DIR) \
- --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.pdb,*.map}' \
+ --exclude '**{_the.*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \
$(JMOD_FLAGS) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@)
$(MV) $(SUPPORT_OUTPUTDIR)/jmods/$(notdir $@) $@
--- a/make/Help.gmk Wed Jul 05 22:17:45 2017 +0200
+++ b/make/Help.gmk Wed Oct 05 10:49:21 2016 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,8 @@
$(info $(_) make [default] # Compile all modules in langtools, hotspot, jdk, jaxws,)
$(info $(_) # jaxp and corba, and create a runnable "exploded" image)
$(info $(_) make all # Compile everything, all repos, docs and images)
- $(info $(_) make images # Create complete jdk and jre images)
+ $(info $(_) make images # Create complete jdk and jre images (alias for product-images))
+ $(info $(_) make <name>-image # Build just the image (jdk, jre, test, docs etc))
$(info $(_) make <phase> # Build the specified phase and everything it depends on)
$(info $(_) # (gensrc, java, copy, libs, launchers, gendata, rmic))
$(info $(_) make *-only # Applies to most targets and disables compling the)
--- a/make/Images.gmk Wed Jul 05 22:17:45 2017 +0200
+++ b/make/Images.gmk Wed Oct 05 10:49:21 2016 +0200
@@ -382,14 +382,28 @@
################################################################################
# /demo dir
-ifneq ($(findstring images, $(MAKECMDGOALS)), )
+# Avoid doing the expensive find unless called with "jdk" as target.
+ifneq ($(filter jdk, $(MAKECMDGOALS)), )
+
+ DEMO_FILES := \
+ $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
+ $(call DoubleDollar, $(call DoubleDollar, \
+ $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
+ -type f -a ! \( -name "_the*" -o -name "javac_state" \) ))) \
+ )
+
+ ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ DEMO_FILES := $(call not-containing, .dSYM, $(DEMO_FILES))
+ else
+ DEMO_FILES := $(filter-out %.debuginfo %.pdb %.map, $(DEMO_FILES))
+ endif
+ endif
+
$(eval $(call SetupCopyFiles, JDK_COPY_DEMOS, \
SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
DEST := $(JDK_IMAGE_DIR)/demo, \
- FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
- $(call DoubleDollar, $(call DoubleDollar, \
- $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
- -type f -a ! \( -name "_the*" -o -name "javac_state" \) )))), \
+ FILES := $(DEMO_FILES), \
))
JDK_TARGETS += $(JDK_COPY_DEMOS)
@@ -454,21 +468,25 @@
LIBS_TARGET_SUBDIR := lib
endif
-DEBUGINFO_SUFFIXES := .diz .debuginfo .pdb .map
-
# Param 1 - dir to find debuginfo files in
FindDebuginfoFiles = \
$(wildcard $(addprefix $1/*, $(DEBUGINFO_SUFFIXES)) \
$(addprefix $1/*/*, $(DEBUGINFO_SUFFIXES)) \
$(addprefix $1/*/*/*, $(DEBUGINFO_SUFFIXES)))
-# On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
-# dirs.
-ifeq ($(OPENJDK_TARGET_OS)-$(ZIP_EXTERNAL_DEBUG_SYMBOLS), macosx-false)
- $(eval $(call FillCacheFind, \
- $(SUPPORT_OUTPUTDIR)/modules_cmds $(SUPPORT_OUTPUTDIR)/modules_libs/))
- FindDebuginfoFiles = \
- $(if $(wildcard $1), $(call containing, .dSYM/, $(call CacheFind, $1)))
+# Pick the correct debug info files to copy, either zipped or not.
+ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
+ DEBUGINFO_SUFFIXES += .diz
+else
+ DEBUGINFO_SUFFIXES := .debuginfo .pdb .map
+ # On Macosx, if debug symbols have not been zipped, find all files inside *.dSYM
+ # dirs.
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ $(eval $(call FillCacheFind, \
+ $(SUPPORT_OUTPUTDIR)/modules_cmds $(SUPPORT_OUTPUTDIR)/modules_libs))
+ FindDebuginfoFiles = \
+ $(if $(wildcard $1), $(call containing, .dSYM/, $(call CacheFind, $1)))
+ endif
endif
# Param 1 - either JDK or JRE
@@ -499,8 +517,11 @@
$(JRE_TARGETS): $(TOOL_JRE_TARGETS)
$(JDK_TARGETS): $(TOOL_JDK_TARGETS)
-jimages: $(TOOL_JRE_TARGETS) $(TOOL_JDK_TARGETS) $(JRE_TARGETS) $(JDK_TARGETS) \
- $(SYMBOLS_TARGETS)
+jdk: $(JDK_TARGETS)
+jre: $(JRE_TARGETS)
+symbols: $(SYMBOLS_TARGETS)
+
+all: jdk jre symbols
$(JRE_COMPACT1_TARGETS): $(TOOL_JRE_COMPACT1_TARGETS)
$(JRE_COMPACT2_TARGETS): $(TOOL_JRE_COMPACT2_TARGETS)
@@ -513,4 +534,4 @@
$(JRE_COMPACT2_TARGETS) \
$(JRE_COMPACT3_TARGETS)
-.PHONY: default all jimages profiles
+.PHONY: default all jdk jre symbols profiles
--- a/make/Javadoc.gmk Wed Jul 05 22:17:45 2017 +0200
+++ b/make/Javadoc.gmk Wed Oct 05 10:49:21 2016 +0200
@@ -773,19 +773,17 @@
# jvmtidocs
#
-ALL_OTHER_TARGETS += jvmtidocs
-
-JVMTI_DOCDIR = $(PLATFORM_DOCSDIR)/jvmti
-JVMTI_HTML = $(HOTSPOT_DIST)/docs/platform/jvmti/jvmti.html
+JVMTI_DOCDIR := $(PLATFORM_DOCSDIR)/jvmti
+# Pick jvmti.html from any jvm variant, they are all the same.
+JVMTI_HTML := $(firstword \
+ $(wildcard $(HOTSPOT_OUTPUTDIR)/variant-*/gensrc/jvmtifiles/jvmti.html))
-jvmtidocs: $(JVMTI_DOCDIR)/jvmti.html
-$(JVMTI_DOCDIR)/jvmti.html:
- @$(prep-javadoc)
- @if [ -f $(JVMTI_HTML) ] ; then \
- $(CP) $(JVMTI_HTML) $@; \
- else \
- $(ECHO) "WARNING: Generated file does not exist: $(JVMTI_HTML)"; \
- fi
+$(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \
+ FILES := $(JVMTI_HTML), \
+ DEST := $(PLATFORM_DOCSDIR)/jvmti, \
+))
+
+jvmtidocs: $(COPY_JVMTI_HTML)
#############################################################
#
--- a/make/Main.gmk Wed Jul 05 22:17:45 2017 +0200
+++ b/make/Main.gmk Wed Oct 05 10:49:21 2016 +0200
@@ -93,16 +93,13 @@
################################################################################
# Special targets for certain modules
-import-hotspot:
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
-
unpack-sec:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
generate-exported-symbols:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)
-ALL_TARGETS += import-hotspot unpack-sec generate-exported-symbols
+ALL_TARGETS += unpack-sec generate-exported-symbols
################################################################################
# Gensrc targets, generating source before java compilation can be done
@@ -269,23 +266,6 @@
ALL_TARGETS += generate-summary
################################################################################
-# Strip binaries targets
-
-STRIP_MODULES := $(sort $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES) \
- $(GENDATA_MODULES))
-STRIP_TARGETS := $(addsuffix -strip, $(STRIP_MODULES))
-
-define DeclareStripRecipe
- $1-strip:
- +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk \
- MODULE=$1)
-endef
-
-$(foreach m, $(STRIP_MODULES), $(eval $(call DeclareStripRecipe,$m)))
-
-ALL_TARGETS += $(STRIP_TARGETS)
-
-################################################################################
# Jmod targets
JMOD_MODULES := $(ALL_MODULES)
@@ -334,8 +314,14 @@
jrtfs-jar:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
-jimages:
- +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
+jdk-image:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jdk)
+
+jre-image:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jre)
+
+symbols-image:
+ +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk symbols)
profiles:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
@@ -347,7 +333,8 @@
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ExplodedImageOptimize.gmk)
ALL_TARGETS += source-tips create-hgtip-files bootcycle-images zip-security \
- zip-source jrtfs-jar jimages profiles mac-bundles-jdk \
+ zip-source jrtfs-jar jdk-image jre-image \
+ symbols-image profiles mac-bundles-jdk \
exploded-image-optimize
################################################################################
@@ -548,11 +535,9 @@
hotspot-ide-project: hotspot exploded-image
- import-hotspot: hotspot
-
generate-exported-symbols: java.base-libs jdk.jdwp.agent-libs
- $(LIBS_TARGETS): import-hotspot
+ $(LIBS_TARGETS): hotspot
$(LAUNCHER_TARGETS): java.base-libs
@@ -607,17 +592,8 @@
# Explicitly add dependencies for special targets
java.base-java: unpack-sec
- # The copy target copies files generated by gensrc
- java.base-copy-hotspot: java.base-gensrc-hotspot
-
jdk.jdeps-gendata: java rmic
- # Declare dependencies from <module>-strip to libs, launchers, gendata and copy
- $(foreach m, $(LIBS_MODULES), $(eval $m-strip: $m-libs))
- $(foreach m, $(LAUNCHER_MODULES), $(eval $m-strip: $m-launchers))
- $(foreach m, $(GENDATA_MODULES), $(eval $m-strip: $m-gendata))
- $(foreach m, $(COPY_MODULES), $(eval $m-strip: $m-copy))
-
# Declare dependencies between jmod targets. Only java.base jmod needs access
# to the other jmods to be built.
# When creating a BUILDJDK, we don't need to add hashes to java.base, thus
@@ -628,7 +604,6 @@
endif
# Declare dependencies from <module>-jmod to all other module targets
- $(foreach m, $(STRIP_MODULES), $(eval $m-jmod: $m-strip))
# When creating a BUILDJDK, the java compilation has already been done by the
# normal build and copied in.
ifneq ($(CREATING_BUILDJDK), true)
@@ -678,18 +653,19 @@
endif
generate-classlist: buildtools-jdk
- jimages: generate-classlist
+ jdk-image jre-image: generate-classlist
endif
- jimages: jmods zip-source source-tips demos samples jrtfs-jar
+ jdk-image: jmods zip-source source-tips demos samples jrtfs-jar
+ jre-image: jmods source-tips jrtfs-jar
profiles: jmods zip-source source-tips jrtfs-jar
- mac-bundles-jdk: jimages
+ mac-bundles-jdk: jdk-image jre-image
exploded-image-optimize: exploded-image-base buildtools-modules
- bootcycle-images: jimages
+ bootcycle-images: jdk-image
docs-javadoc: $(GENSRC_TARGETS) rmic
@@ -697,7 +673,7 @@
zip-docs: docs-javadoc docs-jvmtidoc
- test: jimages test-image
+ test: jdk-image test-image
create-buildjdk-copy: jdk.jlink-java java.base-gendata \
$(addsuffix -java, $(INTERIM_IMAGE_MODULES))
@@ -716,7 +692,7 @@
test-image-failure-handler: build-test-failure-handler
- build-test-hotspot-jtreg-native: buildtools-jdk import-hotspot
+ build-test-hotspot-jtreg-native: buildtools-jdk hotspot
build-test-jdk-jtreg-native: buildtools-jdk
@@ -728,7 +704,7 @@
test-hotspot-internal: exploded-image
- test-hotspot-jtreg: jimages test-image
+ test-hotspot-jtreg: jdk-image test-image
test-hotspot-gtest: exploded-image test-image-hotspot-gtest
@@ -766,8 +742,6 @@
jmods: $(JMOD_TARGETS)
-strip-binaries: $(STRIP_TARGETS)
-
# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
# is actually handled by jdk.jdi-gensrc
jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
@@ -798,7 +772,11 @@
# This target builds the product images, e.g. the JRE and JDK image
# (and possibly other, more specific versions)
-product-images: jimages demos samples zip-security exploded-image
+product-images: jdk-image jre-image symbols-image exploded-image
+
+# zip-security is actually a bundle, but for now it needs to be considered
+# an image until this can be cleaned up properly.
+product-images: zip-security
# The module summary cannot be run when:
# * Cross compiling and building a partial BUILDJDK for the build host
--- a/make/MainSupport.gmk Wed Jul 05 22:17:45 2017 +0200
+++ b/make/MainSupport.gmk Wed Oct 05 10:49:21 2016 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -88,9 +88,7 @@
@$(PRINTF) "\n" $(LOG_DEBUG)
$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
- $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1)
$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
- $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1)
@$(PRINTF) " done\n"
endef
--- a/make/ModuleWrapper.gmk Wed Jul 05 22:17:45 2017 +0200
+++ b/make/ModuleWrapper.gmk Wed Oct 05 10:49:21 2016 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -45,44 +45,59 @@
ifeq ($(OPENJDK_TARGET_OS), windows)
TO_BIN_FILTER := %$(SHARED_LIBRARY_SUFFIX) %.diz %.pdb %.map
- $(eval $(call SetupCopyFiles,COPY_LIBS_TO_BIN, \
+ $(eval $(call SetupCopyFiles, COPY_LIBS_TO_BIN, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
DEST := $(JDK_OUTPUTDIR)/bin, \
FILES := $(filter $(TO_BIN_FILTER), \
$(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
- $(TARGETS)))))
+ $(TARGETS))), \
+ ))
- $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+ $(eval $(call SetupCopyFiles, COPY_LIBS_TO_LIB, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(filter-out $(TO_BIN_FILTER), \
$(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
- $(TARGETS)))))
+ $(TARGETS))), \
+ ))
else
- $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+ $(eval $(call SetupCopyFiles, COPY_LIBS_TO_LIB, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
DEST := $(JDK_OUTPUTDIR)/lib, \
- FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
- $(TARGETS))))
+ FILES := $(filter %$(SHARED_LIBRARY_SUFFIX), \
+ $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+ $(TARGETS))), \
+ ))
+ $(eval $(call SetupCopyFiles, LINK_LIBS_TO_LIB, \
+ SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+ DEST := $(JDK_OUTPUTDIR)/lib, \
+ FILES := $(filter-out %$(SHARED_LIBRARY_SUFFIX), \
+ $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+ $(TARGETS))), \
+ MACRO := link-file-relative, \
+ ))
endif
-$(eval $(call SetupCopyFiles,COPY_INCLUDE, \
+$(eval $(call SetupCopyFiles, COPY_INCLUDE, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
DEST := $(JDK_OUTPUTDIR)/include, \
FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)/%, \
- $(TARGETS))))
+ $(TARGETS)), \
+))
-$(eval $(call SetupCopyFiles,COPY_CMDS, \
+$(eval $(call SetupCopyFiles, COPY_CMDS, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
DEST := $(JDK_OUTPUTDIR)/bin, \
- FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/%, $(TARGETS))))
+ FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/%, $(TARGETS)), \
+))
-$(eval $(call SetupCopyFiles,COPY_CONF, \
+$(eval $(call SetupCopyFiles, COPY_CONF, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE), \
DEST := $(JDK_OUTPUTDIR)/conf, \
FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)/%, \
- $(TARGETS))))
+ $(TARGETS)), \
+))
all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
- $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF)
+ $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF) $(LINK_LIBS_TO_LIB)
--- a/make/StripBinaries.gmk Wed Jul 05 22:17:45 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-#
-# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, , StripBinaries.gmk))
-
-################################################################################
-# Copy native libraries and executables to a secondary location to strip them
-# and filter out files that shouldn't go into the image.
-
-MODULES_CMDS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
-MODULES_LIBS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
-
-ifneq ($(STRIP), )
- define StripRecipe
- $(call LogInfo, Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<))
- $(call MakeDir, $(@D))
- $(CP) $< $@.tmp
- $(CHMOD) u+w $@.tmp
- $(STRIP) $(STRIPFLAGS) $@.tmp
- $(CHMOD) go-w $@.tmp
- $(MV) $@.tmp $@
- endef
-else
- define StripRecipe
- $(call install-file)
- endef
-endif
-
-NO_STRIP_CMDS_FILTER += %.cgi
-
-# Don't include debug info for executables.
-ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)), )
- # OS X stores symbol information in a .dylib file inside a .dSYM directory -
- # that file should not be stripped, so we prune the tree at the .dSYM directory.
- ALL_CMDS_SRC := $(filter-out %.bc %.debuginfo %.diz %.map %.pdb, \
- $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE) \( -type f -o -type l \) \
- -print -o -name "*.dSYM" -prune))
- COPY_CMDS_SRC := $(filter $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC))
- STRIP_CMDS_SRC := $(filter-out $(NO_STRIP_CMDS_FILTER), $(ALL_CMDS_SRC))
-endif
-
-ifneq ($(wildcard $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)), )
- # OS X stores symbol information in a .dylib file inside a .dSYM directory -
- # that file should not be stripped, so we prune the tree at the .dSYM directory.
- # Example: support/modules_libs/java.base/libjsig.dylib.dSYM/Contents/Resources/DWARF/libjsig.dylib
- STRIP_LIBS_SRC := \
- $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE) \
- -name '*$(SHARED_LIBRARY_SUFFIX)' -type f -print -o -name "*.dSYM" -prune)
-
- # Make sure symbolic links are copied and not stripped.
- COPY_LIBS_SRC := \
- $(filter-out $(STRIP_LIBS_SRC), \
- $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE) -type f -o -type l))
-endif
-
-$(eval $(call SetupCopyFiles,STRIP_MODULES_CMDS, \
- SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
- DEST := $(MODULES_CMDS_STRIPPED), \
- FILES := $(STRIP_CMDS_SRC), \
- MACRO := StripRecipe))
-
-$(eval $(call SetupCopyFiles,COPY_MODULES_CMDS, \
- SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
- DEST := $(MODULES_CMDS_STRIPPED), \
- FILES := $(COPY_CMDS_SRC)))
-
-$(eval $(call SetupCopyFiles,STRIP_MODULES_LIBS, \
- SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
- DEST := $(MODULES_LIBS_STRIPPED), \
- FILES := $(STRIP_LIBS_SRC), \
- MACRO := StripRecipe))
-
-$(eval $(call SetupCopyFiles,COPY_MODULES_LIBS, \
- SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
- DEST := $(MODULES_LIBS_STRIPPED), \
- FILES := $(COPY_LIBS_SRC)))
-
-TARGETS += $(STRIP_MODULES_CMDS) $(COPY_MODULES_CMDS) \
- $(STRIP_MODULES_LIBS) $(COPY_MODULES_LIBS)
-
-all: $(TARGETS)
--- a/make/common/MakeBase.gmk Wed Jul 05 22:17:45 2017 +0200
+++ b/make/common/MakeBase.gmk Wed Oct 05 10:49:21 2016 +0200
@@ -535,6 +535,67 @@
endif
################################################################################
+# Take two paths and return the path of the last common directory.
+# Ex: /foo/bar/baz, /foo/bar/banan -> /foo/bar
+# foo/bar/baz, /foo/bar -> <empty>
+#
+# The x prefix is used to preserve the presence of the initial slash
+#
+# $1 - Path to compare
+# $2 - Other path to compare
+FindCommonPathPrefix = \
+ $(patsubst x%,%,$(subst $(SPACE),/,$(strip \
+ $(call FindCommonPathPrefixHelper, \
+ $(subst /,$(SPACE),x$(strip $1)), $(subst /,$(SPACE),x$(strip $2))) \
+ )))
+
+FindCommonPathPrefixHelper = \
+ $(if $(call equals, $(firstword $1), $(firstword $2)), \
+ $(firstword $1) \
+ $(call FindCommonPathPrefixHelper, \
+ $(wordlist 2, $(words $1), $1), $(wordlist 2, $(words $2), $2) \
+ ) \
+ )
+
+# Convert a partial path into as many directory levels of ../, removing
+# leading and following /.
+# Ex: foo/bar/baz/ -> ../../..
+# foo/bar -> ../..
+# /foo -> ..
+DirToDotDot = \
+ $(subst $(SPACE),/,$(foreach d, $(subst /,$(SPACE),$1),..))
+
+# Computes the relative path from a directory to a file
+# $1 - File to compute the relative path to
+# $2 - Directory to compute the relative path from
+RelativePath = \
+ $(eval $1_prefix := $(call FindCommonPathPrefix, $1, $2)) \
+ $(eval $1_dotdots := $(call DirToDotDot, $(patsubst $($(strip $1)_prefix)/%, %, $2))) \
+ $(eval $1_suffix := $(patsubst $($(strip $1)_prefix)/%, %, $1)) \
+ $($(strip $1)_dotdots)/$($(strip $1)_suffix)
+
+################################################################################
+# link-file-* works similarly to install file but creates a symlink instead on
+# platforms that support it. There are two versions, either creating a relative
+# or an absolute link.
+ifeq ($(OPENJDK_BUILD_OS), windows)
+ link-file-absolute = $(install-file)
+ link-file-relative = $(install-file)
+else
+ define link-file-relative
+ $(call MakeDir, $(@D))
+ $(RM) $@
+ $(LN) -s $(call RelativePath, $<, $(@D)) $@
+ endef
+
+ define link-file-absolute
+ $(call MakeDir, $(@D))
+ $(RM) $@
+ $(LN) -s $< $@
+ endef
+endif
+
+################################################################################
# Filter out duplicate sub strings while preserving order. Keeps the first occurance.
uniq = \
$(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
--- a/make/common/NativeCompilation.gmk Wed Jul 05 22:17:45 2017 +0200
+++ b/make/common/NativeCompilation.gmk Wed Oct 05 10:49:21 2016 +0200
@@ -346,6 +346,7 @@
# LIBS the libraries to link to
# ARFLAGS the archiver flags to be used
# OBJECT_DIR the directory where we store the object files
+# OUTPUT_DIR the directory where the resulting binary is put
# LIBRARY the resulting library file
# PROGRAM the resulting exec file
# INCLUDES only pick source from these directories
@@ -829,67 +830,58 @@
ifneq ($$($1_DEBUG_SYMBOLS), false)
# Only copy debug symbols for dynamic libraries and programs.
ifeq ($$($1_STATIC_LIBRARY), )
- ifneq ($$($1_OUTPUT_DIR), $$($1_OBJECT_DIR))
- # The dependency on TARGET is needed on windows for debuginfo files
- # to be rebuilt properly.
- $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/% $$($1_TARGET)
- # Use cp -r since on macosx, the dSYM is a directory
- $(CP) -r $$< $$@
- endif
-
# Generate debuginfo files.
ifeq ($(OPENJDK_TARGET_OS), windows)
- $1_EXTRA_LDFLAGS += -debug "-pdb:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb" \
- "-map:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map"
- $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
- $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
+ $1_EXTRA_LDFLAGS += -debug "-pdb:$$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).pdb" \
+ "-map:$$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).map"
+ $1_DEBUGINFO_FILES := $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).pdb \
+ $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).map
# No separate command is needed for debuginfo on windows, instead
# touch target to make sure it has a later time stamp than the debug
# symbol files to avoid unnecessary relinking on rebuild.
$1_CREATE_DEBUGINFO_CMDS := $(TOUCH) $$($1_TARGET)
else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
- $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
+ $1_DEBUGINFO_FILES := $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).debuginfo
# Setup the command line creating debuginfo files, to be run after linking.
# It cannot be run separately since it updates the original target file
$1_CREATE_DEBUGINFO_CMDS := \
- $$($1_OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
- $(CD) $$($1_OUTPUT_DIR) && \
- $$($1_OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
+ $$($1_OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
+ $(CD) $$($1_OUTPUT_DIR) && \
+ $$($1_OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
else ifeq ($(OPENJDK_TARGET_OS), macosx)
- $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM
+ $1_DEBUGINFO_FILES := \
+ $$($1_OUTPUT_DIR)/$$($1_BASENAME).dSYM/Contents/Info.plist \
+ $$($1_OUTPUT_DIR)/$$($1_BASENAME).dSYM/Contents/Resources/DWARF/$$($1_BASENAME)
# On Macosx, the debuginfo generation doesn't touch the linked binary, but
# to avoid always relinking, touch it anyway to force a later timestamp than
# the dSYM files.
$1_CREATE_DEBUGINFO_CMDS := \
- $(DSYMUTIL) --out $$($1_DEBUGINFO_FILES) $$($1_TARGET) $$(NEWLINE) \
+ $(DSYMUTIL) --out $$($1_OUTPUT_DIR)/$$($1_BASENAME).dSYM $$($1_TARGET) $$(NEWLINE) \
$(TOUCH) $$($1_TARGET)
endif # OPENJDK_TARGET_OS
- # This dependency dance ensures that debug info files get rebuilt
- # properly if deleted.
- $$($1_TARGET): $$($1_DEBUGINFO_FILES)
- $$($1_DEBUGINFO_FILES): $$($1_ALL_OBJS)
+ $$($1_DEBUGINFO_FILES): $$($1_TARGET)
+
+ $1 += $$($1_DEBUGINFO_FILES)
ifeq ($$($1_ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
- $1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
- $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
+ $1_DEBUGINFO_ZIP := $$($1_OUTPUT_DIR)/$$($1_NOSUFFIX).diz
+ $1 += $$($1_DEBUGINFO_ZIP)
# The dependency on TARGET is needed for debuginfo files
# to be rebuilt properly.
$$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
- $(CD) $$($1_OBJECT_DIR) \
- && $(ZIP) -q -r $$@ $$(notdir $$($1_DEBUGINFO_FILES))
+ $(CD) $$($1_OUTPUT_DIR) && \
+ $(ZIP) -q -r $$@ $$(subst $$($1_OUTPUT_DIR)/,, $$($1_DEBUGINFO_FILES))
- else
- $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_FILES))
endif
- endif # !STATIC_LIBRARY
+ endif # !STATIC_LIBRARY
endif # $1_DEBUG_SYMBOLS != false
endif # COPY_DEBUG_SYMBOLS
- ifeq ($$($1_STRIP_SYMBOLS), true)
+ ifneq ($$($1_STRIP_SYMBOLS), false)
ifneq ($$($1_STRIP), )
# Default to using the global STRIPFLAGS. Allow for overriding with an empty value
$1_STRIPFLAGS ?= $(STRIPFLAGS)
@@ -902,6 +894,8 @@
$1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
ifeq ($(OPENJDK_TARGET_OS), windows)
$1_EXTRA_LDFLAGS += "-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
+ # Create a rule for the import lib so that other rules may depend on it
+ $$($1_OBJECT_DIR)/$$($1_LIBRARY).lib: $$($1_TARGET)
endif
# Create loadmap on AIX. Helps in diagnosing some problems.
--- a/make/common/TestFilesCompilation.gmk Wed Jul 05 22:17:45 2017 +0200
+++ b/make/common/TestFilesCompilation.gmk Wed Oct 05 10:49:21 2016 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -88,6 +88,8 @@
LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$($1_PREFIX)$$(name)), \
LIBS := $$($1_LIBS_$$($1_PREFIX)$$(name)), \
OPTIMIZATION := LOW, \
+ COPY_DEBUG_SYMBOLS := false, \
+ STRIP_SYMBOLS := false, \
)) \
$$(eval $1 += $$(BUILD_TEST_$$(name)) ) \
)
--- a/test/make/TestMakeBase.gmk Wed Jul 05 22:17:45 2017 +0200
+++ b/test/make/TestMakeBase.gmk Wed Oct 05 10:49:21 2016 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -264,4 +264,81 @@
$(call PathList, $(PATHLIST_INPUT)), \
PathList call not safe for calling twice))
+################################################################################
+# Test FindCommonPathPrefix
+
+$(eval $(call assert-equals, \
+ $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/banan), \
+ /foo/bar, \
+ FindCommonPathPrefix, \
+))
+
+$(eval $(call assert-equals, \
+ $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar), \
+ /foo/bar, \
+ FindCommonPathPrefix, \
+))
+
+$(eval $(call assert-equals, \
+ $(call FindCommonPathPrefix, /foo/bar/baz, /foo/bar/), \
+ /foo/bar, \
+ FindCommonPathPrefix, \
+))
+
+$(eval $(call assert-equals, \
+ $(call FindCommonPathPrefix, foo/bar/baz, foo/bar/banan), \
+ foo/bar, \
+ FindCommonPathPrefix, \
+))
+
+$(eval $(call assert-equals, \
+ $(call FindCommonPathPrefix, foo/bar/baz, /foo/bar/banan), \
+ , \
+ FindCommonPathPrefix, \
+))
+
+################################################################################
+# DirToDotDot
+
+$(eval $(call assert-equals, \
+ $(call DirToDotDot, foo/bar/baz/), \
+ ../../.., \
+ DirToDotDot, \
+))
+
+$(eval $(call assert-equals, \
+ $(call DirToDotDot, foo/bar), \
+ ../.., \
+ DirToDotDot, \
+))
+
+$(eval $(call assert-equals, \
+ $(call DirToDotDot, /foo), \
+ .., \
+ DirToDotDot, \
+))
+
+################################################################################
+# RelativePath
+
+$(eval $(call assert-equals, \
+ $(call RelativePath, foo/bar/baz, foo/bar/banan), \
+ ../baz, \
+ RelativePath, \
+))
+
+$(eval $(call assert-equals, \
+ $(call RelativePath, foo/bar/baz/banan/kung, foo/bar/banan/kung), \
+ ../../baz/banan/kung, \
+ RelativePath, \
+))
+
+$(eval $(call assert-equals, \
+ $(call RelativePath, /foo/bar/baz/banan/kung, /foo/bar/banan/kung/), \
+ ../../baz/banan/kung, \
+ RelativePath, \
+))
+
+################################################################################
+
all: $(TEST_TARGETS)