1 #
   2 # Copyright (c) 2011, 2014, 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 ################################################################################
  29 
  30 BUILD_LIBHPROF_SRC := $(call FindSrcDirsForLib, jdk.hprof.agent, hprof)
  31 
  32 BUILD_LIBHPROF_CFLAGS := $(addprefix -I, $(BUILD_LIBHPROF_SRC)) \
  33     -I$(JDK_TOPDIR)/src/demo/share/jvmti/java_crw_demo
  34     
  35 BUILD_LIBHPROF_LDFLAGS :=
  36 
  37 LIBHPROF_OPTIMIZATION := HIGHEST
  38 ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
  39   ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
  40     LIBHPROF_OPTIMIZATION := LOW
  41   endif
  42 endif
  43 
  44 $(eval $(call SetupNativeCompilation,BUILD_LIBHPROF, \
  45     LIBRARY := hprof, \
  46     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
  47     SRC := $(BUILD_LIBHPROF_SRC), \
  48     LANG := C, \
  49     OPTIMIZATION := $(LIBHPROF_OPTIMIZATION), \
  50     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
  51         $(BUILD_LIBHPROF_CFLAGS), \
  52     CFLAGS_debug := -DHPROF_LOGGING, \
  53     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libhprof/mapfile-vers, \
  54     LDFLAGS := $(LDFLAGS_JDKLIB) \
  55         $(call SET_SHARED_LIBRARY_ORIGIN), \
  56     LDFLAGS_windows := wsock32.lib winmm.lib advapi32.lib, \
  57     LDFLAGS_SUFFIX_linux := $(LIBDL), \
  58     LDFLAGS_SUFFIX_macosx := $(LIBDL), \
  59     LDFLAGS_SUFFIX_solaris := -lsocket -lnsl $(LIBDL) -lc, \
  60     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
  61     RC_FLAGS := $(RC_FLAGS) \
  62         -D "JDK_FNAME=hprof.dll" \
  63         -D "JDK_INTERNAL_NAME=hprof" \
  64         -D "JDK_FTYPE=0x2L", \
  65     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libhprof_jvmti, \
  66     DEBUG_SYMBOLS := true))
  67 
  68 TARGETS += $(BUILD_LIBHPROF)
  69 
  70 ################################################################################
  71 
  72 LIBJAVA_CRW_DEMO_SRC := $(JDK_TOPDIR)/src/demo/share/jvmti/java_crw_demo
  73 
  74 $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA_CRW_DEMO, \
  75     LIBRARY := java_crw_demo, \
  76     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
  77     SRC := $(LIBJAVA_CRW_DEMO_SRC), \
  78     LANG := C, \
  79     OPTIMIZATION := LOW, \
  80     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
  81         $(addprefix -I, $(LIBJAVA_CRW_DEMO_SRC)), \
  82     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava_crw_demo/mapfile-vers, \
  83     LDFLAGS := $(LDFLAGS_JDKLIB) \
  84         $(call SET_SHARED_LIBRARY_ORIGIN), \
  85     LDFLAGS_SUFFIX_solaris := -lc, \
  86     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
  87     RC_FLAGS := $(RC_FLAGS) \
  88         -D "JDK_FNAME=java_crw_demo.dll" \
  89         -D "JDK_INTERNAL_NAME=java_crw_demo" \
  90         -D "JDK_FTYPE=0x2L", \
  91     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava_crw_demo, \
  92     DEBUG_SYMBOLS := true))
  93 
  94 TARGETS += $(BUILD_LIBJAVA_CRW_DEMO)
  95 
  96 ################################################################################