make/linux/makefiles/vm.make

Wed, 14 Oct 2020 17:44:48 +0800

author
aoqi
date
Wed, 14 Oct 2020 17:44:48 +0800
changeset 9931
fd44df5e3bc3
parent 9852
70aa912cebe5
parent 9896
1b8c45b8216a
child 10015
eb7ce841ccec
permissions
-rw-r--r--

Merge

duke@435 1 #
andrew@9634 2 # Copyright (c) 1999, 2019, 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.
sla@5237 22 #
duke@435 23 #
duke@435 24
aoqi@1 25 #
aoqi@9137 26 # This file has been modified by Loongson Technology in 2018. These
aoqi@9137 27 # modifications are Copyright (c) 2018 Loongson Technology, and are made
aoqi@1 28 # available on the same license terms set forth above.
aoqi@1 29 #
aoqi@1 30
duke@435 31 # Rules to build JVM and related libraries, included from vm.make in the build
duke@435 32 # directory.
duke@435 33
duke@435 34 # Common build rules.
kamg@526 35 MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
duke@435 36 include $(MAKEFILES_DIR)/rules.make
kamg@2515 37 include $(GAMMADIR)/make/altsrc.make
duke@435 38
duke@435 39 default: build
duke@435 40
duke@435 41 #----------------------------------------------------------------------
duke@435 42 # Defs
duke@435 43
duke@435 44 GENERATED = ../generated
stefank@2314 45 DEP_DIR = $(GENERATED)/dependencies
duke@435 46
stefank@2314 47 # reads the generated files defining the set of .o's and the .o .h dependencies
stefank@2314 48 -include $(DEP_DIR)/*.d
duke@435 49
duke@435 50 # read machine-specific adjustments (%%% should do this via buildtree.make?)
erikj@3649 51 ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
never@1445 52 include $(MAKEFILES_DIR)/zeroshark.make
never@1445 53 else
dlong@7598 54 BUILDARCH_MAKE = $(MAKEFILES_DIR)/$(BUILDARCH).make
dlong@7598 55 ALT_BUILDARCH_MAKE = $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/$(BUILDARCH).make
dlong@7598 56 include $(if $(wildcard $(ALT_BUILDARCH_MAKE)),$(ALT_BUILDARCH_MAKE),$(BUILDARCH_MAKE))
never@1445 57 endif
duke@435 58
duke@435 59 # set VPATH so make knows where to look for source files
stefank@2314 60 # Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
duke@435 61 # The adfiles directory contains ad_<arch>.[ch]pp.
duke@435 62 # The jvmtifiles directory contains jvmti*.[ch]pp
apetushkov@9858 63 Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles $(GENERATED)/jfrfiles
stefank@2314 64 VPATH += $(Src_Dirs_V:%=%:)
duke@435 65
stefank@2314 66 # set INCLUDES for C preprocessor.
stefank@2314 67 Src_Dirs_I += $(GENERATED)
stefank@2314 68 # The order is important for the precompiled headers to work.
stefank@2314 69 INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%)
duke@435 70
dcubed@3150 71 # SYMFLAG is used by {jsig,saproc}.make
dcubed@3724 72 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
dcubed@3150 73 # always build with debug info when we can create .debuginfo files
duke@435 74 SYMFLAG = -g
duke@435 75 else
dcubed@3150 76 ifeq (${VERSION}, debug)
dcubed@3150 77 SYMFLAG = -g
dcubed@3150 78 else
dcubed@3150 79 SYMFLAG =
dcubed@3150 80 endif
duke@435 81 endif
duke@435 82
sla@5237 83 # HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
duke@435 84 # in $(GAMMADIR)/make/defs.make
duke@435 85 ifeq ($(HOTSPOT_BUILD_VERSION),)
duke@435 86 BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
duke@435 87 else
duke@435 88 BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
duke@435 89 endif
duke@435 90
duke@435 91 # The following variables are defined in the generated flags.make file.
duke@435 92 BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
duke@435 93 JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
jrose@535 94 HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
duke@435 95 BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
duke@435 96 BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
duke@435 97 VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
duke@435 98
erikj@3518 99 CXXFLAGS = \
duke@435 100 ${SYSDEFS} \
duke@435 101 ${INCLUDES} \
duke@435 102 ${BUILD_VERSION} \
duke@435 103 ${BUILD_TARGET} \
duke@435 104 ${BUILD_USER} \
jrose@535 105 ${HS_LIB_ARCH} \
duke@435 106 ${VM_DISTRO}
duke@435 107
aoqi@1 108 ifeq ($(MIPS_ABI),n32)
aoqi@1 109 CXXFLAGS += -DN32
aoqi@1 110 else
aoqi@1 111 ifeq ($(MIPS_ABI),n64)
aoqi@1 112 CXXFLAGS += -DN64
aoqi@1 113 endif
aoqi@1 114 endif
ohrstrom@3517 115 # This is VERY important! The version define must only be supplied to vm_version.o
ohrstrom@3517 116 # If not, ccache will not re-use the cache at all, since the version string might contain
sla@5237 117 # a time and date.
aoqi@9137 118 ifdef LOONGSON_RUNTIME_NAME
aoqi@9137 119 LOONGSON_VM_INFO = -DLOONGSON_RUNTIME_NAME="\"$(LOONGSON_RUNTIME_NAME)\""
aoqi@9137 120 else
aoqi@9137 121 LOONGSON_VM_INFO = -DLOONGSON_RUNTIME_NAME="\"\""
aoqi@9137 122 endif
aoqi@9137 123 CXXFLAGS/vmError.o += ${LOONGSON_VM_INFO}
andrew@9634 124 CXXFLAGS/vm_version.o += ${JRE_VERSION} ${VERSION_CFLAGS}
andrew@9634 125 CXXFLAGS/arguments.o += ${VERSION_CFLAGS}
mikael@4602 126
mikael@4602 127 CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
mikael@4602 128
mikael@4602 129 # File specific flags
mikael@4602 130 CXXFLAGS += $(CXXFLAGS/BYFILE)
mikael@4602 131
tamao@5309 132 # Large File Support
tamao@5309 133 ifneq ($(LP64), 1)
tamao@5309 134 CXXFLAGS/ostream.o += -D_FILE_OFFSET_BITS=64
tamao@5309 135 endif # ifneq ($(LP64), 1)
ohrstrom@3517 136
duke@435 137 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
duke@435 138 CFLAGS += $(CFLAGS_WARN/BYFILE)
duke@435 139
duke@435 140 # Do not use C++ exception handling
duke@435 141 CFLAGS += $(CFLAGS/NOEX)
duke@435 142
duke@435 143 # Extra flags from gnumake's invocation or environment
duke@435 144 CFLAGS += $(EXTRA_CFLAGS)
sgehwolf@9330 145 LFLAGS += $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS)
sgehwolf@9819 146 ASFLAGS += $(EXTRA_ASFLAGS)
duke@435 147
dsamersoff@2837 148 # Don't set excutable bit on stack segment
dsamersoff@2837 149 # the same could be done by separate execstack command
dsamersoff@2837 150 LFLAGS += -Xlinker -z -Xlinker noexecstack
dsamersoff@2837 151
duke@435 152 LIBS += -lm -ldl -lpthread
duke@435 153
duke@435 154 # By default, link the *.o into the library, not the executable.
duke@435 155 LINK_INTO$(LINK_INTO) = LIBJVM
duke@435 156
duke@435 157 JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH)
duke@435 158
duke@435 159 #----------------------------------------------------------------------
duke@435 160 # jvm_db & dtrace
duke@435 161 include $(MAKEFILES_DIR)/dtrace.make
duke@435 162
duke@435 163 #----------------------------------------------------------------------
duke@435 164 # JVM
duke@435 165
phh@1558 166 JVM = jvm
phh@1558 167 LIBJVM = lib$(JVM).so
duke@435 168
dcubed@3150 169 LIBJVM_DEBUGINFO = lib$(JVM).debuginfo
dcubed@3724 170 LIBJVM_DIZ = lib$(JVM).diz
dcubed@3150 171
apetushkov@9858 172 ifeq ($(ENABLE_JFR),false)
apetushkov@9858 173 EXCLUDE_JFR_PATHS:= -o -name jfr -prune
apetushkov@9858 174 endif
kamg@2515 175 SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt
stefank@2314 176
kamg@2515 177 SOURCE_PATHS=\
kamg@2515 178 $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \
apetushkov@9858 179 \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) $(EXCLUDE_JFR_PATHS) \))
kamg@2515 180 SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm
kamg@2515 181 SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
kamg@2515 182 SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
kamg@2515 183 SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
stefank@2314 184
sla@5237 185 CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
apetushkov@9858 186 CORE_PATHS+=$(GENERATED)/jvmtifiles $(GENERATED)/jfrfiles
kamg@2515 187
kamg@2515 188 COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1)
kamg@2515 189 COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1
kamg@2515 190
kamg@2515 191 COMPILER2_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/opto)
kamg@2515 192 COMPILER2_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/libadt)
kamg@2515 193 COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/opto
kamg@2515 194 COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt
kamg@2515 195 COMPILER2_PATHS += $(GENERATED)/adfiles
stefank@2314 196
dholmes@2752 197 SHARK_PATHS := $(GAMMADIR)/src/share/vm/shark
dholmes@2752 198
stefank@2314 199 # Include dirs per type.
stefank@2314 200 Src_Dirs/CORE := $(CORE_PATHS)
stefank@2314 201 Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS)
stefank@2314 202 Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS)
stefank@2314 203 Src_Dirs/TIERED := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS)
stefank@2314 204 Src_Dirs/ZERO := $(CORE_PATHS)
dholmes@2752 205 Src_Dirs/SHARK := $(CORE_PATHS) $(SHARK_PATHS)
stefank@2314 206 Src_Dirs := $(Src_Dirs/$(TYPE))
stefank@2314 207
neliasso@4949 208 COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp c2_\* runtime_\*
stefank@2314 209 COMPILER1_SPECIFIC_FILES := c1_\*
stefank@2314 210 SHARK_SPECIFIC_FILES := shark
stefank@2314 211 ZERO_SPECIFIC_FILES := zero
stefank@2314 212
stefank@2314 213 # Always exclude these.
jprovino@4165 214 Src_Files_EXCLUDE += jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
stefank@2314 215
stefank@2314 216 # Exclude per type.
stefank@2314 217 Src_Files_EXCLUDE/CORE := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
stefank@2314 218 Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
stefank@2314 219 Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES)
stefank@2314 220 Src_Files_EXCLUDE/TIERED := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES)
stefank@2314 221 Src_Files_EXCLUDE/ZERO := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
stefank@2314 222 Src_Files_EXCLUDE/SHARK := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES)
stefank@2314 223
stefank@2314 224 Src_Files_EXCLUDE += $(Src_Files_EXCLUDE/$(TYPE))
stefank@2314 225
stefank@2314 226 # Special handling of arch model.
stefank@2314 227 ifeq ($(Platform_arch_model), x86_32)
stefank@2314 228 Src_Files_EXCLUDE += \*x86_64\*
stefank@2314 229 endif
stefank@2314 230 ifeq ($(Platform_arch_model), x86_64)
stefank@2314 231 Src_Files_EXCLUDE += \*x86_32\*
stefank@2314 232 endif
aoqi@1 233 ifeq ($(Platform_arch_model), mips_32)
aoqi@1 234 Src_Files_EXCLUDE += \*mips_64\*
aoqi@1 235 endif
aoqi@1 236 ifeq ($(Platform_arch_model), mips_64)
aoqi@1 237 Src_Files_EXCLUDE += \*mips_32\*
aoqi@1 238 endif
stefank@2314 239
dholmes@5442 240 # Alternate vm.make
dholmes@5442 241 # This has to be included here to allow changes to the source
dholmes@5442 242 # directories and excluded files before they are expanded
dholmes@5442 243 # by the definition of Src_Files.
dholmes@5442 244 -include $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/vm.make
dholmes@5442 245
stefank@2314 246 # Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE.
stefank@2314 247 define findsrc
stefank@2368 248 $(notdir $(shell find $(1)/. ! -name . -prune \
stefank@2368 249 -a \( -name \*.c -o -name \*.cpp -o -name \*.s \) \
stefank@2368 250 -a ! \( -name DUMMY $(addprefix -o -name ,$(Src_Files_EXCLUDE)) \)))
stefank@2314 251 endef
stefank@2314 252
stefank@2314 253 Src_Files := $(foreach e,$(Src_Dirs),$(call findsrc,$(e)))
stefank@2314 254
stefank@2326 255 Obj_Files = $(sort $(addsuffix .o,$(basename $(Src_Files))))
stefank@2314 256
duke@435 257 JVM_OBJ_FILES = $(Obj_Files)
duke@435 258
duke@435 259 vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES))
duke@435 260
jwilhelm@7059 261 mapfile : $(MAPFILE) vm.def mapfile_ext
duke@435 262 rm -f $@
never@1729 263 awk '{ if ($$0 ~ "INSERT VTABLE SYMBOLS HERE") \
jwilhelm@7059 264 { system ("cat mapfile_ext"); system ("cat vm.def"); } \
never@1729 265 else \
never@1729 266 { print $$0 } \
never@1729 267 }' > $@ < $(MAPFILE)
duke@435 268
duke@435 269 mapfile_reorder : mapfile $(REORDERFILE)
duke@435 270 rm -f $@
duke@435 271 cat $^ > $@
duke@435 272
dlong@7573 273 VMDEF_PAT = ^_ZTV
dlong@7573 274 VMDEF_PAT := ^gHotSpotVM|$(VMDEF_PAT)
dlong@7573 275 VMDEF_PAT := ^UseSharedSpaces$$|$(VMDEF_PAT)
dlong@7573 276 VMDEF_PAT := ^_ZN9Arguments17SharedArchivePathE$$|$(VMDEF_PAT)
dlong@7573 277
never@1729 278 vm.def: $(Res_Files) $(Obj_Files)
dlong@7573 279 $(QUIETLY) $(NM) --defined-only $(Obj_Files) | sort -k3 -u | \
dlong@7573 280 awk '$$3 ~ /$(VMDEF_PAT)/ { print "\t" $$3 ";" }' > $@
never@1729 281
jwilhelm@7059 282 mapfile_ext:
jwilhelm@7059 283 rm -f $@
jwilhelm@7059 284 touch $@
jwilhelm@7059 285 if [ -f $(HS_ALT_MAKE)/linux/makefiles/mapfile-ext ]; then \
jwilhelm@7059 286 cat $(HS_ALT_MAKE)/linux/makefiles/mapfile-ext > $@; \
jwilhelm@7059 287 fi
jwilhelm@7059 288
erikj@3649 289 ifeq ($(JVM_VARIANT_ZEROSHARK), true)
never@1445 290 STATIC_CXX = false
never@1445 291 else
twisti@2047 292 ifeq ($(ZERO_LIBARCH), ppc64)
twisti@2047 293 STATIC_CXX = false
twisti@2047 294 else
twisti@2047 295 STATIC_CXX = true
twisti@2047 296 endif
never@1445 297 endif
duke@435 298
duke@435 299 ifeq ($(LINK_INTO),AOUT)
duke@435 300 LIBJVM.o =
duke@435 301 LIBJVM_MAPFILE =
duke@435 302 LIBS_VM = $(LIBS)
duke@435 303 else
duke@435 304 LIBJVM.o = $(JVM_OBJ_FILES)
duke@435 305 LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder
duke@435 306 LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE))
duke@435 307 LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM))
duke@435 308
duke@435 309 # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to
duke@435 310 # get around library dependency and compatibility issues. Must use gcc not
duke@435 311 # g++ to link.
duke@435 312 ifeq ($(STATIC_CXX), true)
duke@435 313 LFLAGS_VM += $(STATIC_LIBGCC)
duke@435 314 LIBS_VM += $(STATIC_STDCXX)
duke@435 315 else
duke@435 316 LIBS_VM += -lstdc++
duke@435 317 endif
duke@435 318
duke@435 319 LIBS_VM += $(LIBS)
duke@435 320 endif
erikj@3649 321 ifeq ($(JVM_VARIANT_ZERO), true)
never@1445 322 LIBS_VM += $(LIBFFI_LIBS)
never@1445 323 endif
erikj@3649 324 ifeq ($(JVM_VARIANT_ZEROSHARK), true)
erikj@3649 325 LIBS_VM += $(LIBFFI_LIBS) $(LLVM_LIBS)
twisti@2047 326 LFLAGS_VM += $(LLVM_LDFLAGS)
twisti@2047 327 endif
duke@435 328
erikj@3518 329 LINK_VM = $(LINK_LIB.CC)
duke@435 330
duke@435 331 # rule for building precompiled header
stefank@2314 332 $(PRECOMPILED_HEADER):
duke@435 333 $(QUIETLY) echo Generating precompiled header $@
stefank@2314 334 $(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
erikj@3518 335 $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
duke@435 336
duke@435 337 # making the library:
duke@435 338
duke@435 339 ifneq ($(JVM_BASE_ADDR),)
duke@435 340 # By default shared library is linked at base address == 0. Modify the
duke@435 341 # linker script if JVM prefers a different base location. It can also be
duke@435 342 # implemented with 'prelink -r'. But 'prelink' is not (yet) available on
duke@435 343 # our build platform (AS-2.1).
duke@435 344 LD_SCRIPT = libjvm.so.lds
duke@435 345 $(LD_SCRIPT): $(LIBJVM_MAPFILE)
duke@435 346 $(QUIETLY) { \
duke@435 347 rm -rf $@; \
duke@435 348 $(LINK_VM) -Wl,--verbose $(LFLAGS_VM) 2>&1 | \
duke@435 349 sed -e '/^======/,/^======/!d' \
duke@435 350 -e '/^======/d' \
duke@435 351 -e 's/0\( + SIZEOF_HEADERS\)/$(JVM_BASE_ADDR)\1/' \
duke@435 352 > $@; \
duke@435 353 }
duke@435 354 LD_SCRIPT_FLAG = -Wl,-T,$(LD_SCRIPT)
duke@435 355 endif
duke@435 356
duke@435 357 # With more recent Redhat releases (or the cutting edge version Fedora), if
duke@435 358 # SELinux is configured to be enabled, the runtime linker will fail to apply
duke@435 359 # the text relocation to libjvm.so considering that it is built as a non-PIC
sla@5237 360 # DSO. To workaround that, we run chcon to libjvm.so after it is built. See
duke@435 361 # details in bug 6538311.
duke@435 362 $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT)
duke@435 363 $(QUIETLY) { \
duke@435 364 echo Linking vm...; \
erikj@3518 365 $(LINK_LIB.CXX/PRE_HOOK) \
duke@435 366 $(LINK_VM) $(LD_SCRIPT_FLAG) \
ohair@4087 367 $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \
erikj@3518 368 $(LINK_LIB.CXX/POST_HOOK) \
duke@435 369 rm -f $@.1; ln -s $@ $@.1; \
bobv@2036 370 if [ \"$(CROSS_COMPILE_ARCH)\" = \"\" ] ; then \
bobv@2036 371 if [ -x /usr/sbin/selinuxenabled ] ; then \
bobv@2036 372 /usr/sbin/selinuxenabled; \
bobv@2036 373 if [ $$? = 0 ] ; then \
bobv@2036 374 /usr/bin/chcon -t textrel_shlib_t $@; \
bobv@2036 375 if [ $$? != 0 ]; then \
bobv@2036 376 echo "ERROR: Cannot chcon $@"; \
bobv@2036 377 fi \
bobv@2036 378 fi \
bobv@2036 379 fi \
bobv@2036 380 fi \
duke@435 381 }
dholmes@4243 382
dholmes@4243 383 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
sgehwolf@9357 384 ifneq ($(STRIP_POLICY),no_strip)
dcubed@3150 385 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
sgehwolf@9357 386 $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
sgehwolf@9357 387 endif
sgehwolf@9346 388 ifeq ($(STRIP_POLICY),all_strip)
dcubed@3150 389 $(QUIETLY) $(STRIP) $@
dholmes@4243 390 else
dholmes@4243 391 ifeq ($(STRIP_POLICY),min_strip)
dcubed@3150 392 $(QUIETLY) $(STRIP) -g $@
sgehwolf@9346 393 endif
dholmes@4243 394 # implied else here is no stripping at all
dholmes@4243 395 endif
sgehwolf@9357 396 ifneq ($(STRIP_POLICY),no_strip)
sgehwolf@9357 397 ifeq ($(ZIP_DEBUGINFO_FILES),1)
dcubed@4344 398 $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO)
dcubed@4344 399 $(RM) $(LIBJVM_DEBUGINFO)
sgehwolf@9357 400 endif
dcubed@3150 401 endif
dcubed@3150 402 endif
duke@435 403
dcubed@3150 404 DEST_SUBDIR = $(JDK_LIBDIR)/$(VM_SUBDIR)
dcubed@3150 405 DEST_JVM = $(DEST_SUBDIR)/$(LIBJVM)
dcubed@3150 406 DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO)
dcubed@3724 407 DEST_JVM_DIZ = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
duke@435 408
duke@435 409 install_jvm: $(LIBJVM)
duke@435 410 @echo "Copying $(LIBJVM) to $(DEST_JVM)"
dcubed@3150 411 $(QUIETLY) test -f $(LIBJVM_DEBUGINFO) && \
dcubed@3150 412 cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO)
dcubed@3724 413 $(QUIETLY) test -f $(LIBJVM_DIZ) && \
dcubed@3724 414 cp -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ)
duke@435 415 $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done"
duke@435 416
duke@435 417 #----------------------------------------------------------------------
duke@435 418 # Other files
duke@435 419
duke@435 420 # Signal interposition library
duke@435 421 include $(MAKEFILES_DIR)/jsig.make
duke@435 422
duke@435 423 # Serviceability agent
duke@435 424 include $(MAKEFILES_DIR)/saproc.make
duke@435 425
duke@435 426 #----------------------------------------------------------------------
duke@435 427
mgerdin@4637 428 build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck
duke@435 429
duke@435 430 install: install_jvm install_jsig install_saproc
duke@435 431
dholmes@5442 432 .PHONY: default build install install_jvm $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/$(BUILDARCH).make $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/vm.make

mercurial