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