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