1 #
   2 # Copyright (c) 2011, 2016, 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 # Hook to include the corresponding custom file, if present.
  29 $(eval $(call IncludeCustomExtension, jdk, lib/Lib-java.instrument.gmk))
  30 
  31 ################################################################################
  32 
  33 LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/java.instrument/share/native/libinstrument \
  34     $(JDK_TOPDIR)/src/java.instrument/$(OPENJDK_TARGET_OS_TYPE)/native/libinstrument \
  35     #
  36 LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \
  37     $(addprefix -I, $(LIBINSTRUMENT_SRC)) \
  38     -I$(SUPPORT_OUTPUTDIR)/headers/java.instrument \
  39     -I$(JDK_TOPDIR)/src/java.base/share/native/libjli \
  40     -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
  41     $(ICONV_CFLAGS) \
  42     #
  43 
  44 ifeq ($(OPENJDK_TARGET_OS), windows)
  45   # Statically link the C runtime so that there are not dependencies on modules
  46   # not on the search patch when invoked from the Windows system directory
  47   # (or elsewhere).
  48   LIBINSTRUMENT_CFLAGS := $(filter-out -MD, $(LIBINSTRUMENT_CFLAGS))
  49   # equivalent of strcasecmp is stricmp on Windows
  50   LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
  51 endif
  52 
  53 $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \
  54     LIBRARY := instrument, \
  55     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
  56     SRC := $(LIBINSTRUMENT_SRC), \
  57     OPTIMIZATION := LOW, \
  58     CFLAGS := $(LIBINSTRUMENT_CFLAGS), \
  59     CFLAGS_debug := -DJPLIS_LOGGING, \
  60     CFLAGS_release := -DNO_JPLIS_LOGGING, \
  61     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libinstrument/mapfile-vers, \
  62     LDFLAGS := $(LDFLAGS_JDKLIB) \
  63         $(call SET_SHARED_LIBRARY_ORIGIN) \
  64         $(LIBINSTRUMENT_LDFLAGS), \
  65     LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/jli) \
  66         -L$(call FindLibDirForModule, java.base)/jli, \
  67     LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/jli) \
  68         -L$(call FindLibDirForModule, java.base)/jli, \
  69     LDFLAGS_macosx := -Wl$(COMMA)-all_load, \
  70     LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \
  71     LDFLAGS_windows := -export:Agent_OnAttach, \
  72     LIBS := $(JDKLIB_LIBS), \
  73     LIBS_unix := -ljava $(LIBZ), \
  74     LIBS_linux := -ljli $(LIBDL), \
  75     LIBS_solaris := -ljli $(LIBDL), \
  76     LIBS_aix := $(ICONV_LIBS) -ljli_static $(LIBDL), \
  77     LIBS_macosx := $(ICONV_LIBS) -framework Cocoa -framework Security \
  78         -framework ApplicationServices \
  79         $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a, \
  80     LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib \
  81         $(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib, \
  82     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
  83     RC_FLAGS := $(RC_FLAGS) \
  84         -D "JDK_FNAME=instrument.dll" \
  85         -D "JDK_INTERNAL_NAME=instrument" \
  86         -D "JDK_FTYPE=0x2L", \
  87     OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libinstrument, \
  88 ))
  89 
  90 ifneq (, $(findstring $(OPENJDK_TARGET_OS), macosx windows aix))
  91   $(BUILD_LIBINSTRUMENT): $(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)jli_static$(STATIC_LIBRARY_SUFFIX)
  92 else
  93   $(BUILD_LIBINSTRUMENT): $(call FindLib, java.base, jli, /jli)
  94 endif
  95 $(BUILD_LIBINSTRUMENT): $(BUILD_LIBJAVA)
  96 
  97 TARGETS += $(BUILD_LIBINSTRUMENT)
  98 
  99 ################################################################################
--- EOF ---