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