simonis@6464: # simonis@6464: # Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. simonis@6464: # Copyright 2012, 2013 SAP AG. All rights reserved. simonis@6464: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. simonis@6464: # simonis@6464: # This code is free software; you can redistribute it and/or modify it simonis@6464: # under the terms of the GNU General Public License version 2 only, as simonis@6464: # published by the Free Software Foundation. simonis@6464: # simonis@6464: # This code is distributed in the hope that it will be useful, but WITHOUT simonis@6464: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or simonis@6464: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License simonis@6464: # version 2 for more details (a copy is included in the LICENSE file that simonis@6464: # accompanied this code). simonis@6464: # simonis@6464: # You should have received a copy of the GNU General Public License version simonis@6464: # 2 along with this work; if not, write to the Free Software Foundation, simonis@6464: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. simonis@6464: # simonis@6464: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA simonis@6464: # or visit www.oracle.com if you need additional information or have any simonis@6464: # questions. simonis@6464: # simonis@6464: # simonis@6464: simonis@6464: # This makefile creates a build tree and lights off a build. simonis@6464: # You can go back into the build tree and perform rebuilds or simonis@6464: # incremental builds as desired. Be sure to reestablish simonis@6464: # environment variable settings for LD_LIBRARY_PATH and JAVA_HOME. simonis@6464: simonis@6464: # The make process now relies on java and javac. These can be simonis@6464: # specified either implicitly on the PATH, by setting the simonis@6464: # (JDK-inherited) ALT_BOOTDIR environment variable to full path to a simonis@6464: # JDK in which bin/java and bin/javac are present and working (e.g., simonis@6464: # /usr/local/java/jdk1.3/solaris), or via the (JDK-inherited) simonis@6464: # default BOOTDIR path value. Note that one of ALT_BOOTDIR simonis@6464: # or BOOTDIR has to be set. We do *not* search javac, javah, rmic etc. simonis@6464: # from the PATH. simonis@6464: # simonis@6464: # One can set ALT_BOOTDIR or BOOTDIR to point to a jdk that runs on simonis@6464: # an architecture that differs from the target architecture, as long simonis@6464: # as the bootstrap jdk runs under the same flavor of OS as the target simonis@6464: # (i.e., if the target is linux, point to a jdk that runs on a linux simonis@6464: # box). In order to use such a bootstrap jdk, set the make variable simonis@6464: # REMOTE to the desired remote command mechanism, e.g., simonis@6464: # simonis@6464: # make REMOTE="rsh -l me myotherlinuxbox" simonis@6464: simonis@6464: # Along with VM, Serviceability Agent (SA) is built for SA/JDI binding. simonis@6464: # JDI binding on SA produces two binaries: simonis@6464: # 1. sa-jdi.jar - This is built before building libjvm.so simonis@6464: # Please refer to ./makefiles/sa.make simonis@6464: # 2. libsa.so - Native library for SA - This is built after simonis@6464: # libjsig.so (signal interposition library) simonis@6464: # Please refer to ./makefiles/vm.make simonis@6464: # If $(GAMMADIR)/agent dir is not present, SA components are not built. simonis@6464: simonis@6464: # No tests on Aix. simonis@6464: TEST_IN_BUILD=false simonis@6464: simonis@6464: ifeq ($(GAMMADIR),) simonis@6464: include ../../make/defs.make simonis@6464: else simonis@6464: include $(GAMMADIR)/make/defs.make simonis@6464: endif simonis@6464: include $(GAMMADIR)/make/$(OSNAME)/makefiles/rules.make simonis@6464: simonis@6464: ifndef CC_INTERP simonis@6464: ifndef FORCE_TIERED simonis@6464: FORCE_TIERED=1 simonis@6464: endif simonis@6464: endif goetz@6512: # C1 is not ported on ppc64(le), so we cannot build a tiered VM: goetz@6512: ifneq (,$(filter $(ARCH),ppc64 pp64le)) goetz@6512: FORCE_TIERED=0 goetz@6512: endif simonis@6464: simonis@6464: ifdef LP64 simonis@6464: ifeq ("$(filter $(LP64_ARCH),$(BUILDARCH))","") simonis@6464: _JUNK_ := $(shell echo >&2 \ simonis@6464: $(OSNAME) $(ARCH) "*** ERROR: this platform does not support 64-bit compilers!") simonis@6464: @exit 1 simonis@6464: endif simonis@6464: endif simonis@6464: simonis@6464: # we need to set up LP64 correctly to satisfy sanity checks in adlc simonis@6464: ifneq ("$(filter $(LP64_ARCH),$(BUILDARCH))","") simonis@6464: MFLAGS += " LP64=1 " simonis@6464: endif simonis@6464: simonis@6464: # pass USE_SUNCC further, through MFLAGS simonis@6464: ifdef USE_SUNCC simonis@6464: MFLAGS += " USE_SUNCC=1 " simonis@6464: endif simonis@6464: simonis@6464: # The following renders pathnames in generated Makefiles valid on simonis@6464: # machines other than the machine containing the build tree. simonis@6464: # simonis@6464: # For example, let's say my build tree lives on /files12 on simonis@6464: # exact.east.sun.com. This logic will cause GAMMADIR to begin with simonis@6464: # /net/exact/files12/... simonis@6464: # simonis@6464: # We only do this on SunOS variants, for a couple of reasons: simonis@6464: # * It is extremely rare that source trees exist on other systems simonis@6464: # * It has been claimed that the Linux automounter is flakey, so simonis@6464: # changing GAMMADIR in a way that exercises the automounter could simonis@6464: # prove to be a source of unreliability in the build process. simonis@6464: # Obviously, this Makefile is only relevant on SunOS boxes to begin simonis@6464: # with, but the SunOS conditionalization will make it easier to simonis@6464: # combine Makefiles in the future (assuming we ever do that). simonis@6464: simonis@6464: ifeq ($(OSNAME),solaris) simonis@6464: simonis@6464: # prepend current directory to relative pathnames. simonis@6464: NEW_GAMMADIR := \ simonis@6464: $(shell echo $(GAMMADIR) | \ simonis@6464: sed -e "s=^\([^/].*\)=$(shell pwd)/\1=" \ simonis@6464: ) simonis@6464: unexport NEW_GAMMADIR simonis@6464: simonis@6464: # If NEW_GAMMADIR doesn't already start with "/net/": simonis@6464: ifeq ($(strip $(filter /net/%,$(NEW_GAMMADIR))),) simonis@6464: # prepend /net/$(HOST) simonis@6464: # remove /net/$(HOST) if name already began with /home/ simonis@6464: # remove /net/$(HOST) if name already began with /java/ simonis@6464: # remove /net/$(HOST) if name already began with /lab/ simonis@6464: NEW_GAMMADIR := \ simonis@6464: $(shell echo $(NEW_GAMMADIR) | \ simonis@6464: sed -e "s=^\(.*\)=/net/$(HOST)\1=" \ simonis@6464: -e "s=^/net/$(HOST)/home/=/home/=" \ simonis@6464: -e "s=^/net/$(HOST)/java/=/java/=" \ simonis@6464: -e "s=^/net/$(HOST)/lab/=/lab/=" \ simonis@6464: ) simonis@6464: # Don't use the new value for GAMMADIR unless a file with the new simonis@6464: # name actually exists. simonis@6464: ifneq ($(wildcard $(NEW_GAMMADIR)),) simonis@6464: GAMMADIR := $(NEW_GAMMADIR) simonis@6464: endif simonis@6464: endif simonis@6464: simonis@6464: endif simonis@6464: simonis@6464: # BUILDARCH is set to "zero" for Zero builds. VARIANTARCH simonis@6464: # is used to give the build directories meaningful names. simonis@6464: VARIANTARCH = $(subst i386,i486,$(ZERO_LIBARCH)) simonis@6464: simonis@6464: # There is a (semi-) regular correspondence between make targets and actions: simonis@6464: # simonis@6464: # Target Tree Type Build Dir simonis@6464: # simonis@6464: # debug compiler2 __compiler2/debug simonis@6464: # fastdebug compiler2 __compiler2/fastdebug simonis@6464: # optimized compiler2 __compiler2/optimized simonis@6464: # product compiler2 __compiler2/product simonis@6464: # simonis@6464: # debug1 compiler1 __compiler1/debug simonis@6464: # fastdebug1 compiler1 __compiler1/fastdebug simonis@6464: # optimized1 compiler1 __compiler1/optimized simonis@6464: # product1 compiler1 __compiler1/product simonis@6464: # simonis@6464: # debugcore core __core/debug simonis@6464: # fastdebugcore core __core/fastdebug simonis@6464: # optimizedcore core __core/optimized simonis@6464: # productcore core __core/product simonis@6464: # simonis@6464: # debugzero zero __zero/debug simonis@6464: # fastdebugzero zero __zero/fastdebug simonis@6464: # optimizedzero zero __zero/optimized simonis@6464: # productzero zero __zero/product simonis@6464: # simonis@6464: # debugshark shark __shark/debug simonis@6464: # fastdebugshark shark __shark/fastdebug simonis@6464: # optimizedshark shark __shark/optimized simonis@6464: # productshark shark __shark/product simonis@6464: # simonis@6464: # fastdebugminimal1 minimal1 __minimal1/fastdebug simonis@6464: # productminimal1 minimal1 __minimal1/product simonis@6464: # simonis@6464: # What you get with each target: simonis@6464: # simonis@6464: # debug* - debug compile with asserts enabled simonis@6464: # fastdebug* - optimized compile, but with asserts enabled simonis@6464: # optimized* - optimized compile, no asserts simonis@6464: # product* - the shippable thing: optimized compile, no asserts, -DPRODUCT simonis@6464: simonis@6464: # This target list needs to be coordinated with the usage message simonis@6464: # in the build.sh script: simonis@6464: TARGETS = debug fastdebug optimized product simonis@6464: simonis@6464: ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) simonis@6464: SUBDIR_DOCS = $(OSNAME)_$(VARIANTARCH)_docs simonis@6464: else simonis@6464: SUBDIR_DOCS = $(OSNAME)_$(BUILDARCH)_docs simonis@6464: endif simonis@6464: SUBDIRS_C1 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler1/,$(TARGETS)) simonis@6464: SUBDIRS_C2 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS)) simonis@6464: SUBDIRS_TIERED = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS)) simonis@6464: SUBDIRS_CORE = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS)) simonis@6464: SUBDIRS_ZERO = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS)) simonis@6464: SUBDIRS_SHARK = $(addprefix $(OSNAME)_$(VARIANTARCH)_shark/,$(TARGETS)) simonis@6464: SUBDIRS_MINIMAL1 = $(addprefix $(OSNAME)_$(BUILDARCH)_minimal1/,$(TARGETS)) simonis@6464: simonis@6464: TARGETS_C2 = $(TARGETS) simonis@6464: TARGETS_C1 = $(addsuffix 1,$(TARGETS)) simonis@6464: TARGETS_TIERED = $(addsuffix tiered,$(TARGETS)) simonis@6464: TARGETS_CORE = $(addsuffix core,$(TARGETS)) simonis@6464: TARGETS_ZERO = $(addsuffix zero,$(TARGETS)) simonis@6464: TARGETS_SHARK = $(addsuffix shark,$(TARGETS)) simonis@6464: TARGETS_MINIMAL1 = $(addsuffix minimal1,$(TARGETS)) simonis@6464: simonis@6464: BUILDTREE_MAKE = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make simonis@6464: BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) simonis@6464: BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) HOTSPOT_BUILD_VERSION=$(HOTSPOT_BUILD_VERSION) JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) simonis@6464: BUILDTREE_VARS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) OBJCOPY=$(OBJCOPY) STRIP_POLICY=$(STRIP_POLICY) ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) ZIPEXE=$(ZIPEXE) simonis@6464: simonis@6464: BUILDTREE = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS) simonis@6464: simonis@6464: #------------------------------------------------------------------------------- simonis@6464: simonis@6464: # Could make everything by default, but that would take a while. simonis@6464: all: simonis@6464: @echo "Try '$(MAKE) ...' where is one or more of" simonis@6464: @echo " $(TARGETS_C2)" simonis@6464: @echo " $(TARGETS_C1)" simonis@6464: @echo " $(TARGETS_CORE)" simonis@6464: @echo " $(TARGETS_ZERO)" simonis@6464: @echo " $(TARGETS_SHARK)" simonis@6464: @echo " $(TARGETS_MINIMAL1)" simonis@6464: simonis@6464: checks: check_os_version check_j2se_version simonis@6464: simonis@6464: # We do not want people accidentally building on old systems (e.g. Linux 2.2.x, simonis@6464: # Solaris 2.5.1, 2.6). simonis@6464: # Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok. simonis@6464: simonis@6464: SUPPORTED_OS_VERSION = AIX simonis@6464: OS_VERSION := $(shell uname -a) simonis@6464: EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION)) simonis@6464: simonis@6464: check_os_version: simonis@6464: ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),) simonis@6464: $(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1; simonis@6464: endif simonis@6464: simonis@6464: # jvmti.make requires XSLT (J2SE 1.4.x or newer): simonis@6464: XSLT_CHECK = $(REMOTE) $(RUN.JAVAP) javax.xml.transform.TransformerFactory simonis@6464: # If not found then fail fast. simonis@6464: check_j2se_version: simonis@6464: $(QUIETLY) $(XSLT_CHECK) > /dev/null 2>&1; \ simonis@6464: if [ $$? -ne 0 ]; then \ simonis@6464: $(REMOTE) $(RUN.JAVA) -version; \ simonis@6464: echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \ simonis@6464: "to bootstrap this build" 1>&2; \ simonis@6464: exit 1; \ simonis@6464: fi simonis@6464: simonis@6464: $(SUBDIRS_TIERED): $(BUILDTREE_MAKE) simonis@6464: $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks simonis@6464: $(BUILDTREE) VARIANT=tiered simonis@6464: simonis@6464: $(SUBDIRS_C2): $(BUILDTREE_MAKE) simonis@6464: ifeq ($(FORCE_TIERED),1) simonis@6464: $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks simonis@6464: $(BUILDTREE) VARIANT=tiered FORCE_TIERED=1 simonis@6464: else simonis@6464: $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks simonis@6464: $(BUILDTREE) VARIANT=compiler2 simonis@6464: endif simonis@6464: simonis@6464: $(SUBDIRS_C1): $(BUILDTREE_MAKE) simonis@6464: $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks simonis@6464: $(BUILDTREE) VARIANT=compiler1 simonis@6464: simonis@6464: $(SUBDIRS_CORE): $(BUILDTREE_MAKE) simonis@6464: $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks simonis@6464: $(BUILDTREE) VARIANT=core simonis@6464: simonis@6464: $(SUBDIRS_ZERO): $(BUILDTREE_MAKE) platform_zero simonis@6464: $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks simonis@6464: $(BUILDTREE) VARIANT=zero VARIANTARCH=$(VARIANTARCH) simonis@6464: simonis@6464: $(SUBDIRS_SHARK): $(BUILDTREE_MAKE) platform_zero simonis@6464: $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks simonis@6464: $(BUILDTREE) VARIANT=shark VARIANTARCH=$(VARIANTARCH) simonis@6464: simonis@6464: $(SUBDIRS_MINIMAL1): $(BUILDTREE_MAKE) simonis@6464: $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks simonis@6464: $(BUILDTREE) VARIANT=minimal1 simonis@6464: simonis@6464: simonis@6464: platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in simonis@6464: $(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@ simonis@6464: simonis@6464: # Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME simonis@6464: simonis@6464: $(TARGETS_C2): $(SUBDIRS_C2) simonis@6464: cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) simonis@6464: ifdef INSTALL simonis@6464: cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install simonis@6464: endif simonis@6464: simonis@6464: $(TARGETS_TIERED): $(SUBDIRS_TIERED) simonis@6464: cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) simonis@6464: ifdef INSTALL simonis@6464: cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install simonis@6464: endif simonis@6464: simonis@6464: $(TARGETS_C1): $(SUBDIRS_C1) simonis@6464: cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) simonis@6464: ifdef INSTALL simonis@6464: cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install simonis@6464: endif simonis@6464: simonis@6464: $(TARGETS_CORE): $(SUBDIRS_CORE) simonis@6464: cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) simonis@6464: ifdef INSTALL simonis@6464: cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install simonis@6464: endif simonis@6464: simonis@6464: $(TARGETS_ZERO): $(SUBDIRS_ZERO) simonis@6464: cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) simonis@6464: ifdef INSTALL simonis@6464: cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install simonis@6464: endif simonis@6464: simonis@6464: $(TARGETS_SHARK): $(SUBDIRS_SHARK) simonis@6464: cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) simonis@6464: ifdef INSTALL simonis@6464: cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install simonis@6464: endif simonis@6464: simonis@6464: $(TARGETS_MINIMAL1): $(SUBDIRS_MINIMAL1) simonis@6464: cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) simonis@6464: ifdef INSTALL simonis@6464: cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) install simonis@6464: endif simonis@6464: simonis@6464: # Just build the tree, and nothing else: simonis@6464: tree: $(SUBDIRS_C2) simonis@6464: tree1: $(SUBDIRS_C1) simonis@6464: treecore: $(SUBDIRS_CORE) simonis@6464: treezero: $(SUBDIRS_ZERO) simonis@6464: treeshark: $(SUBDIRS_SHARK) simonis@6464: treeminimal1: $(SUBDIRS_MINIMAL1) simonis@6464: simonis@6464: # Doc target. This is the same for all build options. simonis@6464: # Hence create a docs directory beside ...$(ARCH)_[...] simonis@6464: # We specify 'BUILD_FLAVOR=product' so that the proper simonis@6464: # ENABLE_FULL_DEBUG_SYMBOLS value is used. simonis@6464: docs: checks simonis@6464: $(QUIETLY) mkdir -p $(SUBDIR_DOCS) simonis@6464: $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) BUILD_FLAVOR=product jvmtidocs simonis@6464: simonis@6464: # Synonyms for win32-like targets. simonis@6464: compiler2: debug product simonis@6464: simonis@6464: compiler1: debug1 product1 simonis@6464: simonis@6464: core: debugcore productcore simonis@6464: simonis@6464: zero: debugzero productzero simonis@6464: simonis@6464: shark: debugshark productshark simonis@6464: simonis@6464: clean_docs: simonis@6464: rm -rf $(SUBDIR_DOCS) simonis@6464: simonis@6464: clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark clean_minimal1: simonis@6464: rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@) simonis@6464: simonis@6464: clean: clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_minimal1 clean_docs simonis@6464: simonis@6464: include $(GAMMADIR)/make/cscope.make simonis@6464: simonis@6464: #------------------------------------------------------------------------------- simonis@6464: simonis@6464: .PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1) simonis@6464: .PHONY: tree tree1 treecore treezero treeshark simonis@6464: .PHONY: all compiler1 compiler2 core zero shark simonis@6464: .PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs simonis@6464: .PHONY: checks check_os_version check_j2se_version