Makefile 15.6 KB
Newer Older
D
duke 已提交
1
#
2
# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
19 20 21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
I
iveresov 已提交
22
#
D
duke 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#

# This makefile creates a build tree and lights off a build.
# You can go back into the build tree and perform rebuilds or
# incremental builds as desired. Be sure to reestablish
# environment variable settings for LD_LIBRARY_PATH and JAVA_HOME.

# The make process now relies on java and javac. These can be
# specified either implicitly on the PATH, by setting the
# (JDK-inherited) ALT_BOOTDIR environment variable to full path to a
# JDK in which bin/java and bin/javac are present and working (e.g.,
# /usr/local/java/jdk1.3/solaris), or via the (JDK-inherited)
# default BOOTDIR path value. Note that one of ALT_BOOTDIR
# or BOOTDIR has to be set. We do *not* search javac, javah, rmic etc.
# from the PATH.
#
# One can set ALT_BOOTDIR or BOOTDIR to point to a jdk that runs on
# an architecture that differs from the target architecture, as long
# as the bootstrap jdk runs under the same flavor of OS as the target
# (i.e., if the target is linux, point to a jdk that runs on a linux
# box).  In order to use such a bootstrap jdk, set the make variable
# REMOTE to the desired remote command mechanism, e.g.,
#
#    make REMOTE="rsh -l me myotherlinuxbox"

I
iveresov 已提交
48 49
# Along with VM, Serviceability Agent (SA) is built for SA/JDI binding.
# JDI binding on SA produces two binaries:
50
#  1. sa-jdi.jar       - This is built before building libjvm.so
D
duke 已提交
51
#                        Please refer to ./makefiles/sa.make
52 53
#  2. libsa.so         - Native library for SA - This is built after
#                        libjsig.so (signal interposition library)
I
iveresov 已提交
54
#                        Please refer to ./makefiles/vm.make
D
duke 已提交
55 56 57 58 59 60 61
# If $(GAMMADIR)/agent dir is not present, SA components are not built.

ifeq ($(GAMMADIR),)
include ../../make/defs.make
else
include $(GAMMADIR)/make/defs.make
endif
62
include $(GAMMADIR)/make/$(OSNAME)/makefiles/rules.make
D
duke 已提交
63 64

ifndef CC_INTERP
65 66 67
  ifndef FORCE_TIERED
    FORCE_TIERED=1
  endif
D
duke 已提交
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
endif

ifdef LP64
  ifeq ("$(filter $(LP64_ARCH),$(BUILDARCH))","")
    _JUNK_ := $(shell echo >&2 \
       $(OSNAME) $(ARCH) "*** ERROR: this platform does not support 64-bit compilers!")
	@exit 1
  endif
endif

# we need to set up LP64 correctly to satisfy sanity checks in adlc
ifneq ("$(filter $(LP64_ARCH),$(BUILDARCH))","")
  MFLAGS += " LP64=1 "
endif

83 84 85 86 87
# pass USE_SUNCC further, through MFLAGS
ifdef USE_SUNCC
  MFLAGS += " USE_SUNCC=1 "
endif

D
duke 已提交
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
# The following renders pathnames in generated Makefiles valid on
# machines other than the machine containing the build tree.
#
# For example, let's say my build tree lives on /files12 on
# exact.east.sun.com.  This logic will cause GAMMADIR to begin with
# /net/exact/files12/...
#
# We only do this on SunOS variants, for a couple of reasons:
#  * It is extremely rare that source trees exist on other systems
#  * It has been claimed that the Linux automounter is flakey, so
#    changing GAMMADIR in a way that exercises the automounter could
#    prove to be a source of unreliability in the build process.
# Obviously, this Makefile is only relevant on SunOS boxes to begin
# with, but the SunOS conditionalization will make it easier to
# combine Makefiles in the future (assuming we ever do that).

ifeq ($(OSNAME),solaris)

  #   prepend current directory to relative pathnames.
  NEW_GAMMADIR :=                                    \
    $(shell echo $(GAMMADIR) |                       \
      sed -e "s=^\([^/].*\)=$(shell pwd)/\1="        \
     )
  unexport NEW_GAMMADIR

  # If NEW_GAMMADIR doesn't already start with "/net/":
  ifeq ($(strip $(filter /net/%,$(NEW_GAMMADIR))),)
    #   prepend /net/$(HOST)
    #   remove /net/$(HOST) if name already began with /home/
    #   remove /net/$(HOST) if name already began with /java/
    #   remove /net/$(HOST) if name already began with /lab/
    NEW_GAMMADIR :=                                     \
         $(shell echo $(NEW_GAMMADIR) |                 \
                 sed -e "s=^\(.*\)=/net/$(HOST)\1="     \
                     -e "s=^/net/$(HOST)/home/=/home/=" \
                     -e "s=^/net/$(HOST)/java/=/java/=" \
                     -e "s=^/net/$(HOST)/lab/=/lab/="   \
          )
    # Don't use the new value for GAMMADIR unless a file with the new
    # name actually exists.
    ifneq ($(wildcard $(NEW_GAMMADIR)),)
      GAMMADIR := $(NEW_GAMMADIR)
    endif
  endif

endif

135 136 137
# BUILDARCH is set to "zero" for Zero builds.  VARIANTARCH
# is used to give the build directories meaningful names.
VARIANTARCH = $(subst i386,i486,$(ZERO_LIBARCH))
D
duke 已提交
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163

# There is a (semi-) regular correspondence between make targets and actions:
#
#       Target          Tree Type       Build Dir
#
#       debug           compiler2       <os>_<arch>_compiler2/debug
#       fastdebug       compiler2       <os>_<arch>_compiler2/fastdebug
#       jvmg            compiler2       <os>_<arch>_compiler2/jvmg
#       optimized       compiler2       <os>_<arch>_compiler2/optimized
#       profiled        compiler2       <os>_<arch>_compiler2/profiled
#       product         compiler2       <os>_<arch>_compiler2/product
#
#       debug1          compiler1       <os>_<arch>_compiler1/debug
#       fastdebug1      compiler1       <os>_<arch>_compiler1/fastdebug
#       jvmg1           compiler1       <os>_<arch>_compiler1/jvmg
#       optimized1      compiler1       <os>_<arch>_compiler1/optimized
#       profiled1       compiler1       <os>_<arch>_compiler1/profiled
#       product1        compiler1       <os>_<arch>_compiler1/product
#
#       debugcore       core            <os>_<arch>_core/debug
#       fastdebugcore   core            <os>_<arch>_core/fastdebug
#       jvmgcore        core            <os>_<arch>_core/jvmg
#       optimizedcore   core            <os>_<arch>_core/optimized
#       profiledcore    core            <os>_<arch>_core/profiled
#       productcore     core            <os>_<arch>_core/product
#
164 165 166 167 168 169 170
#       debugzero       zero            <os>_<arch>_zero/debug
#       fastdebugzero   zero            <os>_<arch>_zero/fastdebug
#       jvmgzero        zero            <os>_<arch>_zero/jvmg
#       optimizedzero   zero            <os>_<arch>_zero/optimized
#       profiledzero    zero            <os>_<arch>_zero/profiled
#       productzero     zero            <os>_<arch>_zero/product
#
171 172 173 174 175 176 177
#       debugshark      shark           <os>_<arch>_shark/debug
#       fastdebugshark  shark           <os>_<arch>_shark/fastdebug
#       jvmgshark       shark           <os>_<arch>_shark/jvmg
#       optimizedshark  shark           <os>_<arch>_shark/optimized
#       profiledshark   shark           <os>_<arch>_shark/profiled
#       productshark    shark           <os>_<arch>_shark/product
#
178 179 180 181
#       fastdebugminimal1 minimal1      <os>_<arch>_minimal1/fastdebug
#       jvmgminimal1      minimal1      <os>_<arch>_minimal1/jvmg
#       productminimal1   minimal1      <os>_<arch>_minimal1/product
#
D
duke 已提交
182 183
# What you get with each target:
#
184
# debug*     - "thin" libjvm - debug info linked into the gamma launcher
D
duke 已提交
185
# fastdebug* - optimized compile, but with asserts enabled
186
# jvmg*      - "fat" libjvm - debug info linked into libjvm.so
D
duke 已提交
187 188 189 190 191 192 193 194
# optimized* - optimized compile, no asserts
# profiled*  - gprof
# product*   - the shippable thing:  optimized compile, no asserts, -DPRODUCT

# This target list needs to be coordinated with the usage message
# in the build.sh script:
TARGETS           = debug jvmg fastdebug optimized profiled product

195
ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
196 197 198 199
  SUBDIR_DOCS     = $(OSNAME)_$(VARIANTARCH)_docs
else
  SUBDIR_DOCS     = $(OSNAME)_$(BUILDARCH)_docs
endif
D
duke 已提交
200 201 202 203
SUBDIRS_C1        = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler1/,$(TARGETS))
SUBDIRS_C2        = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS))
SUBDIRS_TIERED    = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS))
SUBDIRS_CORE      = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS))
204
SUBDIRS_ZERO      = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS))
205
SUBDIRS_SHARK     = $(addprefix $(OSNAME)_$(VARIANTARCH)_shark/,$(TARGETS))
206
SUBDIRS_MINIMAL1  = $(addprefix $(OSNAME)_$(BUILDARCH)_minimal1/,$(TARGETS))
D
duke 已提交
207 208 209 210 211

TARGETS_C2        = $(TARGETS)
TARGETS_C1        = $(addsuffix 1,$(TARGETS))
TARGETS_TIERED    = $(addsuffix tiered,$(TARGETS))
TARGETS_CORE      = $(addsuffix core,$(TARGETS))
212
TARGETS_ZERO      = $(addsuffix zero,$(TARGETS))
213
TARGETS_SHARK     = $(addsuffix shark,$(TARGETS))
214
TARGETS_MINIMAL1 =  $(addsuffix minimal1,$(TARGETS))
D
duke 已提交
215

216
BUILDTREE_MAKE    = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
217
BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
D
duke 已提交
218
BUILDTREE_VARS   += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) HOTSPOT_BUILD_VERSION=$(HOTSPOT_BUILD_VERSION) JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
219
BUILDTREE_VARS   += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) OBJCOPY=$(OBJCOPY) STRIP_POLICY=$(STRIP_POLICY) ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) ZIPEXE=$(ZIPEXE)
D
duke 已提交
220 221 222 223 224 225 226 227 228 229 230

BUILDTREE         = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS)

#-------------------------------------------------------------------------------

# Could make everything by default, but that would take a while.
all:
	@echo "Try '$(MAKE) <target> ...'  where <target> is one or more of"
	@echo "  $(TARGETS_C2)"
	@echo "  $(TARGETS_C1)"
	@echo "  $(TARGETS_CORE)"
231
	@echo "  $(TARGETS_ZERO)"
232
	@echo "  $(TARGETS_SHARK)"
233
	@echo "  $(TARGETS_MINIMAL1)"
D
duke 已提交
234 235 236 237 238 239 240

checks: check_os_version check_j2se_version

# We do not want people accidentally building on old systems (e.g. Linux 2.2.x,
# Solaris 2.5.1, 2.6).
# Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok.

241
SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3%
D
duke 已提交
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
OS_VERSION := $(shell uname -r)
EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION))

check_os_version:
ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),)
	$(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1;
endif

# jvmti.make requires XSLT (J2SE 1.4.x or newer):
XSLT_CHECK	= $(REMOTE) $(RUN.JAVAP) javax.xml.transform.TransformerFactory
# If not found then fail fast.
check_j2se_version:
	$(QUIETLY) $(XSLT_CHECK) > /dev/null 2>&1; \
	if [ $$? -ne 0 ]; then \
	  $(REMOTE) $(RUN.JAVA) -version; \
	  echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \
	  "to bootstrap this build" 1>&2; \
	  exit 1; \
	fi

$(SUBDIRS_TIERED): $(BUILDTREE_MAKE)
263
	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
D
duke 已提交
264 265 266
	$(BUILDTREE) VARIANT=tiered

$(SUBDIRS_C2): $(BUILDTREE_MAKE)
267
ifeq ($(FORCE_TIERED),1)
268
	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
D
duke 已提交
269 270
		$(BUILDTREE) VARIANT=tiered FORCE_TIERED=1
else
271
	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
D
duke 已提交
272 273 274 275
		$(BUILDTREE) VARIANT=compiler2
endif

$(SUBDIRS_C1): $(BUILDTREE_MAKE)
276
	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
D
duke 已提交
277 278 279
	$(BUILDTREE) VARIANT=compiler1

$(SUBDIRS_CORE): $(BUILDTREE_MAKE)
280
	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
D
duke 已提交
281 282
	$(BUILDTREE) VARIANT=core

283 284 285 286
$(SUBDIRS_ZERO): $(BUILDTREE_MAKE) platform_zero
	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
	$(BUILDTREE) VARIANT=zero VARIANTARCH=$(VARIANTARCH)

287 288 289 290
$(SUBDIRS_SHARK): $(BUILDTREE_MAKE) platform_zero
	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
	$(BUILDTREE) VARIANT=shark VARIANTARCH=$(VARIANTARCH)

291 292 293 294 295
$(SUBDIRS_MINIMAL1): $(BUILDTREE_MAKE)
	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
	$(BUILDTREE) VARIANT=minimal1


296 297 298
platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in
	$(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@

D
duke 已提交
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
# Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME

$(TARGETS_C2):  $(SUBDIRS_C2)
	cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS)
ifdef INSTALL
	cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install
endif

$(TARGETS_TIERED):  $(SUBDIRS_TIERED)
	cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS)
ifdef INSTALL
	cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install
endif

$(TARGETS_C1):  $(SUBDIRS_C1)
	cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS)
ifdef INSTALL
	cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install
endif

$(TARGETS_CORE):  $(SUBDIRS_CORE)
	cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS)
ifdef INSTALL
	cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install
endif

325 326 327 328 329 330
$(TARGETS_ZERO):  $(SUBDIRS_ZERO)
	cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS)
ifdef INSTALL
	cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install
endif

331 332 333 334 335 336
$(TARGETS_SHARK):  $(SUBDIRS_SHARK)
	cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS)
ifdef INSTALL
	cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install
endif

337 338 339 340 341 342
$(TARGETS_MINIMAL1):  $(SUBDIRS_MINIMAL1)
	cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS)
ifdef INSTALL
	cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) install
endif

D
duke 已提交
343 344 345 346
# Just build the tree, and nothing else:
tree:      $(SUBDIRS_C2)
tree1:     $(SUBDIRS_C1)
treecore:  $(SUBDIRS_CORE)
347
treezero:  $(SUBDIRS_ZERO)
348
treeshark: $(SUBDIRS_SHARK)
349
treeminimal1: $(SUBDIRS_MINIMAL1)
D
duke 已提交
350 351 352

# Doc target.  This is the same for all build options.
#     Hence create a docs directory beside ...$(ARCH)_[...]
353 354
# We specify 'BUILD_FLAVOR=product' so that the proper
# ENABLE_FULL_DEBUG_SYMBOLS value is used.
D
duke 已提交
355 356
docs: checks
	$(QUIETLY) mkdir -p $(SUBDIR_DOCS)
357
	$(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) BUILD_FLAVOR=product jvmtidocs
D
duke 已提交
358 359 360 361 362 363 364 365

# Synonyms for win32-like targets.
compiler2:  jvmg product

compiler1:  jvmg1 product1

core: jvmgcore productcore

366 367
zero: jvmgzero productzero

368 369
shark: jvmgshark productshark

D
duke 已提交
370 371 372
clean_docs:
	rm -rf $(SUBDIR_DOCS)

373
clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark clean_minimal1:
D
duke 已提交
374 375
	rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@)

376
clean:  clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_minimal1 clean_docs
D
duke 已提交
377

378
include $(GAMMADIR)/make/cscope.make
D
duke 已提交
379

380 381 382 383 384
#
# Include alternate Makefile if it exists.
#
-include $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make

D
duke 已提交
385 386
#-------------------------------------------------------------------------------

387
.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1)
388 389 390
.PHONY: tree tree1 treecore treezero treeshark
.PHONY: all compiler1 compiler2 core zero shark
.PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs
D
duke 已提交
391
.PHONY: checks check_os_version check_j2se_version
392
.PHONY: $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make