make/Jprt.gmk

Thu, 31 Aug 2017 15:40:18 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:40:18 +0800
changeset 1133
50aaf272884f
parent 1129
09eaef69f384
parent 0
75a576e87639
child 1288
7801df19942d
permissions
-rw-r--r--

merge

aoqi@0 1 #
aoqi@0 2 # Copyright (c) 2012, 2013, 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. Oracle designates this
aoqi@0 8 # particular file as subject to the "Classpath" exception as provided
aoqi@0 9 # by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 #
aoqi@0 11 # This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 # version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 # accompanied this code).
aoqi@0 16 #
aoqi@0 17 # You should have received a copy of the GNU General Public License version
aoqi@0 18 # 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 #
aoqi@0 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 # or visit www.oracle.com if you need additional information or have any
aoqi@0 23 # questions.
aoqi@0 24 #
aoqi@0 25
aoqi@0 26 # This file is included by the root NewerMakefile and contains targets
aoqi@0 27 # and utilities needed by JPRT.
aoqi@0 28
aoqi@0 29 # Utilities used in this Makefile. Most of this makefile executes without
aoqi@0 30 # the context of a spec file from configure.
aoqi@0 31 CAT=cat
aoqi@0 32 CMP=cmp
aoqi@0 33 CP=cp
aoqi@0 34 ECHO=echo
aoqi@0 35 MKDIR=mkdir
aoqi@0 36 PRINTF=printf
aoqi@0 37 PWD=pwd
aoqi@0 38 # Insure we have a path that looks like it came from pwd
aoqi@0 39 # (This is mostly for Windows sake and drive letters)
aoqi@0 40 define UnixPath # path
aoqi@0 41 $(shell (cd "$1" && $(PWD)))
aoqi@0 42 endef
aoqi@0 43
aoqi@0 44 BUILD_DIR_ROOT:=$(root_dir)/build
aoqi@0 45
aoqi@0 46 ifdef OPENJDK
aoqi@0 47 OPEN_BUILD=true
aoqi@0 48 else
aoqi@0 49 OPEN_BUILD := $(if $(or $(wildcard $(root_dir)/jdk/src/closed), \
aoqi@0 50 $(wildcard $(root_dir)/jdk/make/closed), \
aoqi@0 51 $(wildcard $(root_dir)/jdk/test/closed), \
aoqi@0 52 $(wildcard $(root_dir)/hotspot/src/closed), \
aoqi@0 53 $(wildcard $(root_dir)/hotspot/make/closed), \
aoqi@0 54 $(wildcard $(root_dir)/hotspot/test/closed)), \
aoqi@0 55 false,true)
aoqi@0 56 endif
aoqi@0 57
aoqi@0 58 HOTSPOT_AVAILABLE := $(if $(wildcard $(root_dir)/hotspot),true,false)
aoqi@0 59
aoqi@0 60 ###########################################################################
aoqi@0 61 # To help in adoption of the new configure&&make build process, a bridge
aoqi@0 62 # build will use the old settings to run configure and do the build.
aoqi@0 63
aoqi@0 64 # Build with the configure bridge. After running configure, restart make
aoqi@0 65 # to parse the new spec file.
aoqi@0 66 BRIDGE_TARGETS := all
aoqi@0 67 # Add bootcycle-images target if legacy variable is set.
aoqi@0 68 ifeq ($(SKIP_BOOT_CYCLE),false)
aoqi@0 69 BRIDGE_TARGETS += bootcycle-images
aoqi@0 70 endif
aoqi@0 71 bridgeBuild: bridge2configure
aoqi@0 72 @cd $(root_dir) && $(MAKE) -f Makefile $(BRIDGE_TARGETS)
aoqi@0 73
aoqi@0 74 # Bridge from old Makefile ALT settings to configure options
aoqi@0 75 bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
aoqi@0 76 bash ./configure $(strip $(shell $(CAT) $<))
aoqi@0 77
aoqi@0 78 # Create a file with configure options created from old Makefile mechanisms.
aoqi@0 79 $(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest
aoqi@0 80 $(RM) $@
aoqi@0 81 $(CP) $< $@
aoqi@0 82
aoqi@0 83 # Use this file to only change when obvious things have changed
aoqi@0 84 $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC
aoqi@0 85 $(RM) $@.tmp
aoqi@0 86 $(MKDIR) -p $(BUILD_DIR_ROOT)
aoqi@0 87 @$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
aoqi@0 88 ifdef ARCH_DATA_MODEL
aoqi@0 89 @$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
aoqi@0 90 endif
aoqi@0 91 ifeq ($(ARCH_DATA_MODEL),32)
aoqi@0 92 @$(ECHO) " --with-jvm-variants=client,server " >> $@.tmp
aoqi@0 93 endif
aoqi@0 94 ifdef ALT_PARALLEL_COMPILE_JOBS
aoqi@0 95 @$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp
aoqi@0 96 endif
aoqi@0 97 ifdef ALT_BOOTDIR
aoqi@0 98 @$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp
aoqi@0 99 endif
aoqi@0 100 ifdef ALT_CUPS_HEADERS_PATH
aoqi@0 101 @$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp
aoqi@0 102 endif
aoqi@0 103 ifdef ALT_FREETYPE_HEADERS_PATH
aoqi@0 104 @$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp
aoqi@0 105 endif
aoqi@0 106 ifdef ENABLE_SJAVAC
aoqi@0 107 @$(ECHO) " --enable-sjavac" >> $@.tmp
aoqi@0 108 endif
aoqi@0 109 ifdef JDK_UPDATE_VERSION
aoqi@0 110 @$(ECHO) " --with-update-version=$(JDK_UPDATE_VERSION)" >> $@.tmp
aoqi@0 111 endif
aoqi@0 112 ifeq ($(HOTSPOT_AVAILABLE),false)
aoqi@0 113 ifdef ALT_JDK_IMPORT_PATH
aoqi@0 114 @$(ECHO) " --with-import-hotspot=$(call UnixPath,$(ALT_JDK_IMPORT_PATH)) " >> $@.tmp
aoqi@0 115 endif
aoqi@0 116 endif
aoqi@0 117 ifeq ($(OPEN_BUILD),true)
aoqi@0 118 @$(ECHO) " --enable-openjdk-only " >> $@.tmp
aoqi@0 119 else
aoqi@0 120 # Todo: move to closed?
aoqi@0 121 ifdef ALT_MOZILLA_HEADERS_PATH
aoqi@0 122 @$(ECHO) " --with-mozilla-headers=$(call UnixPath,$(ALT_MOZILLA_HEADERS_PATH)) " >> $@.tmp
aoqi@0 123 endif
aoqi@0 124 ifdef ALT_JUNIT_DIR
aoqi@0 125 @$(ECHO) " --with-junit-dir=$(call UnixPath,$(ALT_JUNIT_DIR)) " >> $@.tmp
aoqi@0 126 endif
aoqi@0 127 ifdef ANT_HOME
aoqi@0 128 @$(ECHO) " --with-ant-home=$(call UnixPath,$(ANT_HOME)) " >> $@.tmp
aoqi@0 129 endif
aoqi@0 130 ifdef ALT_JAVAFX_ZIP_DIR
aoqi@0 131 @$(ECHO) " --with-javafx-zip-dir=$(call UnixPath,$(ALT_JAVAFX_ZIP_DIR)) " >> $@.tmp
aoqi@0 132 endif
aoqi@0 133 ifdef ALT_JMC_ZIP_DIR
aoqi@0 134 @$(ECHO) " --with-jmc-zip-dir=$(call UnixPath,$(ALT_JMC_ZIP_DIR)) " >> $@.tmp
aoqi@0 135 endif
aoqi@0 136 ifdef ALT_WIXDIR
aoqi@0 137 @$(ECHO) " --with-wix=$(call UnixPath,$(ALT_WIXDIR)) " >> $@.tmp
aoqi@0 138 endif
aoqi@0 139 ifdef ALT_INSTALL_LZMA_PATH
aoqi@0 140 @$(ECHO) " --with-lzma-path=$(call UnixPath,$(ALT_INSTALL_LZMA_PATH)) " >> $@.tmp
aoqi@0 141 endif
aoqi@0 142 ifdef ALT_INSTALL_UPX_PATH
aoqi@0 143 @$(ECHO) " --with-upx-path=$(call UnixPath,$(ALT_INSTALL_UPX_PATH)) " >> $@.tmp
aoqi@0 144 endif
aoqi@0 145 ifdef ALT_INSTALL_UPX_FILENAME
aoqi@0 146 @$(ECHO) " --with-upx-filename=$(call UnixPath,$(ALT_INSTALL_UPX_FILENAME)) " >> $@.tmp
aoqi@0 147 endif
aoqi@0 148 ifdef ALT_BSDIFF_DIR
aoqi@0 149 @$(ECHO) " --with-bsdiff-dir=$(call UnixPath,$(ALT_BSDIFF_DIR)) " >> $@.tmp
aoqi@0 150 endif
aoqi@0 151 ifdef ALT_CCSS_SIGNING_DIR
aoqi@0 152 @$(ECHO) " --with-ccss-signing=$(call UnixPath,$(ALT_CCSS_SIGNING_DIR)) " >> $@.tmp
aoqi@0 153 endif
aoqi@0 154 ifdef ALT_SLASH_JAVA
aoqi@0 155 @$(ECHO) " --with-java-devtools=$(call UnixPath,$(ALT_SLASH_JAVA)/devtools) " >> $@.tmp
aoqi@0 156 endif
aoqi@0 157 ifdef ALT_SPARKLE_FRAMEWORK_DIR
aoqi@0 158 @$(ECHO) " --with-sparkle-framework=$(call UnixPath,$(ALT_SPARKLE_FRAMEWORK_DIR)) " >> $@.tmp
aoqi@0 159 endif
aoqi@0 160 endif
aoqi@0 161 @if [ -f $@ ] ; then \
aoqi@0 162 if ! $(CMP) $@ $@.tmp > /dev/null ; then \
aoqi@0 163 $(CP) $@.tmp $@ ; \
aoqi@0 164 fi ; \
aoqi@0 165 else \
aoqi@0 166 $(CP) $@.tmp $@ ; \
aoqi@0 167 fi
aoqi@0 168 $(RM) $@.tmp
aoqi@0 169
aoqi@0 170 PHONY_LIST += bridge2configure bridgeBuild
aoqi@0 171
aoqi@0 172 ###########################################################################
aoqi@0 173 # JPRT targets
aoqi@0 174
aoqi@0 175 ifndef JPRT_ARCHIVE_BUNDLE
aoqi@0 176 JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
aoqi@0 177 endif
aoqi@0 178 ifndef JPRT_ARCHIVE_INSTALL_BUNDLE
aoqi@0 179 JPRT_ARCHIVE_INSTALL_BUNDLE=/tmp/jprt_bundles/product-install.zip
aoqi@0 180 endif
aoqi@0 181
aoqi@0 182 # These targets execute in a SPEC free context, before calling bridgeBuild
aoqi@0 183 # to generate the SPEC.
aoqi@0 184 jprt_build_product: DEBUG_LEVEL=release
aoqi@0 185 jprt_build_product: BUILD_DIRNAME=*-release
aoqi@0 186 jprt_build_product: jprt_build_generic
aoqi@0 187
aoqi@0 188 jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
aoqi@0 189 jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
aoqi@0 190 jprt_build_fastdebug: jprt_build_generic
aoqi@0 191
aoqi@0 192 jprt_build_debug: DEBUG_LEVEL=slowdebug
aoqi@0 193 jprt_build_debug: BUILD_DIRNAME=*-debug
aoqi@0 194 jprt_build_debug: jprt_build_generic
aoqi@0 195
aoqi@0 196 jprt_build_generic: BRIDGE_TARGETS+=jprt_bundle
aoqi@0 197 jprt_build_generic: bridgeBuild
aoqi@0 198
aoqi@0 199 # This target must be called in the context of a SPEC file
aoqi@0 200 jprt_bundle: $(JPRT_ARCHIVE_BUNDLE)
aoqi@0 201 @$(call CheckIfMakeAtEnd)
aoqi@0 202
aoqi@0 203 # This target must be called in the context of a SPEC file
aoqi@0 204 $(JPRT_ARCHIVE_BUNDLE): bundles
aoqi@0 205 $(MKDIR) -p $(@D)
aoqi@0 206 $(RM) $@
aoqi@0 207 $(CP) $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip $@
aoqi@0 208
aoqi@0 209 SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR)
aoqi@0 210 SRC_JRE_IMAGE_DIR := $(JRE_IMAGE_DIR)
aoqi@0 211 SRC_JDK_BUNDLE_DIR := $(JDK_BUNDLE_DIR)
aoqi@0 212 SRC_JRE_BUNDLE_DIR := $(JRE_BUNDLE_DIR)
aoqi@0 213
aoqi@0 214 # Bundle up the images
aoqi@0 215 bundles: all bundles-only
aoqi@0 216 bundles-only: start-make
aoqi@0 217 @$(call TargetEnter)
aoqi@0 218 $(MKDIR) -p $(BUILD_OUTPUT)/bundles
aoqi@0 219 $(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip .
aoqi@0 220 $(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip .
aoqi@0 221 if [ -d $(BUILD_OUTPUT)/install/bundles ] ; then \
aoqi@0 222 $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -y -q -r $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \
aoqi@0 223 fi
aoqi@0 224 @$(call TargetExit)
aoqi@0 225
aoqi@0 226 # Copy images to one unified location regardless of platform etc.
aoqi@0 227 final-images: all final-images-only
aoqi@0 228 final-images-only: start-make
aoqi@0 229 @$(call TargetEnter)
aoqi@0 230 $(RM) -r $(BUILD_OUTPUT)/final-images
aoqi@0 231 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)
aoqi@0 232 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)
aoqi@0 233 $(CP) -R -P $(SRC_JDK_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)/
aoqi@0 234 $(CP) -R -P $(SRC_JRE_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)/
aoqi@0 235 ifeq ($(OPENJDK_TARGET_OS),macosx)
aoqi@0 236 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_BUNDLE_SUBDIR)
aoqi@0 237 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_BUNDLE_SUBDIR)
aoqi@0 238 $(CP) -R -P $(SRC_JDK_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_BUNDLE_SUBDIR)/
aoqi@0 239 $(CP) -R -P $(SRC_JRE_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_BUNDLE_SUBDIR)/
aoqi@0 240 endif
aoqi@0 241 @$(call TargetExit)
aoqi@0 242
aoqi@0 243
aoqi@0 244 # Keep track of phony targets
aoqi@0 245 PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
aoqi@0 246 jprt_build_generic bundles jprt_bundle \
aoqi@0 247 final-images final-images-only
aoqi@0 248
aoqi@0 249 ###########################################################################
aoqi@0 250 # Phony targets
aoqi@0 251 .PHONY: $(PHONY_LIST)
aoqi@0 252
aoqi@0 253 # Force target
aoqi@0 254 FRC:

mercurial