Wed, 20 Mar 2013 17:04:45 -0700
8006965: remove test_gamma and add dedicated test_* targets instead
Reviewed-by: kvn, jcoomes
1 #
2 # Copyright (c) 2005, 2012, 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 #
23 #
25 # Rules to build serviceability agent library, used by vm.make
27 # libsaproc.so: serviceability agent
28 SAPROC = saproc
30 ifeq ($(OS_VENDOR), Darwin)
31 LIBSAPROC = lib$(SAPROC).dylib
32 else
33 LIBSAPROC = lib$(SAPROC).so
34 endif
36 AGENT_DIR = $(GAMMADIR)/agent
38 SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)
40 NON_STUB_SASRCFILES = $(SASRCDIR)/salibelf.c \
41 $(SASRCDIR)/symtab.c \
42 $(SASRCDIR)/libproc_impl.c \
43 $(SASRCDIR)/ps_proc.c \
44 $(SASRCDIR)/ps_core.c \
45 $(SASRCDIR)/BsdDebuggerLocal.c \
46 $(AGENT_DIR)/src/share/native/sadis.c
48 ifeq ($(OS_VENDOR), FreeBSD)
49 SASRCFILES = $(NON_STUB_SASRCFILES)
50 SALIBS = -lutil -lthread_db
51 SAARCH = $(ARCHFLAG)
52 else
53 ifeq ($(OS_VENDOR), Darwin)
54 SASRCFILES = $(SASRCDIR)/MacosxDebuggerLocal.m
55 SALIBS = -g -framework Foundation -F/System/Library/Frameworks/JavaVM.framework/Frameworks -framework JavaNativeFoundation -framework Security -framework CoreFoundation
56 #objc compiler blows up on -march=i586, perhaps it should not be included in the macosx intel 32-bit C++ compiles?
57 SAARCH = $(subst -march=i586,,$(ARCHFLAG))
58 else
59 SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c
60 SALIBS =
61 SAARCH = $(ARCHFLAG)
62 endif
63 endif
65 SAMAPFILE = $(SASRCDIR)/mapfile
67 DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
69 # DEBUG_BINARIES overrides everything, use full -g debug information
70 ifeq ($(DEBUG_BINARIES), true)
71 SA_DEBUG_CFLAGS = -g
72 endif
74 # if $(AGENT_DIR) does not exist, we don't build SA
75 # also, we don't build SA on Itanium, PPC, ARM or zero.
77 ifneq ($(wildcard $(AGENT_DIR)),)
78 ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),)
79 BUILDLIBSAPROC = $(LIBSAPROC)
80 endif
81 endif
84 ifneq ($(OS_VENDOR), Darwin)
85 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
86 endif
87 SA_LFLAGS += $(LDFLAGS_HASH_STYLE)
89 ifeq ($(OS_VENDOR), Darwin)
90 BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
91 -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]") \
92 -I/System/Library/Frameworks/JavaVM.framework/Headers
93 else
94 BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
95 -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]")
96 endif
98 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
99 $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
100 echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
101 exit 1; \
102 fi
103 @echo Making SA debugger back-end...
104 $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \
105 $(SYMFLAG) $(SAARCH) $(SHARED_FLAG) $(PICFLAG) \
106 -I$(SASRCDIR) \
107 -I$(GENERATED) \
108 $(BOOT_JAVA_INCLUDES) \
109 $(SASRCFILES) \
110 $(SA_LFLAGS) \
111 $(SA_DEBUG_CFLAGS) \
112 -o $@ \
113 $(SALIBS)
115 install_saproc: $(BUILDLIBSAPROC)
116 $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \
117 echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \
118 cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \
119 fi
121 .PHONY: install_saproc