make/aix/makefiles/vm.make

changeset 6464
b83f7d608548
child 6491
e7cbc95179c4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/aix/makefiles/vm.make	Fri Sep 06 20:08:29 2013 +0200
     1.3 @@ -0,0 +1,377 @@
     1.4 +#
     1.5 +# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 +# Copyright 2012, 2013 SAP AG. All rights reserved.
     1.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 +#
     1.9 +# This code is free software; you can redistribute it and/or modify it
    1.10 +# under the terms of the GNU General Public License version 2 only, as
    1.11 +# published by the Free Software Foundation.
    1.12 +#
    1.13 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 +# version 2 for more details (a copy is included in the LICENSE file that
    1.17 +# accompanied this code).
    1.18 +#
    1.19 +# You should have received a copy of the GNU General Public License version
    1.20 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 +#
    1.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 +# or visit www.oracle.com if you need additional information or have any
    1.25 +# questions.
    1.26 +#
    1.27 +#
    1.28 +
    1.29 +# Rules to build JVM and related libraries, included from vm.make in the build
    1.30 +# directory.
    1.31 +
    1.32 +# Common build rules.
    1.33 +MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
    1.34 +include $(MAKEFILES_DIR)/rules.make
    1.35 +include $(GAMMADIR)/make/altsrc.make
    1.36 +
    1.37 +default: build
    1.38 +
    1.39 +#----------------------------------------------------------------------
    1.40 +# Defs
    1.41 +
    1.42 +GENERATED     = ../generated
    1.43 +DEP_DIR       = $(GENERATED)/dependencies
    1.44 +
    1.45 +# reads the generated files defining the set of .o's and the .o .h dependencies
    1.46 +-include $(DEP_DIR)/*.d
    1.47 +
    1.48 +# read machine-specific adjustments (%%% should do this via buildtree.make?)
    1.49 +ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
    1.50 +  include $(MAKEFILES_DIR)/zeroshark.make
    1.51 +else
    1.52 +  include $(MAKEFILES_DIR)/$(BUILDARCH).make
    1.53 +endif
    1.54 +
    1.55 +# set VPATH so make knows where to look for source files
    1.56 +# Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
    1.57 +# The adfiles directory contains ad_<arch>.[ch]pp.
    1.58 +# The jvmtifiles directory contains jvmti*.[ch]pp
    1.59 +Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles $(GENERATED)/tracefiles
    1.60 +VPATH += $(Src_Dirs_V:%=%:)
    1.61 +
    1.62 +# set INCLUDES for C preprocessor.
    1.63 +Src_Dirs_I += $(GENERATED)
    1.64 +# The order is important for the precompiled headers to work.
    1.65 +INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%)
    1.66 +
    1.67 +# SYMFLAG is used by {jsig,saproc}.make
    1.68 +ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
    1.69 +  # always build with debug info when we can create .debuginfo files
    1.70 +  SYMFLAG = -g
    1.71 +else
    1.72 +  ifeq (${VERSION}, debug)
    1.73 +    SYMFLAG = -g
    1.74 +  else
    1.75 +    SYMFLAG =
    1.76 +  endif
    1.77 +endif
    1.78 +
    1.79 +# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
    1.80 +# in $(GAMMADIR)/make/defs.make
    1.81 +ifeq ($(HOTSPOT_BUILD_VERSION),)
    1.82 +  BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
    1.83 +else
    1.84 +  BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
    1.85 +endif
    1.86 +
    1.87 +# The following variables are defined in the generated flags.make file.
    1.88 +BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
    1.89 +JRE_VERSION   = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
    1.90 +HS_LIB_ARCH   = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
    1.91 +BUILD_TARGET  = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
    1.92 +BUILD_USER    = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
    1.93 +VM_DISTRO     = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
    1.94 +
    1.95 +CXXFLAGS =           \
    1.96 +  ${SYSDEFS}         \
    1.97 +  ${INCLUDES}        \
    1.98 +  ${BUILD_VERSION}   \
    1.99 +  ${BUILD_TARGET}    \
   1.100 +  ${BUILD_USER}      \
   1.101 +  ${HS_LIB_ARCH}     \
   1.102 +  ${VM_DISTRO}
   1.103 +
   1.104 +# This is VERY important! The version define must only be supplied to vm_version.o
   1.105 +# If not, ccache will not re-use the cache at all, since the version string might contain
   1.106 +# a time and date.
   1.107 +vm_version.o: CXXFLAGS += ${JRE_VERSION}
   1.108 +
   1.109 +CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
   1.110 +
   1.111 +# File specific flags
   1.112 +CXXFLAGS += $(CXXFLAGS/BYFILE)
   1.113 +
   1.114 +
   1.115 +# CFLAGS_WARN holds compiler options to suppress/enable warnings.
   1.116 +CFLAGS += $(CFLAGS_WARN/BYFILE)
   1.117 +
   1.118 +# Do not use C++ exception handling
   1.119 +CFLAGS += $(CFLAGS/NOEX)
   1.120 +
   1.121 +# Extra flags from gnumake's invocation or environment
   1.122 +CFLAGS += $(EXTRA_CFLAGS)
   1.123 +LFLAGS += $(EXTRA_CFLAGS)
   1.124 +
   1.125 +# Don't set excutable bit on stack segment
   1.126 +# the same could be done by separate execstack command
   1.127 +#LFLAGS += -Xlinker -z -Xlinker noexecstack
   1.128 +
   1.129 +LIBS += -lm -ldl -lpthread
   1.130 +
   1.131 +# By default, link the *.o into the library, not the executable.
   1.132 +LINK_INTO$(LINK_INTO) = LIBJVM
   1.133 +
   1.134 +JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH)
   1.135 +
   1.136 +#----------------------------------------------------------------------
   1.137 +# jvm_db & dtrace
   1.138 +include $(MAKEFILES_DIR)/dtrace.make
   1.139 +
   1.140 +#----------------------------------------------------------------------
   1.141 +# JVM
   1.142 +
   1.143 +JVM      = jvm
   1.144 +LIBJVM   = lib$(JVM).so
   1.145 +
   1.146 +CFLAGS += -DALLOW_OPERATOR_NEW_USAGE
   1.147 +
   1.148 +LIBJVM_DEBUGINFO   = lib$(JVM).debuginfo
   1.149 +LIBJVM_DIZ         = lib$(JVM).diz
   1.150 +
   1.151 +SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt
   1.152 +
   1.153 +SOURCE_PATHS=\
   1.154 +  $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \
   1.155 +      \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \))
   1.156 +SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm
   1.157 +SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
   1.158 +SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(SRCARCH)/vm
   1.159 +SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_family)_$(SRCARCH)/vm
   1.160 +
   1.161 +CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
   1.162 +CORE_PATHS+=$(GENERATED)/jvmtifiles $(GENERATED)/tracefiles
   1.163 +
   1.164 +ifneq ($(INCLUDE_TRACE), false)
   1.165 +CORE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
   1.166 +  find $(HS_ALT_SRC)/share/vm/jfr -type d; \
   1.167 +  fi)
   1.168 +endif
   1.169 +
   1.170 +COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1)
   1.171 +COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1
   1.172 +
   1.173 +COMPILER2_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/opto)
   1.174 +COMPILER2_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/libadt)
   1.175 +COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/opto
   1.176 +COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt
   1.177 +COMPILER2_PATHS += $(GENERATED)/adfiles
   1.178 +
   1.179 +SHARK_PATHS := $(GAMMADIR)/src/share/vm/shark
   1.180 +
   1.181 +# Include dirs per type.
   1.182 +Src_Dirs/CORE      := $(CORE_PATHS)
   1.183 +Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS)
   1.184 +Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS)
   1.185 +Src_Dirs/TIERED    := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS)
   1.186 +Src_Dirs/ZERO      := $(CORE_PATHS)
   1.187 +Src_Dirs/SHARK     := $(CORE_PATHS) $(SHARK_PATHS)
   1.188 +Src_Dirs := $(Src_Dirs/$(TYPE))
   1.189 +
   1.190 +COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp c2_\* runtime_\*
   1.191 +COMPILER1_SPECIFIC_FILES := c1_\*
   1.192 +SHARK_SPECIFIC_FILES     := shark
   1.193 +ZERO_SPECIFIC_FILES      := zero
   1.194 +
   1.195 +# Always exclude these.
   1.196 +Src_Files_EXCLUDE += jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
   1.197 +
   1.198 +# Exclude per type.
   1.199 +Src_Files_EXCLUDE/CORE      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
   1.200 +Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
   1.201 +Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES)
   1.202 +Src_Files_EXCLUDE/TIERED    := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES)
   1.203 +Src_Files_EXCLUDE/ZERO      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
   1.204 +Src_Files_EXCLUDE/SHARK     := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES)
   1.205 +
   1.206 +Src_Files_EXCLUDE +=  $(Src_Files_EXCLUDE/$(TYPE))
   1.207 +
   1.208 +# Disable 155427 on aix.
   1.209 +Src_Files_EXCLUDE += decoder_elf.cpp elfFile.cpp elfStringTable.cpp elfSymbolTable.cpp
   1.210 +
   1.211 +# Special handling of arch model.
   1.212 +ifeq ($(Platform_arch_model), x86_32)
   1.213 +Src_Files_EXCLUDE += \*x86_64\*
   1.214 +endif
   1.215 +ifeq ($(Platform_arch_model), x86_64)
   1.216 +Src_Files_EXCLUDE += \*x86_32\*
   1.217 +endif
   1.218 +
   1.219 +# Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE.
   1.220 +define findsrc
   1.221 +	$(notdir $(shell find $(1)/. ! -name . -prune \
   1.222 +		-a \( -name \*.c -o -name \*.cpp -o -name \*.s \) \
   1.223 +		-a ! \( -name DUMMY $(addprefix -o -name ,$(Src_Files_EXCLUDE)) \)))
   1.224 +endef
   1.225 +
   1.226 +Src_Files := $(foreach e,$(Src_Dirs),$(call findsrc,$(e)))
   1.227 +
   1.228 +Obj_Files = $(sort $(addsuffix .o,$(basename $(Src_Files))))
   1.229 +
   1.230 +JVM_OBJ_FILES = $(Obj_Files)
   1.231 +
   1.232 +vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES))
   1.233 +
   1.234 +mapfile : $(MAPFILE) vm.def
   1.235 +	rm -f $@
   1.236 +	awk '{ if ($$0 ~ "INSERT VTABLE SYMBOLS HERE")	\
   1.237 +                 { system ("cat vm.def"); }		\
   1.238 +               else					\
   1.239 +                 { print $$0 }				\
   1.240 +             }' > $@ < $(MAPFILE)
   1.241 +
   1.242 +mapfile_reorder : mapfile $(REORDERFILE)
   1.243 +	rm -f $@
   1.244 +	cat $^ > $@
   1.245 +
   1.246 +vm.def: $(Res_Files) $(Obj_Files)
   1.247 +	sh $(GAMMADIR)/make/aix/makefiles/build_vm_def.sh *.o > $@
   1.248 +
   1.249 +ifeq ($(JVM_VARIANT_ZEROSHARK), true)
   1.250 +  STATIC_CXX = false
   1.251 +else
   1.252 +  ifeq ($(ZERO_LIBARCH), ppc64)
   1.253 +    STATIC_CXX = false
   1.254 +  else
   1.255 +    STATIC_CXX = true
   1.256 +  endif
   1.257 +endif
   1.258 +
   1.259 +ifeq ($(LINK_INTO),AOUT)
   1.260 +  LIBJVM.o                 =
   1.261 +  LIBJVM_MAPFILE           =
   1.262 +  LIBS_VM                  = $(LIBS)
   1.263 +else
   1.264 +  LIBJVM.o                 = $(JVM_OBJ_FILES)
   1.265 +  LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder
   1.266 +  LFLAGS_VM$(LDNOMAP)      += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE))
   1.267 +# xlC_r ignores the -o= syntax
   1.268 +# LFLAGS_VM                += $(SONAMEFLAG:SONAME=$(LIBJVM))
   1.269 +
   1.270 +  # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to
   1.271 +  # get around library dependency and compatibility issues. Must use gcc not
   1.272 +  # g++ to link.
   1.273 +  LIBS_VM                  += $(STATIC_STDCXX) $(LIBS)
   1.274 +endif
   1.275 +
   1.276 +LINK_VM = $(LINK_LIB.CXX)
   1.277 +
   1.278 +# create loadmap for libjvm.so by default. Helps in diagnosing some problems.
   1.279 +LFLAGS_VM += -bloadmap:libjvm.loadmap
   1.280 +
   1.281 +# rule for building precompiled header
   1.282 +$(PRECOMPILED_HEADER):
   1.283 +	$(QUIETLY) echo Generating precompiled header $@
   1.284 +	$(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
   1.285 +	$(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
   1.286 +
   1.287 +# making the library:
   1.288 +
   1.289 +ifneq ($(JVM_BASE_ADDR),)
   1.290 +# By default shared library is linked at base address == 0. Modify the
   1.291 +# linker script if JVM prefers a different base location. It can also be
   1.292 +# implemented with 'prelink -r'. But 'prelink' is not (yet) available on
   1.293 +# our build platform (AS-2.1).
   1.294 +LD_SCRIPT = libjvm.so.lds
   1.295 +$(LD_SCRIPT): $(LIBJVM_MAPFILE)
   1.296 +	$(QUIETLY) {                                                \
   1.297 +	  rm -rf $@;                                                \
   1.298 +	  $(LINK_VM) -Wl,--verbose $(LFLAGS_VM) 2>&1             |  \
   1.299 +	    sed -e '/^======/,/^======/!d'                          \
   1.300 +		-e '/^======/d'                                     \
   1.301 +		-e 's/0\( + SIZEOF_HEADERS\)/$(JVM_BASE_ADDR)\1/'   \
   1.302 +		> $@;                                               \
   1.303 +	}
   1.304 +LD_SCRIPT_FLAG = -Wl,-T,$(LD_SCRIPT)
   1.305 +endif
   1.306 +
   1.307 +# With more recent Redhat releases (or the cutting edge version Fedora), if
   1.308 +# SELinux is configured to be enabled, the runtime linker will fail to apply
   1.309 +# the text relocation to libjvm.so considering that it is built as a non-PIC
   1.310 +# DSO. To workaround that, we run chcon to libjvm.so after it is built. See
   1.311 +# details in bug 6538311.
   1.312 +$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT)
   1.313 +	$(QUIETLY) {                                                      \
   1.314 +	    echo Linking vm...;                                           \
   1.315 +	    $(LINK_LIB.CXX/PRE_HOOK)                                      \
   1.316 +	    $(LINK_VM) $(LD_SCRIPT_FLAG)                                  \
   1.317 +		       $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \
   1.318 +	    $(LINK_LIB.CXX/POST_HOOK)                                     \
   1.319 +	    rm -f $@.1; ln -s $@ $@.1;                                    \
   1.320 +	}
   1.321 +# No security contexts on AIX
   1.322 +#           if [ \"$(CROSS_COMPILE_ARCH)\" = \"\" ] ; then              \
   1.323 +#	      if [ -x /usr/sbin/selinuxenabled ] ; then                 \
   1.324 +#	        /usr/sbin/selinuxenabled;                               \
   1.325 +#               if [ $$? = 0 ] ; then					\
   1.326 +#		  /usr/bin/chcon -t textrel_shlib_t $@;                 \
   1.327 +#		  if [ $$? != 0 ]; then                                 \
   1.328 +#		    echo "ERROR: Cannot chcon $@";			\
   1.329 +#		  fi							\
   1.330 +#	        fi							\
   1.331 +#	      fi                                                        \
   1.332 +#           fi 							        \
   1.333 +#	}
   1.334 +
   1.335 +#ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   1.336 +#	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
   1.337 +#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
   1.338 +#    ifeq ($(STRIP_POLICY),all_strip)
   1.339 +#	$(QUIETLY) $(STRIP) $@
   1.340 +#    else
   1.341 +#      ifeq ($(STRIP_POLICY),min_strip)
   1.342 +#	$(QUIETLY) $(STRIP) -g $@
   1.343 +#      # implied else here is no stripping at all
   1.344 +#      endif
   1.345 +#    endif
   1.346 +#    ifeq ($(ZIP_DEBUGINFO_FILES),1)
   1.347 +#	$(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO)
   1.348 +#	$(RM) $(LIBJVM_DEBUGINFO)
   1.349 +#  endif
   1.350 +#endif
   1.351 +
   1.352 +DEST_SUBDIR        = $(JDK_LIBDIR)/$(VM_SUBDIR)
   1.353 +DEST_JVM           = $(DEST_SUBDIR)/$(LIBJVM)
   1.354 +DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO)
   1.355 +DEST_JVM_DIZ       = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
   1.356 +
   1.357 +install_jvm: $(LIBJVM)
   1.358 +	@echo "Copying $(LIBJVM) to $(DEST_JVM)"
   1.359 +	$(QUIETLY) test -f $(LIBJVM_DEBUGINFO) && \
   1.360 +	    cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO)
   1.361 +	$(QUIETLY) test -f $(LIBJVM_DIZ) && \
   1.362 +	    cp -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ)
   1.363 +	$(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done"
   1.364 +
   1.365 +#----------------------------------------------------------------------
   1.366 +# Other files
   1.367 +
   1.368 +# Signal interposition library
   1.369 +include $(MAKEFILES_DIR)/jsig.make
   1.370 +
   1.371 +# Serviceability agent
   1.372 +include $(MAKEFILES_DIR)/saproc.make
   1.373 +
   1.374 +#----------------------------------------------------------------------
   1.375 +
   1.376 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC)
   1.377 +
   1.378 +install: install_jvm install_jsig install_saproc
   1.379 +
   1.380 +.PHONY: default build install install_jvm

mercurial