1 # 2 # Copyright (c) 2012, 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 is included by the root NewerMakefile and contains targets 27 # and utilities needed by JPRT. 28 29 # Utilities used in this Makefile. Most of this makefile executes without 30 # the context of a spec file from configure. 31 CAT=cat 32 CMP=cmp 33 CP=cp 34 ECHO=echo 35 MKDIR=mkdir 36 PRINTF=printf 37 PWD=pwd 38 # Insure we have a path that looks like it came from pwd 39 # (This is mostly for Windows sake and drive letters) 40 define UnixPath # path 41 $(shell (cd "$1" && $(PWD))) 42 endef 43 44 BUILD_DIR_ROOT:=$(root_dir)/build 45 46 ifdef OPENJDK 47 OPEN_BUILD=true 48 else 49 OPEN_BUILD := $(if $(or $(wildcard $(root_dir)/jdk/src/closed), \ 50 $(wildcard $(root_dir)/jdk/make/closed), \ 51 $(wildcard $(root_dir)/jdk/test/closed), \ 52 $(wildcard $(root_dir)/hotspot/src/closed), \ 53 $(wildcard $(root_dir)/hotspot/make/closed), \ 54 $(wildcard $(root_dir)/hotspot/test/closed)), \ 55 false,true) 56 endif 57 58 HOTSPOT_AVAILABLE := $(if $(wildcard $(root_dir)/hotspot),true,false) 59 60 ########################################################################### 61 # To help in adoption of the new configure&&make build process, a bridge 62 # build will use the old settings to run configure and do the build. 63 64 # Build with the configure bridge. After running configure, restart make 65 # to parse the new spec file. 66 BRIDGE_TARGETS := all 67 bridgeBuild: bridge2configure 68 @cd $(root_dir) && $(MAKE) -f NewMakefile.gmk $(BRIDGE_TARGETS) 69 70 # Bridge from old Makefile ALT settings to configure options 71 bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts 72 bash ./configure $(strip $(shell $(CAT) $<)) 73 74 # Create a file with configure options created from old Makefile mechanisms. 75 $(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest 76 $(RM) $@ 77 $(CP) $< $@ 78 79 # Use this file to only change when obvious things have changed 80 $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC 81 $(RM) $@.tmp 82 $(MKDIR) -p $(BUILD_DIR_ROOT) 83 @$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp 84 ifdef ARCH_DATA_MODEL 85 @$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp 86 endif 87 ifeq ($(ARCH_DATA_MODEL),32) 88 @$(ECHO) " --with-jvm-variants=client,server " >> $@.tmp 89 endif 90 ifdef ALT_PARALLEL_COMPILE_JOBS 91 @$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp 92 endif 93 ifdef ALT_BOOTDIR 94 @$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp 95 endif 96 ifdef ALT_CUPS_HEADERS_PATH 97 @$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp 98 endif 99 ifdef ALT_FREETYPE_HEADERS_PATH 100 @$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp 101 endif 102 ifeq ($(HOTSPOT_AVAILABLE),false) 103 ifdef ALT_JDK_IMPORT_PATH 104 @$(ECHO) " --with-import-hotspot=$(call UnixPath,$(ALT_JDK_IMPORT_PATH)) " >> $@.tmp 105 endif 106 endif 107 ifeq ($(OPEN_BUILD),true) 108 @$(ECHO) " --enable-openjdk-only " >> $@.tmp 109 else 110 # Todo: move to closed? 111 ifdef ALT_MOZILLA_HEADERS_PATH 112 @$(ECHO) " --with-mozilla-headers=$(call UnixPath,$(ALT_MOZILLA_HEADERS_PATH)) " >> $@.tmp 113 endif 114 ifdef ALT_JUNIT_DIR 115 @$(ECHO) " --with-junit-dir=$(call UnixPath,$(ALT_JUNIT_DIR)) " >> $@.tmp 116 endif 117 ifdef ANT_HOME 118 @$(ECHO) " --with-ant-home=$(call UnixPath,$(ANT_HOME)) " >> $@.tmp 119 endif 120 ifdef ALT_JAVAFX_ZIP_DIR 121 @$(ECHO) " --with-javafx-zip-dir=$(call UnixPath,$(ALT_JAVAFX_ZIP_DIR)) " >> $@.tmp 122 endif 123 ifdef ALT_WIXDIR 124 @$(ECHO) " --with-wix=$(call UnixPath,$(ALT_WIXDIR)) " >> $@.tmp 125 endif 126 ifdef ALT_CCSS_SIGNING_DIR 127 @$(ECHO) " --with-ccss-signing=$(call UnixPath,$(ALT_CCSS_SIGNING_DIR)) " >> $@.tmp 128 endif 129 ifdef ALT_SLASH_JAVA 130 @$(ECHO) " --with-java-devtools=$(call UnixPath,$(ALT_SLASH_JAVA)/devtools) " >> $@.tmp 131 endif 132 ifdef ALT_SPARKLE_FRAMEWORK_DIR 133 @$(ECHO) " --with-sparkle-framework=$(call UnixPath,$(ALT_SPARKLE_FRAMEWORK_DIR)) " >> $@.tmp 134 endif 135 endif 136 @if [ -f $@ ] ; then \ 137 if ! $(CMP) $@ $@.tmp > /dev/null ; then \ 138 $(CP) $@.tmp $@ ; \ 139 fi ; \ 140 else \ 141 $(CP) $@.tmp $@ ; \ 142 fi 143 $(RM) $@.tmp 144 145 PHONY_LIST += bridge2configure bridgeBuild 146 147 ########################################################################### 148 # JPRT targets 149 150 ifndef JPRT_ARCHIVE_BUNDLE 151 JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip 152 endif 153 ifndef JPRT_ARCHIVE_INSTALL_BUNDLE 154 JPRT_ARCHIVE_INSTALL_BUNDLE=/tmp/jprt_bundles/product-install.zip 155 endif 156 157 # These targets execute in a SPEC free context, before calling bridgeBuild 158 # to generate the SPEC. 159 jprt_build_product: DEBUG_LEVEL=release 160 jprt_build_product: BUILD_DIRNAME=*-release 161 jprt_build_product: jprt_build_generic 162 163 jprt_build_fastdebug: DEBUG_LEVEL=fastdebug 164 jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug 165 jprt_build_fastdebug: jprt_build_generic 166 167 jprt_build_debug: DEBUG_LEVEL=slowdebug 168 jprt_build_debug: BUILD_DIRNAME=*-debug 169 jprt_build_debug: jprt_build_generic 170 171 jprt_build_generic: BRIDGE_TARGETS+=jprt_bundle 172 jprt_build_generic: bridgeBuild 173 174 # This target must be called in the context of a SPEC file 175 jprt_bundle: $(JPRT_ARCHIVE_BUNDLE) 176 @$(call CheckIfMakeAtEnd) 177 178 # This target must be called in the context of a SPEC file 179 $(JPRT_ARCHIVE_BUNDLE): bundles 180 $(MKDIR) -p $(@D) 181 $(RM) $@ 182 $(CP) $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip $@ 183 184 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),solaris-64) 185 SRC_JDK_IMAGE_DIR := $(JDK_OVERLAY_IMAGE_DIR) 186 SRC_JRE_IMAGE_DIR := $(JRE_OVERLAY_IMAGE_DIR) 187 else 188 SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR) 189 SRC_JRE_IMAGE_DIR := $(JRE_IMAGE_DIR) 190 endif 191 SRC_JDK_BUNDLE_DIR := $(JDK_BUNDLE_DIR) 192 SRC_JRE_BUNDLE_DIR := $(JRE_BUNDLE_DIR) 193 194 # Bundle up the images 195 bundles: all bundles-only 196 bundles-only: start-make 197 @$(call TargetEnter) 198 $(MKDIR) -p $(BUILD_OUTPUT)/bundles 199 $(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip . 200 $(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip . 201 if [ -d $(BUILD_OUTPUT)/install/bundles ] ; then \ 202 $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -q -r $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \ 203 fi 204 @$(call TargetExit) 205 206 # Copy images to one unified location regardless of platform etc. 207 final-images: all final-images-only 208 final-images-only: start-make 209 @$(call TargetEnter) 210 $(RM) -r $(BUILD_OUTPUT)/final-images 211 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR) 212 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR) 213 $(CP) -R -P $(SRC_JDK_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)/ 214 $(CP) -R -P $(SRC_JRE_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)/ 215 ifeq ($(OPENJDK_TARGET_OS),macosx) 216 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_BUNDLE_SUBDIR) 217 $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_BUNDLE_SUBDIR) 218 $(CP) -R -P $(SRC_JDK_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_BUNDLE_SUBDIR)/ 219 $(CP) -R -P $(SRC_JRE_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_BUNDLE_SUBDIR)/ 220 endif 221 @$(call TargetExit) 222 223 224 # Keep track of phony targets 225 PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \ 226 jprt_build_generic bundles jprt_bundle \ 227 final-images final-images-only 228 229 ########################################################################### 230 # Phony targets 231 .PHONY: $(PHONY_LIST) 232 233 # Force target 234 FRC: