make/linux/makefiles/saproc.make

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

author
aoqi
date
Wed, 14 Oct 2020 17:44:48 +0800
changeset 9931
fd44df5e3bc3
parent 9637
eef07cd490d4
permissions
-rw-r--r--

Merge

duke@435 1 #
dbuck@9322 2 # Copyright (c) 2005, 2018, 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 #
aoqi@1 24
aoqi@1 25 #
aoqi@9574 26 # This file has been modified by Loongson Technology in 2019. These
aoqi@9574 27 # modifications are Copyright (c) 2018, 2019, Loongson Technology, and are made
aoqi@1 28 # available on the same license terms set forth above.
aoqi@1 29 #
aoqi@1 30
bpittore@4028 31 include $(GAMMADIR)/make/defs.make
bpittore@4028 32 include $(GAMMADIR)/make/altsrc.make
duke@435 33
duke@435 34 # Rules to build serviceability agent library, used by vm.make
duke@435 35
dcubed@4344 36 # libsaproc.so: serviceability agent
phh@1558 37
phh@1558 38 SAPROC = saproc
duke@435 39 LIBSAPROC = lib$(SAPROC).so
duke@435 40
dcubed@3150 41 LIBSAPROC_DEBUGINFO = lib$(SAPROC).debuginfo
dcubed@3724 42 LIBSAPROC_DIZ = lib$(SAPROC).diz
dcubed@3150 43
duke@435 44 AGENT_DIR = $(GAMMADIR)/agent
duke@435 45
duke@435 46 SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)
duke@435 47
duke@435 48 SASRCFILES = $(SASRCDIR)/salibelf.c \
duke@435 49 $(SASRCDIR)/symtab.c \
duke@435 50 $(SASRCDIR)/libproc_impl.c \
duke@435 51 $(SASRCDIR)/ps_proc.c \
duke@435 52 $(SASRCDIR)/ps_core.c \
minqi@4093 53 $(SASRCDIR)/LinuxDebuggerLocal.c \
minqi@4093 54 $(AGENT_DIR)/src/share/native/sadis.c
duke@435 55
bpittore@4028 56 -include $(HS_ALT_MAKE)/linux/makefiles/saproc.make
bpittore@4028 57
duke@435 58 SAMAPFILE = $(SASRCDIR)/mapfile
duke@435 59
dcubed@3150 60 DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
dcubed@3150 61 DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO)
dcubed@3724 62 DEST_SAPROC_DIZ = $(JDK_LIBDIR)/$(LIBSAPROC_DIZ)
duke@435 63
aph@1202 64 # DEBUG_BINARIES overrides everything, use full -g debug information
aph@1202 65 ifeq ($(DEBUG_BINARIES), true)
aph@1202 66 SA_DEBUG_CFLAGS = -g
aph@1202 67 endif
aph@1202 68
sgehwolf@9601 69 # Optimize saproc lib at level -O3 unless it's a slowdebug build
sgehwolf@9601 70 ifneq ($(BUILD_FLAVOR), debug)
sgehwolf@9601 71 SA_OPT_FLAGS = $(OPT_CFLAGS)
sgehwolf@9601 72 endif
sgehwolf@9601 73
duke@435 74 # if $(AGENT_DIR) does not exist, we don't build SA
bpittore@4028 75 # also, we don't build SA on Itanium or zero.
duke@435 76
stefank@2314 77 ifneq ($(wildcard $(AGENT_DIR)),)
bpittore@4028 78 ifneq ($(filter-out ia64 zero,$(SRCARCH)),)
stefank@2314 79 BUILDLIBSAPROC = $(LIBSAPROC)
stefank@2314 80 endif
stefank@2314 81 endif
stefank@2314 82
bpittore@4028 83 ifneq ($(ALT_SASRCDIR),)
dlong@7598 84 ALT_SAINCDIR=-I$(ALT_SASRCDIR) -DALT_SASRCDIR
bpittore@4028 85 else
bpittore@4028 86 ALT_SAINCDIR=
bpittore@4028 87 endif
dbuck@9322 88 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE) \
sgehwolf@9330 89 $(LDFLAGS_NO_EXEC_STACK) $(EXTRA_LDFLAGS)
duke@435 90
aoqi@9574 91 ifneq (mips64, $(findstring mips64, $(BUILDARCH)))
dlong@7598 92 SAARCH ?= $(BUILDARCH)
aoqi@9574 93 else
aoqi@9574 94 #If -Dmips64 is used, mips64 would be conflict with "struct mips64_watch_regs mips64" in /usr/include/asm/ptrace.h.
aoqi@9574 95 SAARCH ?= mips
aoqi@9574 96 endif
dlong@7598 97
duke@435 98 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
duke@435 99 $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
duke@435 100 echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
duke@435 101 exit 1; \
duke@435 102 fi
duke@435 103 @echo Making SA debugger back-end...
dlong@7598 104 $(QUIETLY) $(CC) -D$(SAARCH) -D_GNU_SOURCE \
poonam@3546 105 -D_FILE_OFFSET_BITS=64 \
duke@435 106 $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
duke@435 107 -I$(SASRCDIR) \
duke@435 108 -I$(GENERATED) \
duke@435 109 -I$(BOOT_JAVA_HOME)/include \
duke@435 110 -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \
bpittore@4028 111 $(ALT_SAINCDIR) \
duke@435 112 $(SASRCFILES) \
duke@435 113 $(SA_LFLAGS) \
aph@1202 114 $(SA_DEBUG_CFLAGS) \
sgehwolf@9601 115 $(SA_OPT_FLAGS) \
bpittore@5148 116 $(EXTRA_CFLAGS) \
duke@435 117 -o $@ \
sgehwolf@9486 118 -lthread_db -ldl
dcubed@3724 119 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
sgehwolf@9357 120 ifneq ($(STRIP_POLICY),no_strip)
dcubed@3150 121 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
sgehwolf@9357 122 $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
sgehwolf@9357 123 endif
sgehwolf@9346 124 ifeq ($(STRIP_POLICY),all_strip)
dcubed@3150 125 $(QUIETLY) $(STRIP) $@
dcubed@3150 126 else
dcubed@3150 127 ifeq ($(STRIP_POLICY),min_strip)
dcubed@3150 128 $(QUIETLY) $(STRIP) -g $@
sgehwolf@9346 129 endif
dcubed@3150 130 # implied else here is no stripping at all
dcubed@3150 131 endif
sgehwolf@9357 132 ifneq ($(STRIP_POLICY),no_strip)
sgehwolf@9357 133 ifeq ($(ZIP_DEBUGINFO_FILES),1)
dcubed@4344 134 $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO)
dcubed@4344 135 $(RM) $(LIBSAPROC_DEBUGINFO)
sgehwolf@9357 136 endif
dcubed@3724 137 endif
dcubed@3150 138 endif
duke@435 139
stefank@2314 140 install_saproc: $(BUILDLIBSAPROC)
duke@435 141 $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \
duke@435 142 echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \
dcubed@3150 143 test -f $(LIBSAPROC_DEBUGINFO) && \
dcubed@3150 144 cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \
dcubed@3724 145 test -f $(LIBSAPROC_DIZ) && \
dcubed@3724 146 cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \
duke@435 147 cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \
duke@435 148 fi
duke@435 149
stefank@2314 150 .PHONY: install_saproc

mercurial