make/bsd/makefiles/universal.gmk

Thu, 12 Oct 2017 21:27:07 +0800

author
aoqi
date
Thu, 12 Oct 2017 21:27:07 +0800
changeset 7535
7ae4e26cb1e0
parent 7138
63bae08b051e
parent 6876
710a3c8b516e
permissions
-rw-r--r--

merge

aoqi@0 1 #
aoqi@0 2 # Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 #
aoqi@0 5 # This code is free software; you can redistribute it and/or modify it
aoqi@0 6 # under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 # published by the Free Software Foundation.
aoqi@0 8 #
aoqi@0 9 # This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 # version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 # accompanied this code).
aoqi@0 14 #
aoqi@0 15 # You should have received a copy of the GNU General Public License version
aoqi@0 16 # 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 #
aoqi@0 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 # or visit www.oracle.com if you need additional information or have any
aoqi@0 21 # questions.
aoqi@0 22 #
aoqi@0 23 #
aoqi@0 24
aoqi@0 25 # macosx universal builds
aoqi@0 26 universal_product:
aoqi@0 27 $(MAKE) MACOSX_UNIVERSAL=true all_product_universal
kvn@7138 28 universal_optimized:
kvn@7138 29 $(MAKE) MACOSX_UNIVERSAL=true all_optimized_universal
aoqi@0 30 universal_fastdebug:
aoqi@0 31 $(MAKE) MACOSX_UNIVERSAL=true all_fastdebug_universal
aoqi@0 32 universal_debug:
aoqi@0 33 $(MAKE) MACOSX_UNIVERSAL=true all_debug_universal
aoqi@0 34
aoqi@0 35
aoqi@0 36 # Universal builds include 1 or more architectures in a single binary
aoqi@0 37 all_product_universal:
aoqi@0 38 # $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_PRODUCT_TARGETS)
aoqi@0 39 $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_PRODUCT_TARGETS)
aoqi@0 40 $(QUIETLY) $(MAKE) BUILD_FLAVOR=product EXPORT_SUBDIR= universalize
kvn@7138 41 all_optimized_universal:
kvn@7138 42 # $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_OPTIMIZED_TARGETS)
kvn@7138 43 $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_OPTIMIZED_TARGETS)
kvn@7138 44 $(QUIETLY) $(MAKE) BUILD_FLAVOR=optimized EXPORT_SUBDIR=/optimized universalize
aoqi@0 45 all_fastdebug_universal:
aoqi@0 46 # $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_FASTDEBUG_TARGETS)
aoqi@0 47 $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_FASTDEBUG_TARGETS)
aoqi@0 48 $(QUIETLY) $(MAKE) BUILD_FLAVOR=fastdebug EXPORT_SUBDIR=/fastdebug universalize
aoqi@0 49 all_debug_universal:
aoqi@0 50 # $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_DEBUG_TARGETS)
aoqi@0 51 $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_DEBUG_TARGETS)
aoqi@0 52 $(QUIETLY) $(MAKE) BUILD_FLAVOR=debug EXPORT_SUBDIR=/debug universalize
aoqi@0 53
aoqi@0 54
aoqi@0 55 # Consolidate architecture builds into a single Universal binary
aoqi@0 56 universalize: $(UNIVERSAL_LIPO_LIST) $(UNIVERSAL_COPY_LIST)
aoqi@0 57 $(RM) -r $(EXPORT_PATH)/jre/lib/{i386,amd64}
aoqi@0 58
aoqi@0 59
aoqi@0 60 # Package built libraries in a universal binary
aoqi@0 61 $(UNIVERSAL_LIPO_LIST):
aoqi@0 62 BUILT_LIPO_FILES="`find $(EXPORT_JRE_LIB_DIR)/{i386,amd64}/$(subst $(EXPORT_JRE_LIB_DIR)/,,$@) 2>/dev/null`"; \
aoqi@0 63 if [ -n "$${BUILT_LIPO_FILES}" ]; then \
aoqi@0 64 $(MKDIR) -p $(shell dirname $@); \
aoqi@0 65 lipo -create -output $@ $${BUILT_LIPO_FILES}; \
aoqi@0 66 fi
aoqi@0 67
aoqi@0 68
aoqi@0 69 # Copy built non-universal binaries in place
aoqi@0 70 # - copies directories; including empty dirs
aoqi@0 71 # - copies files, symlinks, other non-directory files
aoqi@0 72 $(UNIVERSAL_COPY_LIST):
aoqi@0 73 BUILT_COPY_FILES="`find $(EXPORT_JRE_LIB_DIR)/{i386,amd64}/$(subst $(EXPORT_JRE_LIB_DIR)/,,$@) -prune 2>/dev/null`"; \
aoqi@0 74 if [ -n "$${BUILT_COPY_FILES}" ]; then \
aoqi@0 75 for i in $${BUILT_COPY_FILES}; do \
aoqi@0 76 $(MKDIR) -p $(shell dirname $@); \
aoqi@0 77 $(CP) -R $${i} $@; \
aoqi@0 78 done; \
aoqi@0 79 fi
aoqi@0 80
aoqi@0 81
aoqi@0 82 # Replace arch specific binaries with universal binaries
aoqi@0 83 # Do not touch jre/lib/{client,server}/libjsig.$(LIBRARY_SUFFIX)
aoqi@0 84 # That symbolic link belongs to the 'jdk' build.
aoqi@0 85 export_universal:
aoqi@0 86 $(RM) -r $(EXPORT_PATH)/jre/lib/{i386,amd64}
aoqi@0 87 $(RM) -r $(JDK_IMAGE_DIR)/jre/lib/{i386,amd64}
aoqi@0 88 ($(CD) $(EXPORT_PATH) && \
aoqi@0 89 $(TAR) -cf - *) | \
aoqi@0 90 ($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xpf -)
aoqi@0 91
aoqi@0 92
aoqi@0 93 # Overlay universal binaries
aoqi@0 94 # Do not touch jre/lib/{client,server}/libjsig.$(LIBRARY_SUFFIX)
aoqi@0 95 # That symbolic link belongs to the 'jdk' build.
aoqi@0 96 copy_universal:
aoqi@0 97 $(RM) -r $(JDK_IMAGE_DIR)$(COPY_SUBDIR)/jre/lib/{i386,amd64}
aoqi@0 98 ($(CD) $(EXPORT_PATH)$(COPY_SUBDIR) && \
aoqi@0 99 $(TAR) -cf - *) | \
aoqi@0 100 ($(CD) $(JDK_IMAGE_DIR)$(COPY_SUBDIR) && $(TAR) -xpf -)
aoqi@0 101
aoqi@0 102
aoqi@0 103 # Additional processing for universal builds
aoqi@0 104 export_product_jdk::
aoqi@0 105 $(MAKE) EXPORT_SUBDIR= export_universal
aoqi@0 106 export_optimized_jdk::
kvn@7138 107 $(MAKE) EXPORT_SUBDIR=/optimized export_universal
aoqi@0 108 export_fastdebug_jdk::
aoqi@0 109 $(MAKE) EXPORT_SUBDIR=/fastdebug export_universal
aoqi@0 110 export_debug_jdk::
aoqi@0 111 $(MAKE) EXPORT_SUBDIR=/debug export_universal
aoqi@0 112 copy_product_jdk::
aoqi@0 113 $(MAKE) COPY_SUBDIR= copy_universal
kvn@7138 114 copy_optimized_jdk::
kvn@7138 115 $(MAKE) COPY_SUBDIR=/optimized copy_universal
aoqi@0 116 copy_fastdebug_jdk::
aoqi@0 117 $(MAKE) COPY_SUBDIR=/fastdebug copy_universal
aoqi@0 118 copy_debug_jdk::
aoqi@0 119 $(MAKE) COPY_SUBDIR=/debug copy_universal
aoqi@0 120
aoqi@0 121 .PHONY: universal_product universal_fastdebug universal_debug \
aoqi@0 122 all_product_universal all_fastdebug_universal all_debug_universal \
kvn@7138 123 universal_optimized all_optimized_universal \
aoqi@0 124 universalize export_universal copy_universal \
aoqi@0 125 $(UNIVERSAL_LIPO_LIST) $(UNIVERSAL_COPY_LIST)

mercurial