1 #
   2 # Copyright (c) 2015, 2018, 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.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 include LibCommon.gmk
  27 
  28 $(eval $(call IncludeCustomExtension, hotspot/lib/Lib-jdk.hotspot.agent.gmk))
  29 
  30 ################################################################################
  31 
  32 SA_TOPDIR := $(TOPDIR)/src/jdk.hotspot.agent
  33 
  34 SA_SRC += \
  35     $(SA_TOPDIR)/share/native/libsaproc \
  36     $(SA_TOPDIR)/$(OPENJDK_TARGET_OS)/native/libsaproc \
  37     #
  38 
  39 SA_INCLUDES := \
  40     $(addprefix -I, $(SA_SRC)) \
  41     -I$(SUPPORT_OUTPUTDIR)/headers/jdk.hotspot.agent \
  42     -I$(TOPDIR)/src/hotspot/os/$(OPENJDK_TARGET_OS) \
  43     #
  44 
  45 ifeq ($(OPENJDK_TARGET_OS), linux)
  46   SA_CFLAGS := -D_FILE_OFFSET_BITS=64
  47 
  48 else ifeq ($(OPENJDK_TARGET_OS), solaris)
  49   SA_LDFLAGS := -mt
  50 
  51 else ifeq ($(OPENJDK_TARGET_OS), macosx)
  52   SA_CFLAGS := -Damd64 -D_GNU_SOURCE -mno-omit-leaf-frame-pointer \
  53       -mstack-alignment=16 -fPIC
  54 else ifeq ($(OPENJDK_TARGET_OS), windows)
  55   SA_CFLAGS := -D_WINDOWS -D_DEBUG -D_CONSOLE -D_MBCS -EHsc
  56   ifeq ($(OPENJDK_TARGET_CPU), x86_64)
  57     SA_CXXFLAGS := -DWIN64
  58   else
  59     SA_CXXFLAGS := -RTC1
  60   endif
  61 endif
  62 
  63 ################################################################################
  64 
  65 $(eval $(call SetupJdkLibrary, BUILD_LIBSA, \
  66     NAME := saproc, \
  67     OPTIMIZATION := NONE, \
  68     DISABLED_WARNINGS_microsoft := 4267, \
  69     DISABLED_WARNINGS_gcc := sign-compare, \
  70     DISABLED_WARNINGS_CXX_solstudio := truncwarn unknownpragma, \
  71     SRC := $(SA_SRC), \
  72     CFLAGS := $(CFLAGS_JDKLIB) $(SA_INCLUDES) $(SA_CFLAGS) $(SA_CUSTOM_CFLAGS), \
  73     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(SA_INCLUDES) $(SA_CFLAGS) $(SA_CXXFLAGS), \
  74     LDFLAGS := $(LDFLAGS_JDKLIB) $(SA_LDFLAGS), \
  75     LIBS_linux := -lthread_db $(LIBDL), \
  76     LIBS_solaris := -ldl -ldemangle -lthread -lproc, \
  77     LIBS_macosx := -framework Foundation -framework JavaNativeFoundation \
  78         -framework JavaRuntimeSupport -framework Security -framework CoreFoundation, \
  79     LIBS_windows := dbgeng.lib, \
  80 ))
  81 
  82 TARGETS += $(BUILD_LIBSA)
  83 
  84 ################################################################################