hotspot/make/bsd/makefiles/universal.gmk
author alanb
Tue, 03 May 2016 09:11:31 +0100
changeset 37827 09fa0c82a5f7
parent 31365 dc7a49d816b8
permissions -rw-r--r--
8154956: Module system implementation refresh (4/2016) Reviewed-by: alanb, mchung, chegar, redestad Contributed-by: alan.bateman@oracle.com, erik.joelsson@oracle.com

#
# Copyright (c) 2006, 2013, 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.
#
# 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.
#
#

# macosx universal builds
universal_product:
	$(MAKE) MACOSX_UNIVERSAL=true all_product_universal
universal_optimized:
	$(MAKE) MACOSX_UNIVERSAL=true all_optimized_universal
universal_fastdebug:
	$(MAKE) MACOSX_UNIVERSAL=true all_fastdebug_universal
universal_debug:
	$(MAKE) MACOSX_UNIVERSAL=true all_debug_universal


# Universal builds include 1 or more architectures in a single binary
all_product_universal:
#	$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_PRODUCT_TARGETS)
	$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_PRODUCT_TARGETS)
	$(QUIETLY) $(MAKE) BUILD_FLAVOR=product EXPORT_SUBDIR= universalize
all_optimized_universal:
#	$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_OPTIMIZED_TARGETS)
	$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_OPTIMIZED_TARGETS)
	$(QUIETLY) $(MAKE) BUILD_FLAVOR=optimized EXPORT_SUBDIR=/optimized universalize
all_fastdebug_universal:
#	$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_FASTDEBUG_TARGETS)
	$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_FASTDEBUG_TARGETS)
	$(QUIETLY) $(MAKE) BUILD_FLAVOR=fastdebug EXPORT_SUBDIR=/fastdebug universalize
all_debug_universal:
#	$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_DEBUG_TARGETS)
	$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_DEBUG_TARGETS)
	$(QUIETLY) $(MAKE) BUILD_FLAVOR=debug EXPORT_SUBDIR=/debug universalize


# Consolidate architecture builds into a single Universal binary
universalize: $(UNIVERSAL_LIPO_LIST) $(UNIVERSAL_COPY_LIST)
	$(RM) -r $(EXPORT_PATH)/lib/{i386,amd64}

LIPO ?= lipo

# Package built libraries in a universal binary
$(UNIVERSAL_LIPO_LIST):
	BUILT_LIPO_FILES="`find $(EXPORT_LIB_DIR)/{i386,amd64}/$(subst $(EXPORT_LIB_DIR)/,,$@) 2>/dev/null`" || test $$? = "1"; \
	if [ -n "$${BUILT_LIPO_FILES}" ]; then \
	  $(MKDIR) -p $(shell dirname $@); \
	  $(LIPO) -create -output $@ $${BUILT_LIPO_FILES}; \
	fi


# Copy built non-universal binaries in place
# - copies directories; including empty dirs
# - copies files, symlinks, other non-directory files
$(UNIVERSAL_COPY_LIST):
	BUILT_COPY_FILES="`find $(EXPORT_LIB_DIR)/{i386,amd64}/$(subst $(EXPORT_LIB_DIR)/,,$@) -prune 2>/dev/null`" || test $$? = "1"; \
	if [ -n "$${BUILT_COPY_FILES}" ]; then \
	  for i in $${BUILT_COPY_FILES}; do \
	    $(MKDIR) -p $(shell dirname $@); \
	    $(CP) -R $${i} $@; \
	  done; \
	fi


# Replace arch specific binaries with universal binaries
# Do not touch lib/{client,server}/libjsig.$(LIBRARY_SUFFIX)
# That symbolic link belongs to the 'jdk' build.
export_universal:
	$(RM) -r $(EXPORT_PATH)/lib/{i386,amd64}
	$(RM) -r $(JDK_IMAGE_DIR)/lib/{i386,amd64}
	($(CD) $(EXPORT_PATH) && \
	  $(TAR) -cf - *) | \
	  ($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xpf -)


# Overlay universal binaries
# Do not touch lib/{client,server}/libjsig.$(LIBRARY_SUFFIX)
# That symbolic link belongs to the 'jdk' build.
copy_universal:
	$(RM) -r $(JDK_IMAGE_DIR)$(COPY_SUBDIR)/lib/{i386,amd64}
	($(CD) $(EXPORT_PATH)$(COPY_SUBDIR) && \
	  $(TAR) -cf - *) | \
	  ($(CD) $(JDK_IMAGE_DIR)$(COPY_SUBDIR) && $(TAR) -xpf -)


# Additional processing for universal builds
export_product_jdk::
	$(MAKE) EXPORT_SUBDIR=           export_universal
export_optimized_jdk::
	$(MAKE) EXPORT_SUBDIR=/optimized export_universal
export_fastdebug_jdk::
	$(MAKE) EXPORT_SUBDIR=/fastdebug export_universal
export_debug_jdk::
	$(MAKE) EXPORT_SUBDIR=/debug     export_universal
copy_product_jdk::
	$(MAKE) COPY_SUBDIR=             copy_universal
copy_optimized_jdk::
	$(MAKE) COPY_SUBDIR=/optimized   copy_universal
copy_fastdebug_jdk::
	$(MAKE) COPY_SUBDIR=/fastdebug   copy_universal
copy_debug_jdk::
	$(MAKE) COPY_SUBDIR=/debug       copy_universal

.PHONY:	universal_product universal_fastdebug universal_debug \
	all_product_universal all_fastdebug_universal all_debug_universal \
	universal_optimized all_optimized_universal \
	universalize export_universal copy_universal \
	$(UNIVERSAL_LIPO_LIST) $(UNIVERSAL_COPY_LIST)