make/solaris/makefiles/vm.make

Sat, 11 Dec 2010 13:46:36 -0500

author
zgu
date
Sat, 11 Dec 2010 13:46:36 -0500
changeset 2365
54f5dd2aa1d9
parent 2364
2d4762ec74af
parent 2326
2968675b413e
child 2368
e7ad5f6f4d29
permissions
-rw-r--r--

Merge

duke@435 1 #
stefank@2314 2 # Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 #
duke@435 5 # This code is free software; you can redistribute it and/or modify it
duke@435 6 # under the terms of the GNU General Public License version 2 only, as
duke@435 7 # published by the Free Software Foundation.
duke@435 8 #
duke@435 9 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 # version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 # accompanied this code).
duke@435 14 #
duke@435 15 # You should have received a copy of the GNU General Public License version
duke@435 16 # 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 #
trims@1907 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 # or visit www.oracle.com if you need additional information or have any
trims@1907 21 # questions.
duke@435 22 #
duke@435 23 #
duke@435 24
duke@435 25 # Rules to build JVM and related libraries, included from vm.make in the build
duke@435 26 # directory.
duke@435 27
duke@435 28 # Common build rules.
kamg@526 29 MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
duke@435 30 include $(MAKEFILES_DIR)/rules.make
duke@435 31
duke@435 32 default: build
duke@435 33
duke@435 34 #----------------------------------------------------------------------
duke@435 35 # Defs
duke@435 36
duke@435 37 GENERATED = ../generated
stefank@2314 38 DEP_DIR = $(GENERATED)/dependencies
duke@435 39
stefank@2314 40 # reads the generated files defining the set of .o's and the .o .h dependencies
stefank@2314 41 -include $(DEP_DIR)/*.d
duke@435 42
duke@435 43 # read machine-specific adjustments (%%% should do this via buildtree.make?)
duke@435 44 include $(MAKEFILES_DIR)/$(BUILDARCH).make
duke@435 45
duke@435 46 # set VPATH so make knows where to look for source files
stefank@2314 47 # Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
duke@435 48 # The adfiles directory contains ad_<arch>.[ch]pp.
duke@435 49 # The jvmtifiles directory contains jvmti*.[ch]pp
stefank@2314 50 Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles
stefank@2314 51 VPATH += $(Src_Dirs_V:%=%:)
duke@435 52
duke@435 53 # set INCLUDES for C preprocessor
stefank@2314 54 Src_Dirs_I += $(GENERATED)
duke@435 55 INCLUDES += $(Src_Dirs_I:%=-I%)
duke@435 56
duke@435 57 ifeq (${VERSION}, debug)
duke@435 58 SYMFLAG = -g
duke@435 59 else
duke@435 60 SYMFLAG =
duke@435 61 endif
duke@435 62
duke@435 63 # The following variables are defined in the generated flags.make file.
duke@435 64 BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
duke@435 65 JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
jrose@535 66 HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
duke@435 67 BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
duke@435 68 BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
duke@435 69 VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
duke@435 70
duke@435 71 CPPFLAGS = \
duke@435 72 ${SYSDEFS} \
duke@435 73 ${INCLUDES} \
duke@435 74 ${BUILD_VERSION} \
duke@435 75 ${BUILD_TARGET} \
duke@435 76 ${BUILD_USER} \
jrose@535 77 ${HS_LIB_ARCH} \
duke@435 78 ${JRE_VERSION} \
duke@435 79 ${VM_DISTRO}
duke@435 80
duke@435 81 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
duke@435 82 CFLAGS += $(CFLAGS_WARN)
duke@435 83
duke@435 84 # Do not use C++ exception handling
duke@435 85 CFLAGS += $(CFLAGS/NOEX)
duke@435 86
duke@435 87 # Extra flags from gnumake's invocation or environment
duke@435 88 CFLAGS += $(EXTRA_CFLAGS)
duke@435 89
duke@435 90 # Math Library (libm.so), do not use -lm.
duke@435 91 # There might be two versions of libm.so on the build system:
duke@435 92 # libm.so.1 and libm.so.2, and we want libm.so.1.
duke@435 93 # Depending on the Solaris release being used to build with,
duke@435 94 # /usr/lib/libm.so could point at a libm.so.2, so we are
duke@435 95 # explicit here so that the libjvm.so you have built will work on an
duke@435 96 # older Solaris release that might not have libm.so.2.
duke@435 97 # This is a critical factor in allowing builds on Solaris 10 or newer
duke@435 98 # to run on Solaris 8 or 9.
duke@435 99 #
duke@435 100 LIBM=/usr/lib$(ISA_DIR)/libm.so.1
duke@435 101
duke@435 102 ifeq ("${Platform_compiler}", "sparcWorks")
duke@435 103 # The whole megilla:
kvn@865 104 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1)
duke@435 105 # Old Comment: List the libraries in the order the compiler was designed for
duke@435 106 # Not sure what the 'designed for' comment is referring too above.
duke@435 107 # The order may not be too significant anymore, but I have placed this
duke@435 108 # older libm before libCrun, just to make sure it's found and used first.
zgu@2364 109 LIBS += -lsocket -lsched -ldl $(LIBM) -lCrun -lthread -ldoor -lc -ldemangle
duke@435 110 else
phh@1558 111 ifeq ($(COMPILER_REV_NUMERIC), 502)
phh@1558 112 # SC6.1 has it's own libm.so: specifying anything else provokes a name conflict.
zgu@2364 113 LIBS += -ldl -lthread -lsocket -lm -lsched -ldoor -ldemangle
phh@1558 114 else
zgu@2364 115 LIBS += -ldl -lthread -lsocket $(LIBM) -lsched -ldoor -ldemangle
phh@1558 116 endif # 502
phh@1558 117 endif # 505
duke@435 118 else
zgu@2364 119 LIBS += -lsocket -lsched -ldl $(LIBM) -lthread -lc -ldemangle
phh@1558 120 endif # sparcWorks
duke@435 121
duke@435 122 # By default, link the *.o into the library, not the executable.
duke@435 123 LINK_INTO$(LINK_INTO) = LIBJVM
duke@435 124
duke@435 125 JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH)
duke@435 126
duke@435 127 #----------------------------------------------------------------------
duke@435 128 # jvm_db & dtrace
duke@435 129 include $(MAKEFILES_DIR)/dtrace.make
duke@435 130
duke@435 131 #----------------------------------------------------------------------
duke@435 132 # JVM
duke@435 133
phh@1558 134 JVM = jvm
phh@1558 135 LIBJVM = lib$(JVM).so
phh@1558 136 LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
duke@435 137
stefank@2314 138 CORE_PATHS := $(shell find $(GAMMADIR)/src/share/vm/* -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \))
stefank@2314 139 CORE_PATHS += $(GAMMADIR)/src/os/$(Platform_os_family)/vm
stefank@2314 140 CORE_PATHS += $(GAMMADIR)/src/cpu/$(Platform_arch)/vm
stefank@2314 141 CORE_PATHS += $(GAMMADIR)/src/os_cpu/$(Platform_os_arch)/vm
stefank@2314 142 CORE_PATHS += $(GENERATED)/jvmtifiles
stefank@2314 143
stefank@2314 144 COMPILER1_PATHS := $(GAMMADIR)/src/share/vm/c1
stefank@2314 145
stefank@2314 146 COMPILER2_PATHS := $(GAMMADIR)/src/share/vm/opto
stefank@2314 147 COMPILER2_PATHS += $(GAMMADIR)/src/share/vm/libadt
stefank@2314 148 COMPILER2_PATHS += $(GENERATED)/adfiles
stefank@2314 149
stefank@2314 150 # Include dirs per type.
stefank@2314 151 Src_Dirs/CORE := $(CORE_PATHS)
stefank@2314 152 Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS)
stefank@2314 153 Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS)
stefank@2314 154 Src_Dirs/TIERED := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS)
stefank@2314 155 Src_Dirs/ZERO := $(CORE_PATHS)
stefank@2314 156 Src_Dirs/SHARK := $(CORE_PATHS)
stefank@2314 157 Src_Dirs := $(Src_Dirs/$(TYPE))
stefank@2314 158
stefank@2314 159 COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp chaitin\* c2_\* runtime_\*
stefank@2314 160 COMPILER1_SPECIFIC_FILES := c1_\*
stefank@2314 161 SHARK_SPECIFIC_FILES := shark
stefank@2314 162 ZERO_SPECIFIC_FILES := zero
stefank@2314 163
stefank@2314 164 # Always exclude these.
stefank@2314 165 Src_Files_EXCLUDE := dtrace jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
stefank@2314 166
stefank@2314 167 # Exclude per type.
stefank@2314 168 Src_Files_EXCLUDE/CORE := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
stefank@2314 169 Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
stefank@2314 170 Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES)
stefank@2314 171 Src_Files_EXCLUDE/TIERED := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES)
stefank@2314 172 Src_Files_EXCLUDE/ZERO := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
stefank@2314 173 Src_Files_EXCLUDE/SHARK := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES)
stefank@2314 174
stefank@2314 175 Src_Files_EXCLUDE += $(Src_Files_EXCLUDE/$(TYPE))
stefank@2314 176
stefank@2314 177 # Special handling of arch model.
stefank@2314 178 ifeq ($(Platform_arch_model), x86_32)
stefank@2314 179 Src_Files_EXCLUDE += \*x86_64\*
stefank@2314 180 endif
stefank@2314 181 ifeq ($(Platform_arch_model), x86_64)
stefank@2314 182 Src_Files_EXCLUDE += \*x86_32\*
stefank@2314 183 endif
stefank@2314 184
stefank@2314 185 # Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE.
stefank@2314 186 define findsrc
stefank@2314 187 $(notdir $(shell find $(1) \( -name \*.c -o -name \*.cpp -o -name \*.s \) -a \! \( -name DUMMY $(addprefix -o -name ,$(Src_Files_EXCLUDE)) \) ))
stefank@2314 188 endef
stefank@2314 189
stefank@2314 190 Src_Files := $(foreach e,$(Src_Dirs),$(call findsrc,$(e)))
stefank@2314 191
stefank@2326 192 Obj_Files = $(sort $(addsuffix .o,$(basename $(Src_Files))))
stefank@2314 193
duke@435 194 JVM_OBJ_FILES = $(Obj_Files) $(DTRACE_OBJS)
duke@435 195
duke@435 196 vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES))
duke@435 197
duke@435 198 mapfile : $(MAPFILE) $(MAPFILE_DTRACE_OPT)
duke@435 199 rm -f $@
duke@435 200 cat $^ > $@
duke@435 201
duke@435 202 mapfile_reorder : mapfile $(MAPFILE_DTRACE_OPT) $(REORDERFILE)
duke@435 203 rm -f $@
duke@435 204 cat $^ > $@
duke@435 205
duke@435 206 ifeq ($(LINK_INTO),AOUT)
duke@435 207 LIBJVM.o =
duke@435 208 LIBJVM_MAPFILE =
duke@435 209 LIBS_VM = $(LIBS)
duke@435 210 else
duke@435 211 LIBJVM.o = $(JVM_OBJ_FILES)
duke@435 212 LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder
duke@435 213 LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE))
duke@435 214 LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM))
duke@435 215 ifndef USE_GCC
duke@435 216 LIBS_VM = $(LIBS)
duke@435 217 else
duke@435 218 # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to
duke@435 219 # get around library dependency and compatibility issues. Must use gcc not
duke@435 220 # g++ to link.
duke@435 221 LFLAGS_VM += $(STATIC_LIBGCC)
duke@435 222 LIBS_VM += $(STATIC_STDCXX) $(LIBS)
duke@435 223 endif
duke@435 224 endif
duke@435 225
duke@435 226 ifdef USE_GCC
duke@435 227 LINK_VM = $(LINK_LIB.c)
duke@435 228 else
duke@435 229 LINK_VM = $(LINK_LIB.CC)
duke@435 230 endif
duke@435 231 # making the library:
duke@435 232 $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE)
jcoomes@1902 233 ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
jcoomes@1902 234 @echo Linking vm...
jcoomes@1902 235 $(QUIETLY) $(LINK_LIB.CC/PRE_HOOK)
jcoomes@1902 236 $(QUIETLY) $(LINK_VM) $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM)
jcoomes@1902 237 $(QUIETLY) $(LINK_LIB.CC/POST_HOOK)
jcoomes@1902 238 $(QUIETLY) rm -f $@.1 && ln -s $@ $@.1
jcoomes@1902 239 $(QUIETLY) [ -f $(LIBJVM_G) ] || ln -s $@ $(LIBJVM_G)
jcoomes@1902 240 $(QUIETLY) [ -f $(LIBJVM_G).1 ] || ln -s $@.1 $(LIBJVM_G).1
jcoomes@1902 241 endif # filter -sbfast -xsbfast
jcoomes@1902 242
duke@435 243
duke@435 244 DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM)
duke@435 245
duke@435 246 install_jvm: $(LIBJVM)
duke@435 247 @echo "Copying $(LIBJVM) to $(DEST_JVM)"
duke@435 248 $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done"
duke@435 249
duke@435 250 #----------------------------------------------------------------------
duke@435 251 # Other files
duke@435 252
duke@435 253 # Gamma launcher
duke@435 254 include $(MAKEFILES_DIR)/launcher.make
duke@435 255
duke@435 256 # Signal interposition library
duke@435 257 include $(MAKEFILES_DIR)/jsig.make
duke@435 258
duke@435 259 # Serviceability agent
duke@435 260 include $(MAKEFILES_DIR)/saproc.make
duke@435 261
duke@435 262 #----------------------------------------------------------------------
duke@435 263
stefank@2314 264 build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck
duke@435 265
duke@435 266 install: install_jvm install_jsig install_saproc
duke@435 267
duke@435 268 .PHONY: default build install install_jvm

mercurial