1 # 2 # Copyright (c) 2012, 2015, 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. Oracle designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Oracle in the LICENSE file that accompanied this code. 10 # 11 # This code is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 # version 2 for more details (a copy is included in the LICENSE file that 15 # accompanied this code). 16 # 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 # This file contains targets and utilities needed by JPRT. 27 28 # Cygpath is only defined when running on Cygwin 29 ifneq ($(CYGPATH), ) 30 # If we get JPRT_ARCHIVE_*BUNDLE externally, make sure they have /cygdrive 31 # style paths 32 ifdef JPRT_ARCHIVE_BUNDLE 33 override JPRT_ARCHIVE_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_BUNDLE)) 34 endif 35 ifdef JPRT_ARCHIVE_INSTALL_BUNDLE 36 override JPRT_ARCHIVE_INSTALL_BUNDLE := \ 37 $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_INSTALL_BUNDLE)) 38 endif 39 ifdef JPRT_ARCHIVE_MODULES_BUNDLE 40 override JPRT_ARCHIVE_MODULES_BUNDLE := \ 41 $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_MODULES_BUNDLE)) 42 endif 43 ifdef JPRT_ARCHIVE_TEST_BUNDLE 44 override JPRT_ARCHIVE_TEST_BUNDLE := \ 45 $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_TEST_BUNDLE)) 46 endif 47 ifdef JPRT_ARCHIVE_SYMBOLS_BUNDLE 48 override JPRT_ARCHIVE_SYMBOLS_BUNDLE := \ 49 $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_SYMBOLS_BUNDLE)) 50 endif 51 endif 52 53 # When running in JPRT these will be provided. Need defaults so that this makefile 54 # is valid anyway. 55 ifndef JPRT_ARCHIVE_BUNDLE 56 JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/jdk-image.zip 57 endif 58 ifndef JPRT_ARCHIVE_INSTALL_BUNDLE 59 JPRT_ARCHIVE_INSTALL_BUNDLE=/tmp/jprt_bundles/product-install.zip 60 endif 61 ifndef JPRT_ARCHIVE_MODULES_BUNDLE 62 JPRT_ARCHIVE_MODULES_BUNDLE=/tmp/jprt_bundles/modules.zip 63 endif 64 ifndef JPRT_ARCHIVE_TEST_BUNDLE 65 JPRT_ARCHIVE_TEST_BUNDLE=/tmp/jprt_bundles/test-image.zip 66 endif 67 ifndef JPRT_ARCHIVE_SYMBOLS_BUNDLE 68 JPRT_ARCHIVE_SYMBOLS_BUNDLE=/tmp/jprt_bundles/symbols-image.zip 69 endif 70 71 ifeq ($(SKIP_BOOT_CYCLE), false) 72 jprt_bundle: bootcycle-images 73 endif 74 75 # This target must be called in the context of a SPEC file 76 jprt_bundle: $(JPRT_ARCHIVE_BUNDLE) $(JPRT_ARCHIVE_TEST_BUNDLE) \ 77 $(JPRT_ARCHIVE_MODULES_BUNDLE) 78 79 ifeq ($(GCOV_ENABLED), true) 80 jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE) 81 endif 82 83 # This target must be called in the context of a SPEC file 84 $(JPRT_ARCHIVE_BUNDLE): bundles 85 $(MKDIR) -p $(@D) 86 $(RM) $@ 87 $(CP) $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip $@ 88 89 $(JPRT_ARCHIVE_MODULES_BUNDLE): bundles 90 $(MKDIR) -p $(@D) 91 $(RM) $@ 92 $(CP) $(BUILD_OUTPUT)/bundles/modules.zip $@ 93 94 $(JPRT_ARCHIVE_TEST_BUNDLE): bundles 95 $(MKDIR) -p $(@D) 96 $(RM) $@ 97 $(CP) $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip $@ 98 99 $(JPRT_ARCHIVE_SYMBOLS_BUNDLE): bundles 100 $(MKDIR) -p $(@D) 101 $(RM) $@ 102 $(CP) $(BUILD_OUTPUT)/bundles/$(SYMBOLS_IMAGE_SUBDIR).zip $@ 103 104 SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR) 105 SRC_JRE_IMAGE_DIR := $(JRE_IMAGE_DIR) 106 SRC_TEST_IMAGE_DIR := $(TEST_IMAGE_DIR) 107 SRC_JDK_MACOSX_BUNDLE_DIR := $(JDK_MACOSX_BUNDLE_DIR) 108 SRC_JRE_MACOSX_BUNDLE_DIR := $(JRE_MACOSX_BUNDLE_DIR) 109 110 # Bundle up the images 111 JPRT_TARGET ?= all 112 ifeq ($(JPRT_TARGET), all) 113 bundles: $(JPRT_TARGET) 114 @$(call TargetEnter) 115 $(MKDIR) -p $(BUILD_OUTPUT)/bundles 116 $(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r \ 117 $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip . 118 $(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -y -q -r \ 119 $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip . 120 $(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r \ 121 $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip . 122 $(CD) $(IMAGES_OUTPUTDIR)/jmods && $(ZIP) -y -q -r \ 123 $(BUILD_OUTPUT)/bundles/modules.zip . 124 if [ -d $(BUILD_OUTPUT)/install/bundles ] ; then \ 125 $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -y -q -r \ 126 $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \ 127 fi 128 if [ -d $(SYMBOLS_IMAGE_DIR) ] ; then \ 129 $(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIP) -y -q -r \ 130 $(BUILD_OUTPUT)/bundles/$(SYMBOLS_IMAGE_SUBDIR).zip . ; \ 131 fi 132 @$(call TargetExit) 133 else 134 # Just fake the bundles 135 bundles: $(JPRT_TARGET) 136 @$(call TargetEnter) 137 $(MKDIR) -p $(BUILD_OUTPUT)/bundles 138 $(CD) $(TOPDIR) && $(ZIP) -y -q -r \ 139 $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip README 140 $(CD) $(TOPDIR) && $(ZIP) -y -q -r \ 141 $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip README 142 $(CD) $(TOPDIR) && $(ZIP) -y -q -r \ 143 $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip README 144 $(CD) $(TOPDIR) && $(ZIP) -y -q -r \ 145 $(BUILD_OUTPUT)/bundles/modules.zip README 146 @$(call TargetExit) 147 endif 148 149 # Copy images to one unified location regardless of platform etc. 150 final-images: $(JPRT_TARGET) 151 @$(call TargetEnter) 152 $(RM) -r $(BUILD_OUTPUT)/final-images 153 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR) 154 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR) 155 $(CP) -R -P $(SRC_JDK_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)/ 156 $(CP) -R -P $(SRC_JRE_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)/ 157 ifeq ($(OPENJDK_TARGET_OS),macosx) 158 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_MACOSX_BUNDLE_SUBDIR) 159 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_MACOSX_BUNDLE_SUBDIR) 160 $(CP) -R -P $(SRC_JDK_MACOSX_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_MACOSX_BUNDLE_SUBDIR)/ 161 $(CP) -R -P $(SRC_JRE_MACOSX_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_MACOSX_BUNDLE_SUBDIR)/ 162 endif 163 @$(call TargetExit) 164 165 ALL_TARGETS += jprt_bundle bundles final-images