make/bsd/makefiles/saproc.make

Thu, 15 Mar 2012 13:37:13 +0100

author
nloodin
date
Thu, 15 Mar 2012 13:37:13 +0100
changeset 3681
51612f0c0a79
parent 3202
436b4a3231bf
child 4093
5a98bf7d847b
permissions
-rw-r--r--

7148488: Whitebox tests for the Diagnostic Framework Parser
Reviewed-by: brutisso, sla, mgerdin

     1 #
     2 # Copyright (c) 2005, 2010, 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[_g].so: serviceability agent
    28 SAPROC   = saproc
    29 SAPROC_G = $(SAPROC)$(G_SUFFIX)
    31 ifeq ($(OS_VENDOR), Darwin)
    32   LIBSAPROC   = lib$(SAPROC).dylib
    33   LIBSAPROC_G = lib$(SAPROC_G).dylib
    34 else
    35   LIBSAPROC   = lib$(SAPROC).so
    36   LIBSAPROC_G = lib$(SAPROC_G).so
    37 endif
    39 AGENT_DIR = $(GAMMADIR)/agent
    41 SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)
    43 NON_STUB_SASRCFILES = $(SASRCDIR)/salibelf.c          \
    44                       $(SASRCDIR)/symtab.c            \
    45                       $(SASRCDIR)/libproc_impl.c      \
    46                       $(SASRCDIR)/ps_proc.c           \
    47                       $(SASRCDIR)/ps_core.c           \
    48                       $(SASRCDIR)/BsdDebuggerLocal.c
    50 ifeq ($(OS_VENDOR), FreeBSD)
    51   SASRCFILES = $(NON_STUB_SASRCFILES)
    52   SALIBS = -lutil -lthread_db
    53   SAARCH = $(ARCHFLAG)
    54 else
    55   ifeq ($(OS_VENDOR), Darwin)
    56     SASRCFILES = $(SASRCDIR)/MacosxDebuggerLocal.m
    57     SALIBS = -g -framework Foundation -F/System/Library/Frameworks/JavaVM.framework/Frameworks -framework JavaNativeFoundation -framework Security -framework CoreFoundation
    58     #objc compiler blows up on -march=i586, perhaps it should not be included in the macosx intel 32-bit C++ compiles?
    59     SAARCH = $(subst -march=i586,,$(ARCHFLAG))
    60   else
    61     SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c
    62     SALIBS = 
    63     SAARCH = $(ARCHFLAG)
    64   endif
    65 endif
    67 SAMAPFILE = $(SASRCDIR)/mapfile
    69 DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
    71 # DEBUG_BINARIES overrides everything, use full -g debug information
    72 ifeq ($(DEBUG_BINARIES), true)
    73   SA_DEBUG_CFLAGS = -g
    74 endif
    76 # if $(AGENT_DIR) does not exist, we don't build SA
    77 # also, we don't build SA on Itanium, PPC, ARM or zero.
    79 ifneq ($(wildcard $(AGENT_DIR)),)
    80 ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),)
    81   BUILDLIBSAPROC = $(LIBSAPROC)
    82 endif
    83 endif
    86 ifneq ($(OS_VENDOR), Darwin)
    87 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
    88 endif
    89 SA_LFLAGS += $(LDFLAGS_HASH_STYLE)
    91 ifeq ($(OS_VENDOR), Darwin)
    92   BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
    93     -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]") \
    94     -I/System/Library/Frameworks/JavaVM.framework/Headers
    95 else
    96   BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
    97     -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]")
    98 endif
   100 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
   101 	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
   102 	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
   103 	  exit 1; \
   104 	fi
   105 	@echo Making SA debugger back-end...
   106 	$(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE                   \
   107                    $(SYMFLAG) $(SAARCH) $(SHARED_FLAG) $(PICFLAG)     \
   108 	           -I$(SASRCDIR)                                        \
   109 	           -I$(GENERATED)                                       \
   110 	           $(BOOT_JAVA_INCLUDES)                                \
   111 	           $(SASRCFILES)                                        \
   112 	           $(SA_LFLAGS)                                         \
   113 	           $(SA_DEBUG_CFLAGS)                                   \
   114 	           -o $@                                                \
   115 	           $(SALIBS)
   116 	$(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
   118 install_saproc: $(BUILDLIBSAPROC)
   119 	$(QUIETLY) if [ -e $(LIBSAPROC) ] ; then             \
   120 	  echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)";     \
   121 	  cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done";  \
   122 	fi
   124 .PHONY: install_saproc

mercurial