|
1 # |
|
2 # Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
|
3 # Copyright 2012, 2013 SAP AG. All rights reserved. |
|
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
5 # |
|
6 # This code is free software; you can redistribute it and/or modify it |
|
7 # under the terms of the GNU General Public License version 2 only, as |
|
8 # published by the Free Software Foundation. |
|
9 # |
|
10 # This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 # version 2 for more details (a copy is included in the LICENSE file that |
|
14 # accompanied this code). |
|
15 # |
|
16 # You should have received a copy of the GNU General Public License version |
|
17 # 2 along with this work; if not, write to the Free Software Foundation, |
|
18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 # |
|
20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 # or visit www.oracle.com if you need additional information or have any |
|
22 # questions. |
|
23 # |
|
24 # |
|
25 include $(GAMMADIR)/make/defs.make |
|
26 |
|
27 # Rules to build serviceability agent library, used by vm.make |
|
28 |
|
29 # libsaproc.so: serviceability agent |
|
30 |
|
31 SAPROC = saproc |
|
32 LIBSAPROC = lib$(SAPROC).so |
|
33 |
|
34 LIBSAPROC_DEBUGINFO = lib$(SAPROC).debuginfo |
|
35 LIBSAPROC_DIZ = lib$(SAPROC).diz |
|
36 |
|
37 AGENT_DIR = $(GAMMADIR)/agent |
|
38 |
|
39 SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family) |
|
40 |
|
41 SASRCFILES = $(SASRCDIR)/salibelf.c \ |
|
42 $(SASRCDIR)/symtab.c \ |
|
43 $(SASRCDIR)/libproc_impl.c \ |
|
44 $(SASRCDIR)/ps_proc.c \ |
|
45 $(SASRCDIR)/ps_core.c \ |
|
46 $(SASRCDIR)/LinuxDebuggerLocal.c \ |
|
47 |
|
48 SAMAPFILE = $(SASRCDIR)/mapfile |
|
49 |
|
50 DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC) |
|
51 DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO) |
|
52 DEST_SAPROC_DIZ = $(JDK_LIBDIR)/$(LIBSAPROC_DIZ) |
|
53 |
|
54 # DEBUG_BINARIES overrides everything, use full -g debug information |
|
55 ifeq ($(DEBUG_BINARIES), true) |
|
56 SA_DEBUG_CFLAGS = -g |
|
57 endif |
|
58 |
|
59 # if $(AGENT_DIR) does not exist, we don't build SA |
|
60 # also, we don't build SA on Itanium, PPC, ARM or zero. |
|
61 |
|
62 ifneq ($(wildcard $(AGENT_DIR)),) |
|
63 ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),) |
|
64 BUILDLIBSAPROC = $(LIBSAPROC) |
|
65 endif |
|
66 endif |
|
67 |
|
68 |
|
69 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE) |
|
70 |
|
71 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) |
|
72 $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ |
|
73 echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ |
|
74 exit 1; \ |
|
75 fi |
|
76 @echo Making SA debugger back-end... |
|
77 $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \ |
|
78 -D_FILE_OFFSET_BITS=64 \ |
|
79 $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ |
|
80 $(BIN_UTILS) \ |
|
81 -I$(SASRCDIR) \ |
|
82 -I$(GENERATED) \ |
|
83 -I$(BOOT_JAVA_HOME)/include \ |
|
84 -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \ |
|
85 $(SASRCFILES) \ |
|
86 $(SA_LFLAGS) \ |
|
87 $(SA_DEBUG_CFLAGS) \ |
|
88 -o $@ \ |
|
89 -lthread_db |
|
90 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) |
|
91 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO) |
|
92 $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ |
|
93 ifeq ($(STRIP_POLICY),all_strip) |
|
94 $(QUIETLY) $(STRIP) $@ |
|
95 else |
|
96 ifeq ($(STRIP_POLICY),min_strip) |
|
97 $(QUIETLY) $(STRIP) -g $@ |
|
98 # implied else here is no stripping at all |
|
99 endif |
|
100 endif |
|
101 ifeq ($(ZIP_DEBUGINFO_FILES),1) |
|
102 $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) |
|
103 $(RM) $(LIBSAPROC_DEBUGINFO) |
|
104 endif |
|
105 endif |
|
106 |
|
107 install_saproc: $(BUILDLIBSAPROC) |
|
108 $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \ |
|
109 echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \ |
|
110 test -f $(LIBSAPROC_DEBUGINFO) && \ |
|
111 cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \ |
|
112 test -f $(LIBSAPROC_DIZ) && \ |
|
113 cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \ |
|
114 cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ |
|
115 fi |
|
116 |
|
117 .PHONY: install_saproc |