make/bsd/makefiles/saproc.make

Fri, 12 Oct 2012 10:49:39 -0700

author
collins
date
Fri, 12 Oct 2012 10:49:39 -0700
changeset 4167
9855b7e559ae
parent 4093
5a98bf7d847b
child 4344
892acf0431ef
permissions
-rw-r--r--

Merge

     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[_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         \
    49                       $(AGENT_DIR)/src/share/native/sadis.c
    51 ifeq ($(OS_VENDOR), FreeBSD)
    52   SASRCFILES = $(NON_STUB_SASRCFILES)
    53   SALIBS = -lutil -lthread_db
    54   SAARCH = $(ARCHFLAG)
    55 else
    56   ifeq ($(OS_VENDOR), Darwin)
    57     SASRCFILES = $(SASRCDIR)/MacosxDebuggerLocal.m
    58     SALIBS = -g -framework Foundation -F/System/Library/Frameworks/JavaVM.framework/Frameworks -framework JavaNativeFoundation -framework Security -framework CoreFoundation
    59     #objc compiler blows up on -march=i586, perhaps it should not be included in the macosx intel 32-bit C++ compiles?
    60     SAARCH = $(subst -march=i586,,$(ARCHFLAG))
    61   else
    62     SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c
    63     SALIBS = 
    64     SAARCH = $(ARCHFLAG)
    65   endif
    66 endif
    68 SAMAPFILE = $(SASRCDIR)/mapfile
    70 DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
    72 # DEBUG_BINARIES overrides everything, use full -g debug information
    73 ifeq ($(DEBUG_BINARIES), true)
    74   SA_DEBUG_CFLAGS = -g
    75 endif
    77 # if $(AGENT_DIR) does not exist, we don't build SA
    78 # also, we don't build SA on Itanium, PPC, ARM or zero.
    80 ifneq ($(wildcard $(AGENT_DIR)),)
    81 ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),)
    82   BUILDLIBSAPROC = $(LIBSAPROC)
    83 endif
    84 endif
    87 ifneq ($(OS_VENDOR), Darwin)
    88 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
    89 endif
    90 SA_LFLAGS += $(LDFLAGS_HASH_STYLE)
    92 ifeq ($(OS_VENDOR), Darwin)
    93   BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
    94     -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]") \
    95     -I/System/Library/Frameworks/JavaVM.framework/Headers
    96 else
    97   BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
    98     -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]")
    99 endif
   101 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
   102 	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
   103 	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
   104 	  exit 1; \
   105 	fi
   106 	@echo Making SA debugger back-end...
   107 	$(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE                   \
   108                    $(SYMFLAG) $(SAARCH) $(SHARED_FLAG) $(PICFLAG)     \
   109 	           -I$(SASRCDIR)                                        \
   110 	           -I$(GENERATED)                                       \
   111 	           $(BOOT_JAVA_INCLUDES)                                \
   112 	           $(SASRCFILES)                                        \
   113 	           $(SA_LFLAGS)                                         \
   114 	           $(SA_DEBUG_CFLAGS)                                   \
   115 	           -o $@                                                \
   116 	           $(SALIBS)
   117 	$(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
   119 install_saproc: $(BUILDLIBSAPROC)
   120 	$(QUIETLY) if [ -e $(LIBSAPROC) ] ; then             \
   121 	  echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)";     \
   122 	  cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done";  \
   123 	fi
   125 .PHONY: install_saproc

mercurial