2080N/A# Copyright (c) 2005, 2011, Oracle
and/or its affiliates. All rights reserved.
0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A# This code is free software; you can redistribute it
and/or modify it
0N/A# under the terms of the GNU General Public License version 2 only, as
0N/A# published by the Free Software Foundation.
0N/A# This code is distributed in the hope that it will be useful, but WITHOUT
0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A# version 2 for more details (a copy is included in the LICENSE file that
0N/A# accompanied this code).
0N/A# You should have received a copy of the GNU General Public License version
0N/A# 2 along with this work; if not, write to the Free Software Foundation,
0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1472N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0N/A# GAMMADIR=dir OS_FAMILY=os VARIANT=variant
0N/A# The macros ARCH, GAMMADIR, OS_FAMILY and VARIANT must be defined in the
0N/A# environment or on the command-line:
0N/A# ARCH - sparc, i486, ... HotSpot cpu and os_cpu source directory
0N/A# BUILDARCH - build directory
0N/A# GAMMADIR - top of workspace
0N/A# OS_FAMILY - operating system
0N/A# VARIANT - core, compiler1, compiler2, or tiered
0N/A# HOTSPOT_RELEASE_VERSION - <major>.<minor>-b<nn> (11.0-b07)
1884N/A# HOTSPOT_BUILD_VERSION - internal, internal-$(USER_RELEASE_SUFFIX) or empty
0N/A# JRE_RELEASE_VERSION - <major>.<minor>.<micro> (1.7.0)
0N/A# Builds the directory trees with makefiles plus some convenience files in
0N/A# Makefile - for "make foo"
0N/A# env.[ck]sh - environment settings
0N/A# test_gamma - script to run the Queens program
0N/A# The makefiles are split this way so that "make foo" will run faster by not
0N/A# having to read the dependency files for the vm.
0N/A# 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details.
0N/AQUIETLY$(MAKE_VERBOSE) = @
0N/A# For now, until the compiler is less wobbly:
0N/ATESTFLAGS = -Xbatch -showversion
1010N/A PLATFORM_FILE = $(shell dirname $(shell dirname $(shell pwd)))/platform_zero
1010N/A PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH).suncc
1010N/A PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH)
1010N/A# Allow overriding of the arch part of the directory but default
1010N/A# to BUILDARCH if nothing is specified
0N/Aifeq ($(VARIANT),tiered)
1010N/APLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_compiler2
1010N/APLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT)
1010N/APLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT)
0N/A# We do two levels of exclusion in the shared directory.
0N/A# TOPLEVEL excludes are pruned, they are not recursively searched,
0N/A# but lower level directories can be named without fear of collision.
0N/A# ALWAYS excludes are excluded at any level in the directory tree.
0N/AALWAYS_EXCLUDE_DIRS = $(SCM_DIRS)
0N/Aifeq ($(VARIANT),tiered)
0N/ATOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name agent
0N/Aifeq ($(VARIANT),compiler2)
0N/ATOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name c1 -o -name agent
0N/A# compiler1 and core use the same exclude list
0N/ATOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name opto -o -name libadt -o -name agent
0N/A# Get things from the platform file.
0N/ACOMPILER = $(shell sed -n 's/^compiler[ ]*=[ ]*//p' $(PLATFORM_FILE))
0N/ATARGETS = debug fastdebug jvmg optimized product profiled
0N/ASUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS))
0N/A# For dependencies and recursive makes.
0N/ABUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
2073N/A SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
0N/Aifeq ($(HOTSPOT_BUILD_VERSION),)
0N/A HS_BUILD_VER=$(HOTSPOT_RELEASE_VERSION)
0N/A HS_BUILD_VER=$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)
0N/A# Set BUILD_USER from system-dependent hints: $LOGNAME, $(whoami)
0N/Aifndef HOTSPOT_BUILD_USER
0N/A HOTSPOT_BUILD_USER := $(shell echo $$LOGNAME)
0N/Aifndef HOTSPOT_BUILD_USER
0N/A HOTSPOT_BUILD_USER := $(shell whoami)
0N/Aifndef HOTSPOT_VM_DISTRO
2080N/A ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true)
0N/ABUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HS_BUILD_VER) HOTSPOT_BUILD_VERSION= JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
0N/A $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_TARGETS) $(BUILDTREE_VARS)
0N/ABUILDTREE_COMMENT = echo "\# Generated by $(BUILDTREE_MAKE)"
0N/A# Run make in each subdirectory recursively.
0N/A$(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE
0N/A $(QUIETLY) [ -d $@ ] || { mkdir -p $@; }
0N/A $(QUIETLY) cd $@ && $(BUILDTREE) TARGET=$(@F)
0N/A $(QUIETLY) mkdir -p $@
2080N/A# Convenience macro which takes a source relative path, applies $(1) to the
2080N/A# absolute path, and then replaces $(GAMMADIR) in the result with a
2080N/A# literal "$(GAMMADIR)/" suitable for inclusion in a Makefile.
2080N/Agamma-path=$(subst $(GAMMADIR),\$$(GAMMADIR),$(call $(1),$(HS_COMMON_SRC)/$(2)))
0N/A @echo Creating $@ ...
0N/A $(BUILDTREE_COMMENT); \
0N/A echo "Platform_file = $(PLATFORM_FILE)" | sed 's|$(GAMMADIR)|$$(GAMMADIR)|'; \
0N/A sed -n '/=/s/^ */Platform_/p' < $(PLATFORM_FILE); \
0N/A echo "GAMMADIR = $(GAMMADIR)"; \
0N/A echo "SYSDEFS = \$$(Platform_sysdefs)"; \
2073N/A echo "SRCARCH = $(SRCARCH)"; \
0N/A echo "BUILDARCH = $(BUILDARCH)"; \
0N/A echo "LIBARCH = $(LIBARCH)"; \
0N/A echo "TARGET = $(TARGET)"; \
0N/A echo "HS_BUILD_VER = $(HS_BUILD_VER)"; \
0N/A echo "JRE_RELEASE_VER = $(JRE_RELEASE_VERSION)"; \
0N/A echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \
0N/A echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \
0N/A echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \
1879N/A echo "# Used for platform dispatching"; \
1879N/A echo "TARGET_DEFINES = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \
1879N/A echo "TARGET_DEFINES += -DTARGET_ARCH_\$$(Platform_arch)"; \
1879N/A echo "TARGET_DEFINES += -DTARGET_ARCH_MODEL_\$$(Platform_arch_model)"; \
1879N/A echo "TARGET_DEFINES += -DTARGET_OS_ARCH_\$$(Platform_os_arch)"; \
1879N/A echo "TARGET_DEFINES += -DTARGET_OS_ARCH_MODEL_\$$(Platform_os_arch_model)"; \
1879N/A echo "TARGET_DEFINES += -DTARGET_COMPILER_\$$(Platform_compiler)"; \
1879N/A echo "CFLAGS += \$$(TARGET_DEFINES)"; \
2080N/A echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \
2080N/A echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \
2080N/A echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
2080N/A echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
2080N/A echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \
2080N/A echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \
2080N/A echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \
2080N/A echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \
2080N/A echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
2080N/A echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
2080N/A echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \
2080N/A echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \
0N/A [ -n "$(CFLAGS_BROWSE)" ] && \
0N/A echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \
2790N/A echo && echo "OBJCOPY = $(OBJCOPY)"; \
2790N/A [ -n "$(STRIP_POLICY)" ] && \
2790N/A echo && echo "STRIP_POLICY = $(STRIP_POLICY)"; \
0N/A [ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \
0N/A echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \
0N/A echo "SYSDEFS += \$$(HOTSPOT_EXTRA_SYSDEFS)"; \
91N/A echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \
91N/A echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \
0N/A @echo Creating $@ ...
0N/A $(BUILDTREE_COMMENT); \
0N/A [ "$(TARGET)" = profiled ] && \
91N/A echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(TARGET).make"; \
0N/A @echo Creating directory list $@
2080N/A -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
2080N/A \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@; \
0N/A -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
2080N/A \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@
0N/AMakefile: $(BUILDTREE_MAKE)
0N/A @echo Creating $@ ...
0N/A $(BUILDTREE_COMMENT); \
0N/A @echo Creating $@ ...
0N/A $(BUILDTREE_COMMENT); \
91N/A echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
0N/A @echo Creating $@ ...
0N/A $(BUILDTREE_COMMENT); \
91N/A echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
0N/A @echo Creating $@ ...
0N/A $(BUILDTREE_COMMENT); \
91N/A echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
0N/A @echo Creating $@ ...
0N/A $(BUILDTREE_COMMENT); \
91N/A echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \
0N/A @echo Creating $@ ...
0N/A $(BUILDTREE_COMMENT); \
0N/A [ -n "$$JAVA_HOME" ] && { echo ": \$${JAVA_HOME:=$${JAVA_HOME}}"; }; \
0N/A echo "LD_LIBRARY_PATH=.:$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}\$${JAVA_HOME}
/jre/lib/${LIBARCH}/native_threads:\$${JAVA_HOME}
/jre/lib/${LIBARCH}:${GCC_LIB}"; \
0N/A } | sed s:$${JAVA_HOME:--------}:\$${JAVA_HOME}:g; \
0N/A echo "HOTSPOT_BUILD_USER=\"$${LOGNAME:-$$USER} in `basename $(GAMMADIR)`\""; \
0N/A echo "export JAVA_HOME LD_LIBRARY_PATH CLASSPATH HOTSPOT_BUILD_USER"; \
0N/A @echo Creating $@ ...
0N/A $(BUILDTREE_COMMENT); \
0N/A [ -n "$$JAVA_HOME" ] && \
0N/A { echo "if (! \$$?JAVA_HOME) setenv JAVA_HOME \"$$JAVA_HOME\""; }; \
0N/A sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=/setenv \1 /p' $?; \
0N/A.dbxrc: $(BUILDTREE_MAKE)
0N/A @echo Creating $@ ...
0N/A echo "echo '# Loading $(PLATFORM_DIR)/$(TARGET)/.dbxrc'"; \
0N/A echo "if [ -f \"\$${HOTSPOT_DBXWARE}\" ]"; \
0N/A echo " source \"\$${HOTSPOT_DBXWARE}\""; \
0N/A echo "elif [ -f \"\$$HOME/.dbxrc\" ]"; \
0N/A echo " source \"\$$HOME/.dbxrc\""; \
0N/A# Skip the test for product builds (which only work when installed in a JDK), to
0N/A# avoid exiting with an error and causing make to halt.
0N/A echo "$@: skipping the test--this build must be tested in a JDK."
0N/A echo "JAVA_HOME must be set to run this test."
0N/ADATA_MODE = $(DATA_MODE/$(BUILDARCH))
0N/AJAVA_FLAG = $(JAVA_FLAG/$(DATA_MODE))
0N/AWRONG_DATA_MODE_MSG = \
0N/A echo "JAVA_HOME must point to $(DATA_MODE)bit JDK."
1601N/A echo "Cross compiling for ARCH $(CROSS_COMPILE_ARCH), skipping gamma run."
0N/A @echo Creating $@ ...
0N/A $(BUILDTREE_COMMENT); \
1601N/A echo "if [ \"$(CROSS_COMPILE_ARCH)\" != \"\" ]; then { $(CROSS_COMPILING_MSG); exit 0; }; fi"; \
0N/A echo "if [ -z \$$JAVA_HOME ]; then { $(NO_JAVA_HOME_MSG); exit 0; }; fi"; \
0N/A echo " $(WRONG_DATA_MODE_MSG); exit 0;"; \
0N/A echo '[ -f gamma_g ] && { gamma=gamma_g; }'; \
0N/A echo './$${gamma:-gamma} $(TESTFLAGS) Queens <
/dev/null'; \
0N/A $(QUIETLY) chmod +x $@