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_MAPFILE := $(TOPDIR)/make/mapfiles/libsaproc/mapfile-$(OPENJDK_TARGET_OS)
  40 
  41 SA_INCLUDES := \
  42     $(addprefix -I, $(SA_SRC)) \
  43     -I$(SUPPORT_OUTPUTDIR)/headers/jdk.hotspot.agent \
  44     -I$(TOPDIR)/src/hotspot/os/$(OPENJDK_TARGET_OS) \
  45     #
  46 
  47 ifeq ($(OPENJDK_TARGET_OS), linux)
  48   SA_CFLAGS := -D_FILE_OFFSET_BITS=64
  49 
  50 else ifeq ($(OPENJDK_TARGET_OS), solaris)
  51   SA_LDFLAGS := -mt
  52 
  53 else ifeq ($(OPENJDK_TARGET_OS), macosx)
  54   SA_CFLAGS := -Damd64 -D_GNU_SOURCE -mno-omit-leaf-frame-pointer \
  55       -mstack-alignment=16 -fPIC
  56 else ifeq ($(OPENJDK_TARGET_OS), windows)
  57   SA_CFLAGS := -D_WINDOWS -D_DEBUG -D_CONSOLE -D_MBCS -EHsc
  58   ifeq ($(OPENJDK_TARGET_CPU), x86_64)
  59     SA_CXXFLAGS := -DWIN64
  60   else
  61     SA_CXXFLAGS := -RTC1
  62   endif
  63 endif
  64 
  65 ################################################################################
  66 
  67 $(eval $(call SetupJdkLibrary, BUILD_LIBSA, \
  68     NAME := saproc, \
  69     OPTIMIZATION := NONE, \
  70     DISABLED_WARNINGS_microsoft := 4267, \
  71     DISABLED_WARNINGS_gcc := sign-compare, \
  72     DISABLED_WARNINGS_CXX_solstudio := truncwarn unknownpragma, \
  73     SRC := $(SA_SRC), \
  74     CFLAGS := $(CFLAGS_JDKLIB) $(SA_INCLUDES) $(SA_CFLAGS) $(SA_CUSTOM_CFLAGS), \
  75     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(SA_INCLUDES) $(SA_CFLAGS) $(SA_CXXFLAGS), \
  76     LDFLAGS := $(LDFLAGS_JDKLIB) $(SA_LDFLAGS), \
  77     LIBS_linux := -lthread_db $(LIBDL), \
  78     LIBS_solaris := -ldl -ldemangle -lthread -lproc, \
  79     LIBS_macosx := -framework Foundation -framework JavaNativeFoundation \
  80         -framework JavaRuntimeSupport -framework Security -framework CoreFoundation, \
  81     LIBS_windows := dbgeng.lib, \
  82     MAPFILE := $(SA_MAPFILE), \
  83 ))
  84 
  85 TARGETS += $(BUILD_LIBSA)
  86 
  87 ################################################################################