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 # debugminimal1 minimal1 <os>_<arch>_minimal1/debug 161 # productminimal1 minimal1 <os>_<arch>_minimal1/product 162 # 163 # What you get with each target: 164 # 165 # debug* - debug compile with asserts enabled 166 # fastdebug* - optimized compile, but with asserts enabled 167 # optimized* - optimized compile, no asserts 168 # product* - the shippable thing: optimized compile, no asserts, -DPRODUCT 169 170 # This target list needs to be coordinated with the usage message 171 # in the build.sh script: 172 TARGETS = debug fastdebug optimized product 173 174 ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) 175 SUBDIR_DOCS = $(OSNAME)_$(VARIANTARCH)_docs 176 else 177 SUBDIR_DOCS = $(OSNAME)_$(BUILDARCH)_docs 178 endif 179 SUBDIRS_C1 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler1/,$(TARGETS)) 180 SUBDIRS_C2 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS)) 181 SUBDIRS_TIERED = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS)) 182 SUBDIRS_CORE = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS)) 183 SUBDIRS_ZERO = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS)) 184 SUBDIRS_SHARK = $(addprefix $(OSNAME)_$(VARIANTARCH)_shark/,$(TARGETS)) 185 SUBDIRS_MINIMAL1 = $(addprefix $(OSNAME)_$(BUILDARCH)_minimal1/,$(TARGETS)) 186 187 TARGETS_C2 = $(TARGETS) 188 TARGETS_C1 = $(addsuffix 1,$(TARGETS)) 189 TARGETS_TIERED = $(addsuffix tiered,$(TARGETS)) 190 TARGETS_CORE = $(addsuffix core,$(TARGETS)) 191 TARGETS_ZERO = $(addsuffix zero,$(TARGETS)) 192 TARGETS_SHARK = $(addsuffix shark,$(TARGETS)) 193 TARGETS_MINIMAL1 = $(addsuffix minimal1,$(TARGETS)) 194 195 BUILDTREE_MAKE = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make 196 BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) LIBRARY_SUFFIX=$(LIBRARY_SUFFIX) 197 BUILDTREE_VARS += HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) VERSION_STRING=$(VERSION_STRING) 198 BUILDTREE_VARS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) OBJCOPY=$(OBJCOPY) STRIP_POLICY=$(STRIP_POLICY) ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) ZIPEXE=$(ZIPEXE) 199 200 BUILDTREE = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS) 201 202 #------------------------------------------------------------------------------- 203 204 # Could make everything by default, but that would take a while. 205 all: 206 @echo "Try '$(MAKE) <target> ...' where <target> is one or more of" 207 @echo " $(TARGETS_C2)" 208 @echo " $(TARGETS_C1)" 209 @echo " $(TARGETS_CORE)" 210 @echo " $(TARGETS_ZERO)" 211 @echo " $(TARGETS_SHARK)" 212 @echo " $(TARGETS_MINIMAL1)" 213 214 checks: check_os_version check_j2se_version 215 216 # We do not want people accidentally building on old systems (e.g. Linux 2.2.x, 217 # Solaris 2.5.1, 2.6). 218 # Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok. 219 220 #SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 2.7% 221 DISABLE_HOTSPOT_OS_VERSION_CHECK = ok 222 OS_VERSION := $(shell uname -r) 223 EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION)) 224 225 check_os_version: 226 ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),) 227 $(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1; 228 endif 229 230 # jvmti.make requires XSLT (J2SE 1.4.x or newer): 231 XSLT_CHECK = $(REMOTE) $(RUN.JAVAP) javax.xml.transform.TransformerFactory 232 # If not found then fail fast. 233 check_j2se_version: 234 $(QUIETLY) if ! $(XSLT_CHECK) > /dev/null 2>&1; then \ 235 $(REMOTE) $(RUN.JAVA) -version; \ 236 echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \ 237 "to bootstrap this build" 1>&2; \ 238 exit 1; \ 239 fi 240 241 $(SUBDIRS_TIERED): $(BUILDTREE_MAKE) 242 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks 243 +$(BUILDTREE) VARIANT=tiered 244 245 $(SUBDIRS_C2): $(BUILDTREE_MAKE) 246 ifeq ($(FORCE_TIERED),1) 247 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks 248 +$(BUILDTREE) VARIANT=tiered FORCE_TIERED=1 249 else 250 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks 251 +$(BUILDTREE) VARIANT=compiler2 252 endif 253 254 $(SUBDIRS_C1): $(BUILDTREE_MAKE) 255 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks 256 +$(BUILDTREE) VARIANT=compiler1 257 258 $(SUBDIRS_CORE): $(BUILDTREE_MAKE) 259 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks 260 +$(BUILDTREE) VARIANT=core 261 262 $(SUBDIRS_ZERO): $(BUILDTREE_MAKE) platform_zero 263 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks 264 +$(BUILDTREE) VARIANT=zero VARIANTARCH=$(VARIANTARCH) 265 266 $(SUBDIRS_SHARK): $(BUILDTREE_MAKE) platform_zero 267 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks 268 +$(BUILDTREE) VARIANT=shark VARIANTARCH=$(VARIANTARCH) 269 270 $(SUBDIRS_MINIMAL1): $(BUILDTREE_MAKE) 271 $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks 272 +$(BUILDTREE) VARIANT=minimal1 273 274 platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in 275 $(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@ 276 277 # Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME 278 279 $(TARGETS_C2): $(SUBDIRS_C2) 280 cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) 281 ifdef INSTALL 282 cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install 283 endif 284 285 $(TARGETS_TIERED): $(SUBDIRS_TIERED) 286 cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) 287 ifdef INSTALL 288 cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install 289 endif 290 291 $(TARGETS_C1): $(SUBDIRS_C1) 292 cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) 293 ifdef INSTALL 294 cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install 295 endif 296 297 $(TARGETS_CORE): $(SUBDIRS_CORE) 298 cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) 299 ifdef INSTALL 300 cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install 301 endif 302 303 $(TARGETS_ZERO): $(SUBDIRS_ZERO) 304 cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) 305 ifdef INSTALL 306 cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install 307 endif 308 309 $(TARGETS_SHARK): $(SUBDIRS_SHARK) 310 cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) 311 ifdef INSTALL 312 cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install 313 endif 314 315 $(TARGETS_MINIMAL1): $(SUBDIRS_MINIMAL1) 316 cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) 317 ifdef INSTALL 318 cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) install 319 endif 320 321 # Just build the tree, and nothing else: 322 tree: $(SUBDIRS_C2) 323 tree1: $(SUBDIRS_C1) 324 treecore: $(SUBDIRS_CORE) 325 treezero: $(SUBDIRS_ZERO) 326 treeshark: $(SUBDIRS_SHARK) 327 treeminimal1: $(SUBDIRS_MINIMAL1) 328 329 # Doc target. This is the same for all build options. 330 # Hence create a docs directory beside ...$(ARCH)_[...] 331 # We specify 'BUILD_FLAVOR=product' so that the proper 332 # ENABLE_FULL_DEBUG_SYMBOLS value is used. 333 docs: checks 334 $(QUIETLY) mkdir -p $(SUBDIR_DOCS) 335 $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) BUILD_FLAVOR=product jvmtidocs 336 337 # Synonyms for win32-like targets. 338 compiler2: debug product 339 340 compiler1: debug1 product1 341 342 core: debugcore productcore 343 344 zero: debugzero productzero 345 346 shark: debugshark productshark 347 348 warn_jvmg_deprecated: 349 echo "Warning: The jvmg target has been replaced with debug" 350 echo "Warning: Please update your usage" 351 352 jvmg: warn_jvmg_deprecated debug 353 354 jvmg1: warn_jvmg_deprecated debug1 355 356 jvmgcore: warn_jvmg_deprecated debugcore 357 358 jvmgzero: warn_jvmg_deprecated debugzero 359 360 jvmgshark: warn_jvmg_deprecated debugshark 361 362 clean_docs: 363 rm -rf $(SUBDIR_DOCS) 364 365 clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark clean_minimal1: 366 rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@) 367 368 clean: clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_minimal1 clean_docs 369 370 include $(GAMMADIR)/make/cscope.make 371 372 # 373 # Include alternate Makefile if it exists. 374 # 375 -include $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make 376 377 #------------------------------------------------------------------------------- 378 379 .PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1) 380 .PHONY: tree tree1 treecore treezero treeshark 381 .PHONY: all compiler1 compiler2 core zero shark 382 .PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs 383 .PHONY: checks check_os_version check_j2se_version 384 .PHONY: $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make 385 386 .NOTPARALLEL: