Common build definitions/targets for Solaris & Linux ?

David Holmes - Sun Microsystems David.Holmes at Sun.COM
Tue Nov 18 22:11:20 PST 2008


Is there any reason why the main definitions and targets in 
make/solaris/Makefile and make/linux/Makefile (see below) can't be 
factored out into a common file?

(The OS version check would of course need to be specialized.)

David
------------

# 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
#
# What you get with each target:
#
# debug*     - "thin" libjvm_g - debug info linked into the gamma_g launcher
# fastdebug* - optimized compile, but with asserts enabled
# jvmg*      - "fat" libjvm_g - debug info linked into libjvm_g.so
# 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

SUBDIR_DOCS       = $(OSNAME)_$(BUILDARCH)_docs
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))
SUBDIRS_KERNEL    = $(addprefix $(OSNAME)_$(BUILDARCH)_kernel/,$(TARGETS))

TARGETS_C2        = $(TARGETS)
TARGETS_C1        = $(addsuffix 1,$(TARGETS))
TARGETS_TIERED    = $(addsuffix tiered,$(TARGETS))
TARGETS_CORE      = $(addsuffix core,$(TARGETS))
TARGETS_KERNEL    = $(addsuffix kernel,$(TARGETS))

BUILDTREE_MAKE    = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) 
ARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
BUILDTREE_VARS   += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) 
HOTSPOT_BUILD_VERSION=$(HOTSPOT_BUILD_VERSION) 
JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)

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)"

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.

SUPPORTED_OS_VERSION = 5.7 5.8 5.9 5.10 5.11
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      = $(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 \
           $(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)
         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
         $(BUILDTREE) VARIANT=tiered

$(SUBDIRS_C2): $(BUILDTREE_MAKE)
ifdef FORCE_TIERED
         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
                 $(BUILDTREE) VARIANT=tiered FORCE_TIERED=1
else
         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
                 $(BUILDTREE) VARIANT=compiler2
endif

$(SUBDIRS_C1): $(BUILDTREE_MAKE)
         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
         $(BUILDTREE) VARIANT=compiler1

$(SUBDIRS_CORE): $(BUILDTREE_MAKE)
         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
         $(BUILDTREE) VARIANT=core

$(SUBDIRS_KERNEL): $(BUILDTREE_MAKE)
         $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
         $(BUILDTREE) VARIANT=kernel

# Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME

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

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

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

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

$(TARGETS_KERNEL):  $(SUBDIRS_KERNEL)
         cd $(OSNAME)_$(BUILDARCH)_kernel/$(patsubst %kernel,%,$@) && 
$(MAKE) $(MFLAGS)
         cd $(OSNAME)_$(BUILDARCH)_kernel/$(patsubst %kernel,%,$@) && 
./test_gamma
ifdef INSTALL
         cd $(OSNAME)_$(BUILDARCH)_kernel/$(patsubst %kernel,%,$@) && 
$(MAKE) $(MFLAGS) install
endif

# Just build the tree, and nothing else:
tree:      $(SUBDIRS_C2)
tree1:     $(SUBDIRS_C1)
treecore:  $(SUBDIRS_CORE)
treekernel:  $(SUBDIRS_KERNEL)

# Doc target.  This is the same for all build options.
#     Hence create a docs directory beside ...$(ARCH)_[...]
docs: checks
         $(QUIETLY) mkdir -p $(SUBDIR_DOCS)
         $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make 
$(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) jvmtidocs

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

compiler1:  jvmg1 product1

core: jvmgcore productcore

clean_docs:
         rm -rf $(SUBDIR_DOCS)

clean_compiler1 clean_compiler2 clean_core clean_kernel:
         rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@)

clean:  clean_compiler2 clean_compiler1 clean_core clean_docs clean_kernel

include $(GAMMADIR)/make/$(OSNAME)/makefiles/cscope.make

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

.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE)
.PHONY: tree tree1 treecore
.PHONY: all compiler1 compiler2 core
.PHONY: clean clean_compiler1 clean_compiler2 clean_core docs clean_docs
.PHONY: checks check_os_version check_j2se_version






More information about the hotspot-dev mailing list