1 #
   2 # Copyright (c) 1999, 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.
   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 # This makefile creates a build tree and lights off a build.
  26 # You can go back into the build tree and perform rebuilds or
  27 # incremental builds as desired. Be sure to reestablish
  28 # environment variable settings for LD_LIBRARY_PATH and JAVA_HOME.
  29 
  30 # The make process now relies on java and javac. These can be
  31 # specified either implicitly on the PATH, by setting the
  32 # (JDK-inherited) ALT_BOOTDIR environment variable to full path to a
  33 # JDK in which bin/java and bin/javac are present and working (e.g.,
  34 # /usr/local/java/jdk1.3/solaris), or via the (JDK-inherited)
  35 # default BOOTDIR path value. Note that one of ALT_BOOTDIR
  36 # or BOOTDIR has to be set. We do *not* search javac, javah, rmic etc.
  37 # from the PATH.
  38 #
  39 # One can set ALT_BOOTDIR or BOOTDIR to point to a jdk that runs on
  40 # an architecture that differs from the target architecture, as long
  41 # as the bootstrap jdk runs under the same flavor of OS as the target
  42 # (i.e., if the target is linux, point to a jdk that runs on a linux
  43 # box).  In order to use such a bootstrap jdk, set the make variable
  44 # REMOTE to the desired remote command mechanism, e.g.,
  45 #
  46 #    make REMOTE="rsh -l me myotherlinuxbox"
  47 
  48 ifeq ($(GAMMADIR),)
  49 include ../../make/defs.make
  50 else
  51 include $(GAMMADIR)/make/defs.make
  52 endif
  53 include $(GAMMADIR)/make/$(OSNAME)/makefiles/rules.make
  54 
  55 ifndef CC_INTERP
  56   ifndef FORCE_TIERED
  57     FORCE_TIERED=1
  58   endif
  59 endif
  60 
  61 ifdef LP64
  62   ifeq ("$(filter $(LP64_ARCH),$(BUILDARCH))","")
  63     _JUNK_ := $(shell echo >&2 \
  64        $(OSNAME) $(ARCH) "*** ERROR: this platform does not support 64-bit compilers!")
  65         @exit 1
  66   endif
  67 endif
  68 
  69 # we need to set up LP64 correctly to satisfy sanity checks in adlc
  70 ifneq ("$(filter $(LP64_ARCH),$(BUILDARCH))","")
  71   MFLAGS += " LP64=1 "
  72 endif
  73 
  74 # pass USE_SUNCC further, through MFLAGS
  75 ifdef USE_SUNCC
  76   MFLAGS += " USE_SUNCC=1 "
  77 endif
  78 
  79 # The following renders pathnames in generated Makefiles valid on
  80 # machines other than the machine containing the build tree.
  81 #
  82 # For example, let's say my build tree lives on /files12 on
  83 # exact.east.sun.com.  This logic will cause GAMMADIR to begin with
  84 # /net/exact/files12/...
  85 #
  86 # We only do this on SunOS variants, for a couple of reasons:
  87 #  * It is extremely rare that source trees exist on other systems
  88 #  * It has been claimed that the Linux automounter is flakey, so
  89 #    changing GAMMADIR in a way that exercises the automounter could
  90 #    prove to be a source of unreliability in the build process.
  91 # Obviously, this Makefile is only relevant on SunOS boxes to begin
  92 # with, but the SunOS conditionalization will make it easier to
  93 # combine Makefiles in the future (assuming we ever do that).
  94 
  95 ifeq ($(OSNAME),solaris)
  96 
  97   #   prepend current directory to relative pathnames.
  98   NEW_GAMMADIR :=                                    \
  99     $(shell echo $(GAMMADIR) |                       \
 100       sed -e "s=^\([^/].*\)=$(shell pwd)/\1="        \
 101      )
 102   unexport NEW_GAMMADIR
 103 
 104   # If NEW_GAMMADIR doesn't already start with "/net/":
 105   ifeq ($(strip $(filter /net/%,$(NEW_GAMMADIR))),)
 106     #   prepend /net/$(HOST)
 107     #   remove /net/$(HOST) if name already began with /home/
 108     #   remove /net/$(HOST) if name already began with /java/
 109     #   remove /net/$(HOST) if name already began with /lab/
 110     NEW_GAMMADIR :=                                     \
 111          $(shell echo $(NEW_GAMMADIR) |                 \
 112                  sed -e "s=^\(.*\)=/net/$(HOST)\1="     \
 113                      -e "s=^/net/$(HOST)/home/=/home/=" \
 114                      -e "s=^/net/$(HOST)/java/=/java/=" \
 115                      -e "s=^/net/$(HOST)/lab/=/lab/="   \
 116           )
 117     # Don't use the new value for GAMMADIR unless a file with the new
 118     # name actually exists.
 119     ifneq ($(wildcard $(NEW_GAMMADIR)),)
 120       GAMMADIR := $(NEW_GAMMADIR)
 121     endif
 122   endif
 123 
 124 endif
 125 
 126 # BUILDARCH is set to "zero" for Zero builds.  VARIANTARCH
 127 # is used to give the build directories meaningful names.
 128 VARIANTARCH = $(subst i386,i486,$(ZERO_LIBARCH))
 129 
 130 # There is a (semi-) regular correspondence between make targets and actions:
 131 #
 132 #       Target          Tree Type       Build Dir
 133 #
 134 #       debug           compiler2       <os>_<arch>_compiler2/debug
 135 #       fastdebug       compiler2       <os>_<arch>_compiler2/fastdebug
 136 #       optimized       compiler2       <os>_<arch>_compiler2/optimized
 137 #       product         compiler2       <os>_<arch>_compiler2/product
 138 #
 139 #       debug1          compiler1       <os>_<arch>_compiler1/debug
 140 #       fastdebug1      compiler1       <os>_<arch>_compiler1/fastdebug
 141 #       optimized1      compiler1       <os>_<arch>_compiler1/optimized
 142 #       product1        compiler1       <os>_<arch>_compiler1/product
 143 #
 144 #       debugcore       core            <os>_<arch>_core/debug
 145 #       fastdebugcore   core            <os>_<arch>_core/fastdebug
 146 #       optimizedcore   core            <os>_<arch>_core/optimized
 147 #       productcore     core            <os>_<arch>_core/product
 148 #
 149 #       debugzero       zero            <os>_<arch>_zero/debug
 150 #       fastdebugzero   zero            <os>_<arch>_zero/fastdebug
 151 #       optimizedzero   zero            <os>_<arch>_zero/optimized
 152 #       productzero     zero            <os>_<arch>_zero/product
 153 #
 154 #       debugshark      shark           <os>_<arch>_shark/debug
 155 #       fastdebugshark  shark           <os>_<arch>_shark/fastdebug
 156 #       optimizedshark  shark           <os>_<arch>_shark/optimized
 157 #       productshark    shark           <os>_<arch>_shark/product
 158 #
 159 #       fastdebugminimal1 minimal1      <os>_<arch>_minimal1/fastdebug
 160 #       productminimal1   minimal1      <os>_<arch>_minimal1/product
 161 #
 162 # What you get with each target:
 163 #
 164 # debug*     - debug compile with asserts enabled
 165 # fastdebug* - optimized compile, but with asserts enabled
 166 # optimized* - optimized compile, no asserts
 167 # product*   - the shippable thing:  optimized compile, no asserts, -DPRODUCT
 168 
 169 # This target list needs to be coordinated with the usage message
 170 # in the build.sh script:
 171 TARGETS           = debug fastdebug optimized product
 172 
 173 ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
 174   SUBDIR_DOCS     = $(OSNAME)_$(VARIANTARCH)_docs
 175 else
 176   SUBDIR_DOCS     = $(OSNAME)_$(BUILDARCH)_docs
 177 endif
 178 SUBDIRS_C1        = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler1/,$(TARGETS))
 179 SUBDIRS_C2        = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS))
 180 SUBDIRS_TIERED    = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS))
 181 SUBDIRS_CORE      = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS))
 182 SUBDIRS_ZERO      = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS))
 183 SUBDIRS_SHARK     = $(addprefix $(OSNAME)_$(VARIANTARCH)_shark/,$(TARGETS))
 184 SUBDIRS_MINIMAL1  = $(addprefix $(OSNAME)_$(BUILDARCH)_minimal1/,$(TARGETS))
 185 
 186 TARGETS_C2        = $(TARGETS)
 187 TARGETS_C1        = $(addsuffix 1,$(TARGETS))
 188 TARGETS_TIERED    = $(addsuffix tiered,$(TARGETS))
 189 TARGETS_CORE      = $(addsuffix core,$(TARGETS))
 190 TARGETS_ZERO      = $(addsuffix zero,$(TARGETS))
 191 TARGETS_SHARK     = $(addsuffix shark,$(TARGETS))
 192 TARGETS_MINIMAL1 =  $(addsuffix minimal1,$(TARGETS))
 193 
 194 BUILDTREE_MAKE    = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
 195 BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
 196 BUILDTREE_VARS   += HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) VERSION_STRING=$(VERSION_STRING)
 197 BUILDTREE_VARS   += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) OBJCOPY=$(OBJCOPY) STRIP_POLICY=$(STRIP_POLICY) ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) ZIPEXE=$(ZIPEXE)
 198 
 199 BUILDTREE         = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS)
 200 
 201 #-------------------------------------------------------------------------------
 202 
 203 # Could make everything by default, but that would take a while.
 204 all:
 205         @echo "Try '$(MAKE) <target> ...'  where <target> is one or more of"
 206         @echo "  $(TARGETS_C2)"
 207         @echo "  $(TARGETS_C1)"
 208         @echo "  $(TARGETS_CORE)"
 209         @echo "  $(TARGETS_ZERO)"
 210         @echo "  $(TARGETS_SHARK)"
 211         @echo "  $(TARGETS_MINIMAL1)"
 212 
 213 checks: check_os_version check_j2se_version
 214 
 215 # We do not want people accidentally building on old systems (e.g. Linux 2.2.x,
 216 # Solaris 2.5.1, 2.6).
 217 # Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok.
 218 
 219 SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3% 4%
 220 OS_VERSION := $(shell uname -r)
 221 EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION))
 222 
 223 check_os_version:
 224 ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),)
 225         $(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1;
 226 endif
 227 
 228 # jvmti.make requires XSLT (J2SE 1.4.x or newer):
 229 XSLT_CHECK      = $(REMOTE) $(RUN.JAVAP) javax.xml.transform.TransformerFactory
 230 # If not found then fail fast.
 231 check_j2se_version:
 232         $(QUIETLY) if ! $(XSLT_CHECK) > /dev/null 2>&1; then \
 233           $(REMOTE) $(RUN.JAVA) -version; \
 234           echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \
 235           "to bootstrap this build" 1>&2; \
 236           exit 1; \
 237         fi
 238 
 239 $(SUBDIRS_TIERED): $(BUILDTREE_MAKE)
 240         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 241         +$(BUILDTREE) VARIANT=tiered
 242 
 243 $(SUBDIRS_C2): $(BUILDTREE_MAKE)
 244 ifeq ($(FORCE_TIERED),1)
 245         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 246         +$(BUILDTREE) VARIANT=tiered FORCE_TIERED=1
 247 else
 248         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 249         +$(BUILDTREE) VARIANT=compiler2
 250 endif
 251 
 252 $(SUBDIRS_C1): $(BUILDTREE_MAKE)
 253         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 254         +$(BUILDTREE) VARIANT=compiler1
 255 
 256 $(SUBDIRS_CORE): $(BUILDTREE_MAKE)
 257         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 258         +$(BUILDTREE) VARIANT=core
 259 
 260 $(SUBDIRS_ZERO): $(BUILDTREE_MAKE) platform_zero
 261         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 262         +$(BUILDTREE) VARIANT=zero VARIANTARCH=$(VARIANTARCH)
 263 
 264 $(SUBDIRS_SHARK): $(BUILDTREE_MAKE) platform_zero
 265         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 266         +$(BUILDTREE) VARIANT=shark VARIANTARCH=$(VARIANTARCH)
 267 
 268 $(SUBDIRS_MINIMAL1): $(BUILDTREE_MAKE)
 269         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 270         +$(BUILDTREE) VARIANT=minimal1
 271 
 272 
 273 platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in
 274         $(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@
 275 
 276 # Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME
 277 
 278 $(TARGETS_C2):  $(SUBDIRS_C2)
 279         cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS)
 280 ifdef INSTALL
 281         cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install
 282 endif
 283 
 284 $(TARGETS_TIERED):  $(SUBDIRS_TIERED)
 285         cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS)
 286 ifdef INSTALL
 287         cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install
 288 endif
 289 
 290 $(TARGETS_C1):  $(SUBDIRS_C1)
 291         cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS)
 292 ifdef INSTALL
 293         cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install
 294 endif
 295 
 296 $(TARGETS_CORE):  $(SUBDIRS_CORE)
 297         cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS)
 298 ifdef INSTALL
 299         cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install
 300 endif
 301 
 302 $(TARGETS_ZERO):  $(SUBDIRS_ZERO)
 303         cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS)
 304 ifdef INSTALL
 305         cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install
 306 endif
 307 
 308 $(TARGETS_SHARK):  $(SUBDIRS_SHARK)
 309         cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS)
 310 ifdef INSTALL
 311         cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install
 312 endif
 313 
 314 $(TARGETS_MINIMAL1):  $(SUBDIRS_MINIMAL1)
 315         cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS)
 316 ifdef INSTALL
 317         cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) install
 318 endif
 319 
 320 # Just build the tree, and nothing else:
 321 tree:      $(SUBDIRS_C2)
 322 tree1:     $(SUBDIRS_C1)
 323 treecore:  $(SUBDIRS_CORE)
 324 treezero:  $(SUBDIRS_ZERO)
 325 treeshark: $(SUBDIRS_SHARK)
 326 treeminimal1: $(SUBDIRS_MINIMAL1)
 327 
 328 # Doc target.  This is the same for all build options.
 329 #     Hence create a docs directory beside ...$(ARCH)_[...]
 330 # We specify 'BUILD_FLAVOR=product' so that the proper
 331 # ENABLE_FULL_DEBUG_SYMBOLS value is used.
 332 docs: checks
 333         $(QUIETLY) mkdir -p $(SUBDIR_DOCS)
 334         $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) BUILD_FLAVOR=product jvmtidocs
 335 
 336 # Synonyms for win32-like targets.
 337 compiler2:  debug product
 338 
 339 compiler1:  debug1 product1
 340 
 341 core: debugcore productcore
 342 
 343 zero: debugzero productzero
 344 
 345 shark: debugshark productshark
 346 
 347 warn_jvmg_deprecated:
 348         echo "Warning: The jvmg target has been replaced with debug"
 349         echo "Warning: Please update your usage"
 350 
 351 jvmg: warn_jvmg_deprecated debug
 352 
 353 jvmg1: warn_jvmg_deprecated debug1
 354 
 355 jvmgcore: warn_jvmg_deprecated debugcore
 356 
 357 jvmgzero: warn_jvmg_deprecated debugzero
 358 
 359 jvmgshark: warn_jvmg_deprecated debugshark
 360 
 361 clean_docs:
 362         rm -rf $(SUBDIR_DOCS)
 363 
 364 clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark clean_minimal1:
 365         rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@)
 366 
 367 clean:  clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_minimal1 clean_docs
 368 
 369 include $(GAMMADIR)/make/cscope.make
 370 
 371 #
 372 # Include alternate Makefile if it exists.
 373 #
 374 -include $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make
 375 
 376 #-------------------------------------------------------------------------------
 377 
 378 .PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1)
 379 .PHONY: tree tree1 treecore treezero treeshark
 380 .PHONY: all compiler1 compiler2 core zero shark
 381 .PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs
 382 .PHONY: checks check_os_version check_j2se_version
 383 .PHONY: $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make
 384 
 385 .NOTPARALLEL: