1 #
   2 # Copyright (c) 1995, 2010, 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 #
  27 # Common variables used by all the Java makefiles.  This file should
  28 # not contain rules.
  29 #
  30 
  31 # Indicate that we are visiting a separate repo or component 
  32 define MakeStart
  33 $(PRINTF) "\n\n%s\n%s\n##### %-60.60s #####\n%s\n" \
  34 "########################################################################" \
  35 "########################################################################" \
  36 "Entering $1 for target $2" \
  37 "########################################################################"
  38 endef
  39 
  40 define MakeFinish
  41 $(PRINTF) "%s\n##### %-60.60s #####\n%s\n%s\n\n" \
  42 "########################################################################" \
  43 "Leaving $1 for target $2" \
  44 "########################################################################" \
  45 "########################################################################"
  46 endef
  47 
  48 ifdef OPENJDK
  49   ifneq ($(OPENJDK),true)
  50     x:=$(error "OPENJDK (if defined) can only be set to true")
  51   endif
  52 endif
  53 
  54 # Define absolute paths to TOPDIRs
  55 ABS_LANGTOOLS_TOPDIR:=$(call OptFullPath,"$(LANGTOOLS_TOPDIR)")
  56 ABS_CORBA_TOPDIR:=$(call OptFullPath,"$(CORBA_TOPDIR)")
  57 ABS_JAXP_TOPDIR:=$(call OptFullPath,"$(JAXP_TOPDIR)")
  58 ABS_JAXWS_TOPDIR:=$(call OptFullPath,"$(JAXWS_TOPDIR)")
  59 ABS_JDK_TOPDIR:=$(call OptFullPath,"$(JDK_TOPDIR)")
  60 ABS_HOTSPOT_TOPDIR:=$(call OptFullPath,"$(HOTSPOT_TOPDIR)")
  61 ABS_INSTALL_TOPDIR:=$(call OptFullPath,"$(INSTALL_TOPDIR)")
  62 ABS_SPONSORS_TOPDIR:=$(call OptFullPath,"$(SPONSORS_TOPDIR)")
  63 ABS_DEPLOY_TOPDIR:=$(call OptFullPath,"$(DEPLOY_TOPDIR)")
  64 
  65 # Macro to return true or false if a file exists and is readable
  66 define MkExists
  67 $(shell if [ -r $1 ]; then $(ECHO) true; else $(ECHO) false; fi)
  68 endef
  69 
  70 HOTSPOT_SRC_AVAILABLE := $(call MkExists,$(HOTSPOT_TOPDIR)/make/Makefile)
  71 ifndef BUILD_HOTSPOT
  72   ifdef ALT_HOTSPOT_IMPORT_PATH
  73     BUILD_HOTSPOT := false
  74   else
  75     BUILD_HOTSPOT := $(HOTSPOT_SRC_AVAILABLE)
  76   endif
  77 endif
  78 
  79 LANGTOOLS_SRC_AVAILABLE := $(call MkExists,$(LANGTOOLS_TOPDIR)/make/Makefile)
  80 ifndef BUILD_LANGTOOLS
  81   ifdef ALT_LANGTOOLS_DIST
  82     BUILD_LANGTOOLS := false
  83   else
  84     BUILD_LANGTOOLS := $(LANGTOOLS_SRC_AVAILABLE)
  85   endif
  86 endif
  87 
  88 CORBA_SRC_AVAILABLE := $(call MkExists,$(CORBA_TOPDIR)/make/Makefile)
  89 ifndef BUILD_CORBA
  90   ifdef ALT_CORBA_DIST
  91     BUILD_CORBA := false
  92   else
  93     BUILD_CORBA := $(CORBA_SRC_AVAILABLE)
  94   endif
  95 endif
  96 
  97 JAXP_SRC_AVAILABLE := $(call MkExists,$(JAXP_TOPDIR)/make/Makefile)
  98 ifndef BUILD_JAXP
  99   ifdef ALT_JAXP_DIST
 100     BUILD_JAXP := false
 101   else
 102     BUILD_JAXP := $(JAXP_SRC_AVAILABLE)
 103   endif
 104 endif
 105 
 106 JAXWS_SRC_AVAILABLE := $(call MkExists,$(JAXWS_TOPDIR)/make/Makefile)
 107 ifndef BUILD_JAXWS
 108   ifdef ALT_JAXWS_DIST
 109     BUILD_JAXWS := false
 110   else
 111     BUILD_JAXWS := $(JAXWS_SRC_AVAILABLE)
 112   endif
 113 endif
 114 
 115 JDK_SRC_AVAILABLE := $(call MkExists,$(JDK_TOPDIR)/make/Makefile)
 116 ifndef BUILD_JDK
 117   BUILD_JDK := $(JDK_SRC_AVAILABLE)
 118 endif
 119 ifeq ($(JDK_SRC_AVAILABLE),true)
 120   JDK_CLOSED_SRC_AVAILABLE := $(call MkExists,$(JDK_TOPDIR)/src/closed)
 121   ifeq ($(JDK_CLOSED_SRC_AVAILABLE),false)
 122     OPENJDK = true
 123   endif
 124 endif
 125 
 126 DEPLOY_SRC_AVAILABLE := $(call MkExists,$(DEPLOY_TOPDIR)/make/Makefile)
 127 ifndef BUILD_DEPLOY
 128   BUILD_DEPLOY := $(DEPLOY_SRC_AVAILABLE)
 129 endif
 130 
 131 INSTALL_SRC_AVAILABLE := $(call MkExists,$(INSTALL_TOPDIR)/make/Makefile)
 132 ifndef BUILD_INSTALL
 133   ifdef DEV_ONLY
 134     BUILD_INSTALL := false
 135   else
 136     BUILD_INSTALL := $(INSTALL_SRC_AVAILABLE)
 137   endif
 138 endif
 139 
 140 SPONSORS_SRC_AVAILABLE := $(call MkExists,$(SPONSORS_TOPDIR)/make/Makefile)
 141 ifndef BUILD_SPONSORS
 142   ifdef DEV_ONLY
 143     BUILD_SPONSORS := false
 144   else
 145     BUILD_SPONSORS := $(SPONSORS_SRC_AVAILABLE)
 146   endif
 147 endif
 148 
 149 
 150 # Do we build the source bundles?
 151 BUNDLE_RULES = $(JDK_TOPDIR)/make/closed/bundles.gmk
 152 ifeq ($(SKIP_BUNDLES_BUILD), true)
 153   BUNDLE_RULES_AVAILABLE := false
 154 else 
 155   BUNDLE_RULES_AVAILABLE := $(call MkExists,$(BUNDLE_RULES))
 156 endif
 157 
 158 # Current things we do NOT build for OPENJDK
 159 ifdef OPENJDK
 160   BUILD_DEPLOY = false
 161   BUILD_INSTALL = false
 162   BUILD_SPONSORS = false
 163   BUNDLE_RULES_AVAILABLE := false
 164   # These could be over-ridden on the command line or in environment
 165   ifndef SKIP_FASTDEBUG_BUILD
 166     SKIP_FASTDEBUG_BUILD = true
 167   endif
 168   ifndef SKIP_DEBUG_BUILD
 169     SKIP_DEBUG_BUILD = true
 170   endif
 171   ifndef SKIP_COMPARE_IMAGES
 172     SKIP_COMPARE_IMAGES = true
 173   endif
 174 else
 175   
 176   # Various non-OPENJDK reasons to NOT build the deploy repository
 177   ifeq ($(ARCH), ia64)
 178     BUILD_DEPLOY=false
 179   endif
 180   ifeq ($(ARCH), sparcv9)
 181     BUILD_DEPLOY=false
 182   endif
 183   ifeq ($(ARCH), amd64)
 184     ifeq ($(PLATFORM), solaris)
 185       BUILD_DEPLOY=false
 186     endif
 187   endif
 188 
 189 endif
 190 ifndef SKIP_PRODUCT_BUILD
 191   SKIP_PRODUCT_BUILD = false
 192 endif
 193 
 194 # Many reasons why we would want to skip the comparison to previous jdk
 195 ifndef SKIP_COMPARE_IMAGES
 196   ifeq ($(BUILD_JDK), false)
 197     SKIP_COMPARE_IMAGES = true
 198   endif
 199   ifeq ($(BUILD_DEPLOY), false)
 200     SKIP_COMPARE_IMAGES = true
 201   endif
 202   ifeq ($(BUILD_INSTALL), false)
 203     SKIP_COMPARE_IMAGES = true
 204   endif
 205   ifdef DEV_ONLY
 206     SKIP_COMPARE_IMAGES = true
 207   endif
 208 endif
 209 
 210 # Select defaults if these are not set to true or false
 211 ifndef SKIP_DEBUG_BUILD
 212   SKIP_DEBUG_BUILD=true
 213 endif
 214 ifndef SKIP_FASTDEBUG_BUILD
 215   SKIP_FASTDEBUG_BUILD=true
 216 endif
 217 
 218 # Select javadoc setting GENERATE_DOCS
 219 ifndef NO_DOCS
 220   # Default value (we want javadoc run)
 221   GENERATE_DOCS=true
 222   # No DOCS build when JDK_UPDATE_VERSION set on non-OPENJDK builds
 223   ifndef OPENJDK
 224     ifdef JDK_UPDATE_VERSION
 225       GENERATE_DOCS=false
 226     endif
 227   endif
 228   # If langtools, corba, jaxp, and jaxws are not being built, 
 229   #   a full jdk javadoc is not possible
 230   ifneq ($(BUILD_LANGTOOLS), true)
 231     GENERATE_DOCS=false
 232   endif
 233   ifneq ($(BUILD_CORBA), true)
 234     GENERATE_DOCS=false
 235   endif
 236   ifneq ($(BUILD_JAXP), true)
 237     GENERATE_DOCS=false
 238   endif
 239   ifneq ($(BUILD_JAXWS), true)
 240     GENERATE_DOCS=false
 241   endif
 242   ifeq ($(GENERATE_DOCS),false)
 243     NO_DOCS=true
 244   endif
 245 else
 246   GENERATE_DOCS=false
 247 endif
 248 
 249 # Output directory for hotspot build
 250 HOTSPOT_DIR = $(ABS_OUTPUTDIR)/hotspot
 251 
 252 # If we are building components
 253 ifndef ALT_LANGTOOLS_DIST
 254   LANGTOOLS_OUTPUTDIR = $(ABS_OUTPUTDIR)/langtools
 255   ABS_LANGTOOLS_DIST = $(LANGTOOLS_OUTPUTDIR)/dist
 256 endif
 257 ifndef ALT_CORBA_DIST
 258   CORBA_OUTPUTDIR = $(ABS_OUTPUTDIR)/corba
 259   ABS_CORBA_DIST = $(CORBA_OUTPUTDIR)/dist
 260 endif
 261 ifndef ALT_JAXP_DIST
 262   JAXP_OUTPUTDIR = $(ABS_OUTPUTDIR)/jaxp
 263   ABS_JAXP_DIST = $(JAXP_OUTPUTDIR)/dist
 264 endif
 265 ifndef ALT_JAXWS_DIST
 266   JAXWS_OUTPUTDIR = $(ABS_OUTPUTDIR)/jaxws
 267   ABS_JAXWS_DIST = $(JAXWS_OUTPUTDIR)/dist
 268 endif
 269 
 270 # Common make arguments (supplied to all component builds)
 271 COMMON_BUILD_ARGUMENTS = \
 272     JDK_TOPDIR=$(ABS_JDK_TOPDIR) \
 273     JDK_MAKE_SHARED_DIR=$(ABS_JDK_TOPDIR)/make/common/shared \
 274     EXTERNALSANITYCONTROL=true \
 275     SOURCE_LANGUAGE_VERSION=$(SOURCE_LANGUAGE_VERSION) \
 276     TARGET_CLASS_VERSION=$(TARGET_CLASS_VERSION) \
 277     MILESTONE=$(MILESTONE) \
 278     BUILD_NUMBER=$(BUILD_NUMBER) \
 279     JDK_BUILD_NUMBER=$(JDK_BUILD_NUMBER) \
 280     FULL_VERSION=$(FULL_VERSION) \
 281     PREVIOUS_JDK_VERSION=$(PREVIOUS_JDK_VERSION) \
 282     JDK_VERSION=$(JDK_VERSION) \
 283     JDK_MKTG_VERSION=$(JDK_MKTG_VERSION) \
 284     JDK_MAJOR_VERSION=$(JDK_MAJOR_VERSION) \
 285     JDK_MINOR_VERSION=$(JDK_MINOR_VERSION) \
 286     JDK_MICRO_VERSION=$(JDK_MICRO_VERSION) \
 287     PREVIOUS_MAJOR_VERSION=$(PREVIOUS_MAJOR_VERSION) \
 288     PREVIOUS_MINOR_VERSION=$(PREVIOUS_MINOR_VERSION) \
 289     PREVIOUS_MICRO_VERSION=$(PREVIOUS_MICRO_VERSION)
 290 
 291 ifdef ARCH_DATA_MODEL
 292   COMMON_BUILD_ARGUMENTS += ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)
 293 endif
 294 
 295 ifeq ($(DEBUG_NAME), debug)
 296   COMMON_BUILD_ARGUMENTS += VARIANT=DBG DEBUG_CLASSFILES=true
 297 endif
 298 
 299 ifeq ($(DEBUG_NAME), fastdebug)
 300   COMMON_BUILD_ARGUMENTS += VARIANT=DBG FASTDEBUG=true DEBUG_CLASSFILES=true
 301 endif
 302 
 303 ifdef COOKED_JDK_UPDATE_VERSION
 304   COMMON_BUILD_ARGUMENTS += COOKED_JDK_UPDATE_VERSION=$(COOKED_JDK_UPDATE_VERSION)
 305 endif
 306 
 307 ifdef COOKED_BUILD_NUMBER
 308   COMMON_BUILD_ARGUMENTS += COOKED_BUILD_NUMBER=$(COOKED_BUILD_NUMBER)
 309 endif
 310 
 311 ifdef ANT_HOME
 312   COMMON_BUILD_ARGUMENTS += ANT_HOME="$(ANT_HOME)"
 313 endif
 314