make/solaris/makefiles/vm.make

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/solaris/makefiles/vm.make	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,357 @@
     1.4 +#
     1.5 +# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.
    1.11 +#
    1.12 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 +# version 2 for more details (a copy is included in the LICENSE file that
    1.16 +# accompanied this code).
    1.17 +#
    1.18 +# You should have received a copy of the GNU General Public License version
    1.19 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.20 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 +#
    1.22 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 +# or visit www.oracle.com if you need additional information or have any
    1.24 +# questions.
    1.25 +#
    1.26 +#
    1.27 +
    1.28 +# Rules to build JVM and related libraries, included from vm.make in the build
    1.29 +# directory.
    1.30 +
    1.31 +# Common build rules.
    1.32 +MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
    1.33 +include $(MAKEFILES_DIR)/rules.make
    1.34 +include $(GAMMADIR)/make/altsrc.make
    1.35 +
    1.36 +default: build
    1.37 +
    1.38 +#----------------------------------------------------------------------
    1.39 +# Defs
    1.40 +
    1.41 +GENERATED     = ../generated
    1.42 +DEP_DIR       = $(GENERATED)/dependencies
    1.43 +
    1.44 +# reads the generated files defining the set of .o's and the .o .h dependencies
    1.45 +-include $(DEP_DIR)/*.d
    1.46 +
    1.47 +# read machine-specific adjustments (%%% should do this via buildtree.make?)
    1.48 +include $(MAKEFILES_DIR)/$(BUILDARCH).make
    1.49 +
    1.50 +# set VPATH so make knows where to look for source files
    1.51 +# Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
    1.52 +# The adfiles directory contains ad_<arch>.[ch]pp.
    1.53 +# The jvmtifiles directory contains jvmti*.[ch]pp
    1.54 +Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles $(GENERATED)/tracefiles
    1.55 +VPATH += $(Src_Dirs_V:%=%:)
    1.56 +
    1.57 +# set INCLUDES for C preprocessor
    1.58 +Src_Dirs_I += $(GENERATED)
    1.59 +INCLUDES += $(Src_Dirs_I:%=-I%)
    1.60 +
    1.61 +# SYMFLAG is used by {dtrace,jsig,saproc}.make.
    1.62 +ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
    1.63 +  # always build with debug info when we can create .debuginfo files
    1.64 +  # and disable 'lazy debug info' so the .so has everything.
    1.65 +  SYMFLAG = -g -xs
    1.66 +else
    1.67 +  ifeq (${VERSION}, debug)
    1.68 +    SYMFLAG = -g
    1.69 +  else
    1.70 +    SYMFLAG =
    1.71 +  endif
    1.72 +endif
    1.73 +
    1.74 +# The following variables are defined in the generated flags.make file.
    1.75 +BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
    1.76 +JRE_VERSION   = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
    1.77 +HS_LIB_ARCH   = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
    1.78 +BUILD_TARGET  = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
    1.79 +BUILD_USER    = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
    1.80 +VM_DISTRO     = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
    1.81 +
    1.82 +CXXFLAGS =           \
    1.83 +  ${SYSDEFS}         \
    1.84 +  ${INCLUDES}        \
    1.85 +  ${BUILD_VERSION}   \
    1.86 +  ${BUILD_TARGET}    \
    1.87 +  ${BUILD_USER}      \
    1.88 +  ${HS_LIB_ARCH}     \
    1.89 +  ${VM_DISTRO}
    1.90 +
    1.91 +# This is VERY important! The version define must only be supplied to vm_version.o
    1.92 +# If not, ccache will not re-use the cache at all, since the version string might contain
    1.93 +# a time and date.
    1.94 +CXXFLAGS/vm_version.o += ${JRE_VERSION}
    1.95 +
    1.96 +CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
    1.97 +
    1.98 +# File specific flags
    1.99 +CXXFLAGS += $(CXXFLAGS/BYFILE)
   1.100 +
   1.101 +# Large File Support
   1.102 +ifneq ($(LP64), 1)
   1.103 +CXXFLAGS/ostream.o += -D_FILE_OFFSET_BITS=64
   1.104 +endif # ifneq ($(LP64), 1)
   1.105 +
   1.106 +# CFLAGS_WARN holds compiler options to suppress/enable warnings.
   1.107 +CFLAGS += $(CFLAGS_WARN)
   1.108 +
   1.109 +# Do not use C++ exception handling
   1.110 +CFLAGS += $(CFLAGS/NOEX)
   1.111 +
   1.112 +# Extra flags from gnumake's invocation or environment
   1.113 +CFLAGS += $(EXTRA_CFLAGS)
   1.114 +
   1.115 +# Math Library (libm.so), do not use -lm.
   1.116 +#    There might be two versions of libm.so on the build system:
   1.117 +#    libm.so.1 and libm.so.2, and we want libm.so.1.
   1.118 +#    Depending on the Solaris release being used to build with,
   1.119 +#    /usr/lib/libm.so could point at a libm.so.2, so we are
   1.120 +#    explicit here so that the libjvm.so you have built will work on an
   1.121 +#    older Solaris release that might not have libm.so.2.
   1.122 +#    This is a critical factor in allowing builds on Solaris 10 or newer
   1.123 +#    to run on Solaris 8 or 9.
   1.124 +#
   1.125 +LIBM=/usr/lib$(ISA_DIR)/libm.so.1
   1.126 +
   1.127 +ifeq ("${Platform_compiler}", "sparcWorks")
   1.128 +# The whole megilla:
   1.129 +ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1)
   1.130 +# Old Comment: List the libraries in the order the compiler was designed for
   1.131 +# Not sure what the 'designed for' comment is referring too above.
   1.132 +#   The order may not be too significant anymore, but I have placed this
   1.133 +#   older libm before libCrun, just to make sure it's found and used first.
   1.134 +LIBS += -lsocket -lsched -ldl $(LIBM) -lCrun -lthread -ldoor -lc -ldemangle
   1.135 +else
   1.136 +ifeq ($(COMPILER_REV_NUMERIC), 502)
   1.137 +# SC6.1 has it's own libm.so: specifying anything else provokes a name conflict.
   1.138 +LIBS += -ldl -lthread -lsocket -lm -lsched -ldoor -ldemangle
   1.139 +else
   1.140 +LIBS += -ldl -lthread -lsocket $(LIBM) -lsched -ldoor -ldemangle
   1.141 +endif # 502
   1.142 +endif # 505
   1.143 +else
   1.144 +LIBS += -lsocket -lsched -ldl $(LIBM) -lthread -lc -ldemangle
   1.145 +endif # sparcWorks
   1.146 +
   1.147 +LIBS += -lkstat
   1.148 +
   1.149 +# By default, link the *.o into the library, not the executable.
   1.150 +LINK_INTO$(LINK_INTO) = LIBJVM
   1.151 +
   1.152 +JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH)
   1.153 +
   1.154 +#----------------------------------------------------------------------
   1.155 +# jvm_db & dtrace
   1.156 +include $(MAKEFILES_DIR)/dtrace.make
   1.157 +
   1.158 +#----------------------------------------------------------------------
   1.159 +# add_gnu_debuglink tool
   1.160 +include $(MAKEFILES_DIR)/add_gnu_debuglink.make
   1.161 +
   1.162 +#----------------------------------------------------------------------
   1.163 +# fix_empty_sec_hdr_flags tool
   1.164 +include $(MAKEFILES_DIR)/fix_empty_sec_hdr_flags.make
   1.165 +
   1.166 +#----------------------------------------------------------------------
   1.167 +# JVM
   1.168 +
   1.169 +JVM      = jvm
   1.170 +LIBJVM   = lib$(JVM).so
   1.171 +
   1.172 +LIBJVM_DEBUGINFO   = lib$(JVM).debuginfo
   1.173 +LIBJVM_DIZ         = lib$(JVM).diz
   1.174 +
   1.175 +SPECIAL_PATHS:=adlc c1 dist gc_implementation opto shark libadt
   1.176 +
   1.177 +SOURCE_PATHS=\
   1.178 +  $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \
   1.179 +      \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \))
   1.180 +SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm
   1.181 +SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
   1.182 +SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
   1.183 +SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
   1.184 +
   1.185 +CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
   1.186 +CORE_PATHS+=$(GENERATED)/jvmtifiles $(GENERATED)/tracefiles
   1.187 +
   1.188 +ifneq ($(INCLUDE_TRACE), false)
   1.189 +CORE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
   1.190 +  find $(HS_ALT_SRC)/share/vm/jfr -type d; \
   1.191 +  fi)
   1.192 +endif
   1.193 +
   1.194 +COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1)
   1.195 +COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1
   1.196 +
   1.197 +COMPILER2_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/opto)
   1.198 +COMPILER2_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/libadt)
   1.199 +COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/opto
   1.200 +COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt
   1.201 +COMPILER2_PATHS +=  $(GENERATED)/adfiles
   1.202 +
   1.203 +# Include dirs per type.
   1.204 +Src_Dirs/CORE      := $(CORE_PATHS)
   1.205 +Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS)
   1.206 +Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS)
   1.207 +Src_Dirs/TIERED    := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS)
   1.208 +Src_Dirs/ZERO      := $(CORE_PATHS)
   1.209 +Src_Dirs/SHARK     := $(CORE_PATHS)
   1.210 +Src_Dirs := $(Src_Dirs/$(TYPE))
   1.211 +
   1.212 +COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp c2_\* runtime_\*
   1.213 +COMPILER1_SPECIFIC_FILES := c1_\*
   1.214 +SHARK_SPECIFIC_FILES     := shark
   1.215 +ZERO_SPECIFIC_FILES      := zero
   1.216 +
   1.217 +# Always exclude these.
   1.218 +Src_Files_EXCLUDE := dtrace jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
   1.219 +
   1.220 +# Exclude per type.
   1.221 +Src_Files_EXCLUDE/CORE      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
   1.222 +Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
   1.223 +Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES)
   1.224 +Src_Files_EXCLUDE/TIERED    := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES)
   1.225 +Src_Files_EXCLUDE/ZERO      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
   1.226 +Src_Files_EXCLUDE/SHARK     := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES)
   1.227 +
   1.228 +Src_Files_EXCLUDE +=  $(Src_Files_EXCLUDE/$(TYPE))
   1.229 +
   1.230 +# Special handling of arch model.
   1.231 +ifeq ($(Platform_arch_model), x86_32)
   1.232 +Src_Files_EXCLUDE += \*x86_64\*
   1.233 +endif
   1.234 +ifeq ($(Platform_arch_model), x86_64)
   1.235 +Src_Files_EXCLUDE += \*x86_32\*
   1.236 +endif
   1.237 +
   1.238 +# Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE.
   1.239 +define findsrc
   1.240 +	$(notdir $(shell find $(1)/. ! -name . -prune \
   1.241 +		-a \( -name \*.c -o -name \*.cpp -o -name \*.s \) \
   1.242 +		-a ! \( -name DUMMY $(addprefix -o -name ,$(Src_Files_EXCLUDE)) \)))
   1.243 +endef
   1.244 +
   1.245 +Src_Files := $(foreach e,$(Src_Dirs),$(call findsrc,$(e)))
   1.246 +
   1.247 +Obj_Files = $(sort $(addsuffix .o,$(basename $(Src_Files))))
   1.248 +
   1.249 +JVM_OBJ_FILES = $(Obj_Files) $(DTRACE_OBJS)
   1.250 +
   1.251 +vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES))
   1.252 +
   1.253 +mapfile : $(MAPFILE) $(MAPFILE_DTRACE_OPT) vm.def
   1.254 +	rm -f $@
   1.255 +	cat $(MAPFILE) $(MAPFILE_DTRACE_OPT) \
   1.256 +	    | $(NAWK) '{                                         \
   1.257 +	              if ($$0 ~ "INSERT VTABLE SYMBOLS HERE") {  \
   1.258 +	                  system ("cat vm.def");                 \
   1.259 +	              } else {                                   \
   1.260 +	                  print $$0;                             \
   1.261 +	              }                                          \
   1.262 +	          }' > $@
   1.263 +
   1.264 +mapfile_extended : mapfile $(MAPFILE_DTRACE_OPT)
   1.265 +	rm -f $@
   1.266 +	cat $^ > $@
   1.267 +
   1.268 +vm.def: $(Obj_Files)
   1.269 +	sh $(GAMMADIR)/make/solaris/makefiles/build_vm_def.sh *.o > $@
   1.270 +
   1.271 +ifeq ($(LINK_INTO),AOUT)
   1.272 +  LIBJVM.o                 =
   1.273 +  LIBJVM_MAPFILE           =
   1.274 +  LIBS_VM                  = $(LIBS)
   1.275 +else
   1.276 +  LIBJVM.o                 = $(JVM_OBJ_FILES)
   1.277 +  LIBJVM_MAPFILE$(LDNOMAP) = mapfile_extended
   1.278 +  LFLAGS_VM$(LDNOMAP)      += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE))
   1.279 +  LFLAGS_VM                += $(SONAMEFLAG:SONAME=$(LIBJVM))
   1.280 +ifndef USE_GCC
   1.281 +  LIBS_VM                  = $(LIBS)
   1.282 +else
   1.283 +  # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to
   1.284 +  # get around library dependency and compatibility issues. Must use gcc not
   1.285 +  # g++ to link.
   1.286 +  LFLAGS_VM                += $(STATIC_LIBGCC)
   1.287 +  LIBS_VM                  += $(STATIC_STDCXX) $(LIBS)
   1.288 +endif
   1.289 +endif
   1.290 +
   1.291 +ifdef USE_GCC
   1.292 +LINK_VM = $(LINK_LIB.CC)
   1.293 +else
   1.294 +LINK_VM = $(LINK_LIB.CXX)
   1.295 +endif
   1.296 +# making the library:
   1.297 +$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(LIBJVM.o) $(LIBJVM_MAPFILE)
   1.298 +ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
   1.299 +	@echo Linking vm...
   1.300 +	$(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK)
   1.301 +	$(QUIETLY) $(LINK_VM) $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM)
   1.302 +	$(QUIETLY) $(LINK_LIB.CXX/POST_HOOK)
   1.303 +	$(QUIETLY) rm -f $@.1 && ln -s $@ $@.1
   1.304 +ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   1.305 +# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
   1.306 +# Clear the SHF_ALLOC flag (if set) from empty section headers.
   1.307 +# An empty section header has sh_addr == 0 and sh_size == 0.
   1.308 +# This problem has only been seen on Solaris X64, but we call this tool
   1.309 +# on all Solaris builds just in case.
   1.310 +	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
   1.311 +	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
   1.312 +# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
   1.313 +# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
   1.314 +#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
   1.315 +	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DEBUGINFO) $@
   1.316 +  ifeq ($(STRIP_POLICY),all_strip)
   1.317 +	$(QUIETLY) $(STRIP) $@
   1.318 +  else
   1.319 +    ifeq ($(STRIP_POLICY),min_strip)
   1.320 +	$(QUIETLY) $(STRIP) -x $@
   1.321 +    # implied else here is no stripping at all
   1.322 +    endif
   1.323 +  endif
   1.324 +  ifeq ($(ZIP_DEBUGINFO_FILES),1)
   1.325 +	$(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO)
   1.326 +	$(RM) $(LIBJVM_DEBUGINFO)
   1.327 +  endif
   1.328 +endif
   1.329 +endif # filter -sbfast -xsbfast
   1.330 +
   1.331 +
   1.332 +DEST_SUBDIR        = $(JDK_LIBDIR)/$(VM_SUBDIR)
   1.333 +DEST_JVM           = $(DEST_SUBDIR)/$(LIBJVM)
   1.334 +DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO)
   1.335 +DEST_JVM_DIZ       = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
   1.336 +
   1.337 +install_jvm: $(LIBJVM)
   1.338 +	@echo "Copying $(LIBJVM) to $(DEST_JVM)"
   1.339 +	$(QUIETLY) test -f $(LIBJVM_DEBUGINFO) && \
   1.340 +	    cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO)
   1.341 +	$(QUIETLY) test -f $(LIBJVM_DIZ) && \
   1.342 +	    cp -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ)
   1.343 +	$(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done"
   1.344 +
   1.345 +#----------------------------------------------------------------------
   1.346 +# Other files
   1.347 +
   1.348 +# Signal interposition library
   1.349 +include $(MAKEFILES_DIR)/jsig.make
   1.350 +
   1.351 +# Serviceability agent
   1.352 +include $(MAKEFILES_DIR)/saproc.make
   1.353 +
   1.354 +#----------------------------------------------------------------------
   1.355 +
   1.356 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck
   1.357 +
   1.358 +install: install_jvm install_jsig install_saproc
   1.359 +
   1.360 +.PHONY: default build install install_jvm

mercurial