make/lib/Lib-jdk.hotspot.agent.gmk
author ihse
Tue, 13 Mar 2018 14:33:34 +0100
branchihse-jdk-library-branch
changeset 56287 593a452fcbeb
parent 49160 cefb7b496d17
child 56301 ceb60eb3139e
permissions -rw-r--r--
Introduce SetupJdkLibrary and SetupJdkExecutable.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34289
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
     1
#
49070
d7859531621b 8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents: 47314
diff changeset
     2
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
34289
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
     4
#
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    10
#
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    15
# accompanied this code).
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    16
#
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    20
#
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    23
# questions.
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    24
#
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    25
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    26
include NativeCompilation.gmk
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    27
47314
743814386712 8188814: Simplify IncludeCustomExtension
ihse
parents: 47217
diff changeset
    28
$(eval $(call IncludeCustomExtension, hotspot/lib/Lib-jdk.hotspot.agent.gmk))
34289
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    29
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    30
################################################################################
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    31
35765
e15ec0a78e45 8149647: Incremental enhancements from build-infra
ihse
parents: 35236
diff changeset
    32
ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx windows), )
e15ec0a78e45 8149647: Incremental enhancements from build-infra
ihse
parents: 35236
diff changeset
    33
  DISABLE_MAPFILES := true
e15ec0a78e45 8149647: Incremental enhancements from build-infra
ihse
parents: 35236
diff changeset
    34
endif
e15ec0a78e45 8149647: Incremental enhancements from build-infra
ihse
parents: 35236
diff changeset
    35
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    36
SA_TOPDIR := $(TOPDIR)/src/jdk.hotspot.agent
34289
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    37
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    38
# Defaults for most platforms
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    39
SA_TOOLCHAIN := TOOLCHAIN_DEFAULT
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    40
SA_NAME := saproc
35217
ce4b5303a813 8067194: Restructure hotspot/agent/src to conform the modular source layout
dsamersoff
parents: 34312
diff changeset
    41
SA_SRC += $(SA_TOPDIR)/share/native/libsaproc $(SA_TOPDIR)/$(OPENJDK_TARGET_OS)/native/libsaproc
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    42
SA_MAPFILE := $(TOPDIR)/make/mapfiles/libsaproc/mapfile-$(OPENJDK_TARGET_OS)
34289
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    43
SA_INCLUDES := \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    44
    $(addprefix -I, $(SA_SRC)) \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    45
    -I$(SUPPORT_OUTPUTDIR)/headers/jdk.hotspot.agent \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 47216
diff changeset
    46
    -I$(TOPDIR)/src/hotspot/os/$(OPENJDK_TARGET_OS) \
34289
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    47
    #
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    48
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    49
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    50
  SA_MACHINE_FLAG_windows := -machine:AMD64
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    51
else ifeq ($(OPENJDK_TARGET_CPU), x86)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    52
  SA_MACHINE_FLAG_linux := -march=i586
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    53
  SA_MACHINE_FLAG_windows := -machine:I386
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    54
endif
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    55
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    56
ifeq ($(OPENJDK_TARGET_OS), linux)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    57
  SA_CFLAGS := $(CFLAGS_JDKLIB) -D_FILE_OFFSET_BITS=64 \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    58
      $(SA_MACHINE_FLAG_linux)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    59
  SA_LDFLAGS := $(LDFLAGS_JDKLIB) $(SA_MACHINE_FLAG_linux)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    60
  SA_LIBS := -lthread_db $(LIBDL)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    61
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    62
else ifeq ($(OPENJDK_TARGET_OS), solaris)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    63
  SA_TOOLCHAIN := TOOLCHAIN_LINK_CXX
42035
10e6e31dc1aa 8164383: jhsdb dumps core on Solaris 12 when loading dumped core
dsamersoff
parents: 36548
diff changeset
    64
  SA_CFLAGS := $(CFLAGS_JDKLIB)
10e6e31dc1aa 8164383: jhsdb dumps core on Solaris 12 when loading dumped core
dsamersoff
parents: 36548
diff changeset
    65
  SA_CXXFLAGS := $(CXXFLAGS_JDKLIB)
34610
0d0012bed22c 8142907: Integration of minor fixes from the build-infra project
ihse
parents: 34312
diff changeset
    66
  SA_LDFLAGS := $(subst -Wl$(COMMA)-z$(COMMA)defs,, $(LDFLAGS_JDKLIB)) \
34289
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    67
      -mt $(LDFLAGS_CXX_JDK)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    68
  SA_LIBS := -ldl -ldemangle -lthread -lc
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    69
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    70
else ifeq ($(OPENJDK_TARGET_OS), macosx)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    71
  SA_EXCLUDE_FILES := BsdDebuggerLocal.c ps_proc.c salibelf.c StubDebuggerLocal.c
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    72
  SA_CFLAGS := $(CFLAGS_JDKLIB) \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    73
      -Damd64 -D_GNU_SOURCE -mno-omit-leaf-frame-pointer \
34312
b687b05475c6 8144134: Nightly tests fail with SIGSEGV in Ticks::now()
erikj
parents: 34289
diff changeset
    74
      -mstack-alignment=16 -fPIC
34289
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    75
  SA_LDFLAGS := $(LDFLAGS_JDKLIB)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    76
  SA_LIBS := -framework Foundation -framework JavaNativeFoundation \
42047
72bc0277f889 8160376: DebuggerException: Can't attach symbolicator to the process
dsamersoff
parents: 42035
diff changeset
    77
      -framework JavaRuntimeSupport -framework Security -framework CoreFoundation
34289
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    78
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    79
else ifeq ($(OPENJDK_TARGET_OS), windows)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    80
  SA_NAME := sawindbg
49160
cefb7b496d17 8199347: Always use -Z7 for debug symbols when compiling on Windows
ihse
parents: 49070
diff changeset
    81
  COMMON_CFLAGS := -D_WINDOWS -D_DEBUG -D_CONSOLE -D_MBCS -EHsc
34289
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    82
  SA_CFLAGS := $(subst -DWIN32_LEAN_AND_MEAN,, $(CFLAGS_JDKLIB)) \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    83
      $(COMMON_CFLAGS)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    84
  SA_CXXFLAGS := $(subst -DWIN32_LEAN_AND_MEAN,, $(CXXFLAGS_JDKLIB)) \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    85
      $(COMMON_CFLAGS)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    86
  SA_LDFLAGS := $(LDFLAGS_JDKLIB) \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    87
      $(SA_MACHINE_FLAG_windows) -manifest \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    88
      -subsystem:console -map
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    89
  SA_LIBS := dbgeng.lib
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    90
  ifeq ($(OPENJDK_TARGET_CPU), x86_64)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    91
    SA_CXXFLAGS += -DWIN64
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    92
  else
36548
fc7fd42432e5 8151619: genSocketOptionRegistry.exe always relinked on Windows
erikj
parents: 35765
diff changeset
    93
    SA_CXXFLAGS += -RTC1
34289
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    94
    SA_LDFLAGS += -SAFESEH
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    95
  endif
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    96
endif
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    97
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    98
################################################################################
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
    99
56287
593a452fcbeb Introduce SetupJdkLibrary and SetupJdkExecutable.
ihse
parents: 49160
diff changeset
   100
$(eval $(call SetupJdkLibrary, BUILD_LIBSA, \
49070
d7859531621b 8198751: Refactor SetupNativeCompilation to take NAME and TYPE
ihse
parents: 47314
diff changeset
   101
    NAME := $(SA_NAME), \
34289
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   102
    TOOLCHAIN := $(SA_TOOLCHAIN), \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   103
    OPTIMIZATION := NONE, \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   104
    DISABLED_WARNINGS_microsoft := 4267, \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   105
    DISABLED_WARNINGS_gcc := sign-compare, \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   106
    DISABLED_WARNINGS_CXX_solstudio := truncwarn unknownpragma, \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   107
    SRC := $(SA_SRC), \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   108
    EXCLUDE_FILES := test.c saproc_audit.cpp $(SA_EXCLUDE_FILES), \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   109
    CFLAGS := $(SA_INCLUDES) $(SA_CFLAGS) $(SA_CUSTOM_CFLAGS), \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   110
    CXXFLAGS := $(SA_INCLUDES) $(SA_CXXFLAGS) $(SA_CUSTOM_CXXFLAGS), \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   111
    LDFLAGS := $(SA_LDFLAGS) $(SA_CUSTOM_LDFLAGS), \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   112
    LIBS := $(SA_LIBS), \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   113
    MAPFILE := $(SA_MAPFILE), \
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   114
))
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   115
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   116
TARGETS += $(BUILD_LIBSA)
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   117
2d1821a50263 8142336: Convert the SA agent build to modular build-infra makefiles
erikj
parents:
diff changeset
   118
################################################################################