1 #
2 # Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation.
8 #
9 # This code is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # version 2 for more details (a copy is included in the LICENSE file that
13 # accompanied this code).
14 #
15 # You should have received a copy of the GNU General Public License version
16 # 2 along with this work; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 #
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 # or visit www.oracle.com if you need additional information or have any
21 # questions.
22 #
47 $(SASRCDIR)/symtab.c \
48 $(SASRCDIR)/libproc_impl.c \
49 $(SASRCDIR)/ps_proc.c \
50 $(SASRCDIR)/ps_core.c \
51 $(SASRCDIR)/BsdDebuggerLocal.c \
52 $(AGENT_DIR)/src/share/native/sadis.c
53
54 DARWIN_NON_STUB_SASRCFILES = $(SASRCDIR)/symtab.c \
55 $(SASRCDIR)/libproc_impl.c \
56 $(SASRCDIR)/ps_core.c \
57 $(SASRCDIR)/MacosxDebuggerLocal.m \
58 $(AGENT_DIR)/src/share/native/sadis.c
59
60 ifeq ($(OS_VENDOR), FreeBSD)
61 SASRCFILES = $(BSD_NON_STUB_SASRCFILES)
62 SALIBS = -lutil -lthread_db
63 SAARCH = $(ARCHFLAG)
64 else
65 ifeq ($(OS_VENDOR), Darwin)
66 SASRCFILES = $(DARWIN_NON_STUB_SASRCFILES)
67 SALIBS = -g -framework Foundation -F/System/Library/Frameworks/JavaVM.framework/Frameworks -framework JavaNativeFoundation -framework Security -framework CoreFoundation
68 #objc compiler blows up on -march=i586, perhaps it should not be included in the macosx intel 32-bit C++ compiles?
69 SAARCH = $(subst -march=i586,,$(ARCHFLAG))
70 else
71 SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c
72 SALIBS =
73 SAARCH = $(ARCHFLAG)
74 endif
75 endif
76
77 SAMAPFILE = $(SASRCDIR)/mapfile
78
79 DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
80 DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO)
81 DEST_SAPROC_DIZ = $(JDK_LIBDIR)/$(LIBSAPROC_DIZ)
82
83 # DEBUG_BINARIES overrides everything, use full -g debug information
84 ifeq ($(DEBUG_BINARIES), true)
85 SA_DEBUG_CFLAGS = -g
86 endif
87
88 # if $(AGENT_DIR) does not exist, we don't build SA
89 # also, we don't build SA on Itanium, PPC, ARM or zero.
90
91 ifneq ($(wildcard $(AGENT_DIR)),)
92 ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),)
93 BUILDLIBSAPROC = $(LIBSAPROC)
94 endif
95 endif
96
97
98 ifneq ($(OS_VENDOR), Darwin)
99 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
100 endif
101 SA_LFLAGS += $(LDFLAGS_HASH_STYLE)
102
103 ifeq ($(OS_VENDOR), Darwin)
104 BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
105 -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]") \
106 -I/System/Library/Frameworks/JavaVM.framework/Headers
107 else
108 BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
109 -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]")
110 endif
111
112 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
113 $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
114 echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
115 exit 1; \
116 fi
117 @echo Making SA debugger back-end...
118 $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \
119 $(SYMFLAG) $(SAARCH) $(SHARED_FLAG) $(PICFLAG) \
120 -I$(SASRCDIR) \
121 -I$(GENERATED) \
122 $(BOOT_JAVA_INCLUDES) \
123 $(SASRCFILES) \
124 $(SA_LFLAGS) \
125 $(SA_DEBUG_CFLAGS) \
126 -o $@ \
127 $(SALIBS)
128 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
129 ifeq ($(OS_VENDOR), Darwin)
130 $(DSYMUTIL) $@
131 ifeq ($(ZIP_DEBUGINFO_FILES),1)
132 $(ZIPEXE) -q -r -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO)
133 $(RM) -r $(LIBSAPROC_DEBUGINFO)
134 endif
135 else
136 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
137 $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
138 ifeq ($(STRIP_POLICY),all_strip)
|
1 #
2 # Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation.
8 #
9 # This code is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # version 2 for more details (a copy is included in the LICENSE file that
13 # accompanied this code).
14 #
15 # You should have received a copy of the GNU General Public License version
16 # 2 along with this work; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 #
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 # or visit www.oracle.com if you need additional information or have any
21 # questions.
22 #
47 $(SASRCDIR)/symtab.c \
48 $(SASRCDIR)/libproc_impl.c \
49 $(SASRCDIR)/ps_proc.c \
50 $(SASRCDIR)/ps_core.c \
51 $(SASRCDIR)/BsdDebuggerLocal.c \
52 $(AGENT_DIR)/src/share/native/sadis.c
53
54 DARWIN_NON_STUB_SASRCFILES = $(SASRCDIR)/symtab.c \
55 $(SASRCDIR)/libproc_impl.c \
56 $(SASRCDIR)/ps_core.c \
57 $(SASRCDIR)/MacosxDebuggerLocal.m \
58 $(AGENT_DIR)/src/share/native/sadis.c
59
60 ifeq ($(OS_VENDOR), FreeBSD)
61 SASRCFILES = $(BSD_NON_STUB_SASRCFILES)
62 SALIBS = -lutil -lthread_db
63 SAARCH = $(ARCHFLAG)
64 else
65 ifeq ($(OS_VENDOR), Darwin)
66 SASRCFILES = $(DARWIN_NON_STUB_SASRCFILES)
67 SALIBS = -g \
68 -framework Foundation \
69 -framework JavaNativeFoundation \
70 -framework Security \
71 -framework CoreFoundation
72 #objc compiler blows up on -march=i586, perhaps it should not be included in the macosx intel 32-bit C++ compiles?
73 SAARCH = $(subst -march=i586,,$(ARCHFLAG))
74
75 # This is needed to locate JavaNativeFoundation.framework
76 # JDK 8 doesn't have SYSROOT_CFLAGS, so we'll cobble it together here
77 SA_SYSROOT_FLAGS=
78 ifneq ($(SDKPATH),)
79 SA_SYSROOT_FLAGS += -isysroot "$(SDKPATH)" -iframework"$(SDKPATH)/System/Library/Frameworks"
80 endif
81 # always needed, even if SDKPATH is empty
82 SA_SYSROOT_FLAGS += -F"$(SDKPATH)/System/Library/Frameworks/JavaVM.framework/Frameworks"
83 else
84 SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c
85 SALIBS =
86 SAARCH = $(ARCHFLAG)
87 endif
88 endif
89
90 SAMAPFILE = $(SASRCDIR)/mapfile
91
92 DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
93 DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO)
94 DEST_SAPROC_DIZ = $(JDK_LIBDIR)/$(LIBSAPROC_DIZ)
95
96 # DEBUG_BINARIES overrides everything, use full -g debug information
97 ifeq ($(DEBUG_BINARIES), true)
98 SA_DEBUG_CFLAGS = -g
99 endif
100
101 # if $(AGENT_DIR) does not exist, we don't build SA
102 # also, we don't build SA on Itanium, PPC, ARM or zero.
103
104 ifneq ($(wildcard $(AGENT_DIR)),)
105 ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),)
106 BUILDLIBSAPROC = $(LIBSAPROC)
107 endif
108 endif
109
110
111 ifneq ($(OS_VENDOR), Darwin)
112 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
113 endif
114 SA_LFLAGS += $(LDFLAGS_HASH_STYLE)
115
116 BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
117 -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]")
118
119 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
120 $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
121 echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
122 exit 1; \
123 fi
124 @echo Making SA debugger back-end...
125 $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \
126 $(SA_SYSROOT_FLAGS) \
127 $(SYMFLAG) $(SAARCH) $(SHARED_FLAG) $(PICFLAG) \
128 -I$(SASRCDIR) \
129 -I$(GENERATED) \
130 $(BOOT_JAVA_INCLUDES) \
131 $(SASRCFILES) \
132 $(SA_LFLAGS) \
133 $(SA_DEBUG_CFLAGS) \
134 -o $@ \
135 $(SALIBS)
136 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
137 ifeq ($(OS_VENDOR), Darwin)
138 $(DSYMUTIL) $@
139 ifeq ($(ZIP_DEBUGINFO_FILES),1)
140 $(ZIPEXE) -q -r -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO)
141 $(RM) -r $(LIBSAPROC_DEBUGINFO)
142 endif
143 else
144 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
145 $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
146 ifeq ($(STRIP_POLICY),all_strip)
|