make/linux/makefiles/defs.make

Wed, 15 May 2013 23:06:04 -0400

author
bpittore
date
Wed, 15 May 2013 23:06:04 -0400
changeset 5148
26579ac80ce9
parent 4942
f36e073d56a4
child 6452
faf0c78e906b
permissions
-rw-r--r--

8014669: arch specific flags not passed to some link commands
Summary: EXTRA_CFLAGS does not propagate to saproc and jsig makefiles
Reviewed-by: dholmes, tbell, collins

     1 #
     2 # Copyright (c) 2006, 2013, 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.
     8 #
     9 # This code is distributed in the hope that it will be useful, but WITHOUT
    10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12 # version 2 for more details (a copy is included in the LICENSE file that
    13 # accompanied this code).
    14 #
    15 # You should have received a copy of the GNU General Public License version
    16 # 2 along with this work; if not, write to the Free Software Foundation,
    17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18 #
    19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20 # or visit www.oracle.com if you need additional information or have any
    21 # questions.
    22 #
    23 #
    25 # The common definitions for hotspot linux builds.
    26 # Include the top level defs.make under make directory instead of this one.
    27 # This file is included into make/defs.make.
    29 SLASH_JAVA ?= /java
    31 # Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name
    33 # ARCH can be set explicitly in spec.gmk
    34 ifndef ARCH
    35   ARCH := $(shell uname -m)
    36 endif
    38 PATH_SEP ?= :
    40 ifeq ($(LP64), 1)
    41   ARCH_DATA_MODEL ?= 64
    42 else
    43   ARCH_DATA_MODEL ?= 32
    44 endif
    46 # zero
    47 ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
    48   ifeq ($(ARCH_DATA_MODEL), 64)
    49     MAKE_ARGS      += LP64=1
    50   endif
    51   PLATFORM         = linux-zero
    52   VM_PLATFORM      = linux_$(subst i386,i486,$(ZERO_LIBARCH))
    53   HS_ARCH          = zero
    54   ARCH             = zero
    55 endif
    57 # ia64
    58 ifeq ($(ARCH), ia64)
    59   ARCH_DATA_MODEL = 64
    60   MAKE_ARGS      += LP64=1
    61   PLATFORM        = linux-ia64
    62   VM_PLATFORM     = linux_ia64
    63   HS_ARCH         = ia64
    64 endif
    66 # sparc
    67 ifeq ($(ARCH), sparc64)
    68   ifeq ($(ARCH_DATA_MODEL), 64)
    69     ARCH_DATA_MODEL  = 64
    70     MAKE_ARGS        += LP64=1
    71     PLATFORM         = linux-sparcv9
    72     VM_PLATFORM      = linux_sparcv9
    73   else
    74     ARCH_DATA_MODEL  = 32
    75     PLATFORM         = linux-sparc
    76     VM_PLATFORM      = linux_sparc
    77   endif
    78   HS_ARCH            = sparc
    79 endif
    81 # amd64/x86_64
    82 ifneq (,$(findstring $(ARCH), amd64 x86_64))
    83   ifeq ($(ARCH_DATA_MODEL), 64)
    84     ARCH_DATA_MODEL = 64
    85     MAKE_ARGS       += LP64=1
    86     PLATFORM        = linux-amd64
    87     VM_PLATFORM     = linux_amd64
    88     HS_ARCH         = x86
    89   else
    90     ARCH_DATA_MODEL = 32
    91     PLATFORM        = linux-i586
    92     VM_PLATFORM     = linux_i486
    93     HS_ARCH         = x86
    94     # We have to reset ARCH to i686 since SRCARCH relies on it
    95     ARCH            = i686
    96   endif
    97 endif
    99 # i686/i586 ie 32-bit x86
   100 ifneq (,$(findstring $(ARCH), i686 i586))
   101   ARCH_DATA_MODEL  = 32
   102   PLATFORM         = linux-i586
   103   VM_PLATFORM      = linux_i486
   104   HS_ARCH          = x86
   105 endif
   107 # ARM
   108 ifeq ($(ARCH), arm)
   109   ARCH_DATA_MODEL  = 32
   110   PLATFORM         = linux-arm
   111   VM_PLATFORM      = linux_arm
   112   HS_ARCH          = arm
   113 endif
   115 # PPC
   116 ifeq ($(ARCH), ppc)
   117   ARCH_DATA_MODEL  = 32
   118   PLATFORM         = linux-ppc
   119   VM_PLATFORM      = linux_ppc
   120   HS_ARCH          = ppc
   121 endif
   123 # On 32 bit linux we build server and client, on 64 bit just server.
   124 ifeq ($(JVM_VARIANTS),)
   125   ifeq ($(ARCH_DATA_MODEL), 32)
   126     JVM_VARIANTS:=client,server
   127     JVM_VARIANT_CLIENT:=true
   128     JVM_VARIANT_SERVER:=true
   129   else
   130     JVM_VARIANTS:=server
   131     JVM_VARIANT_SERVER:=true
   132   endif
   133 endif
   135 # determine if HotSpot is being built in JDK6 or earlier version
   136 JDK6_OR_EARLIER=0
   137 ifeq "$(shell expr \( '$(JDK_MAJOR_VERSION)' != '' \& '$(JDK_MINOR_VERSION)' != '' \& '$(JDK_MICRO_VERSION)' != '' \))" "1"
   138   # if the longer variable names (newer build style) are set, then check those
   139   ifeq "$(shell expr \( $(JDK_MAJOR_VERSION) = 1 \& $(JDK_MINOR_VERSION) \< 7 \))" "1"
   140     JDK6_OR_EARLIER=1
   141   endif
   142 else
   143   # the longer variables aren't set so check the shorter variable names
   144   ifeq "$(shell expr \( '$(JDK_MAJOR_VER)' = 1 \& '$(JDK_MINOR_VER)' \< 7 \))" "1"
   145     JDK6_OR_EARLIER=1
   146   endif
   147 endif
   149 ifeq ($(JDK6_OR_EARLIER),0)
   150   # Full Debug Symbols is supported on JDK7 or newer.
   151   # The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product
   152   # builds is enabled with debug info files ZIP'ed to save space. For
   153   # BUILD_FLAVOR != product builds, FDS is always enabled, after all a
   154   # debug build without debug info isn't very useful.
   155   # The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled.
   156   #
   157   # If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be
   158   # disabled for a BUILD_FLAVOR == product build.
   159   #
   160   # Note: Use of a different variable name for the FDS override option
   161   # versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS
   162   # versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass
   163   # in options via environment variables, use of distinct variables
   164   # prevents strange behaviours. For example, in a BUILD_FLAVOR !=
   165   # product build, the FULL_DEBUG_SYMBOLS environment variable will be
   166   # 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If
   167   # the same variable name is used, then different values can be picked
   168   # up by different parts of the build. Just to be clear, we only need
   169   # two variable names because the incoming option value can be
   170   # overridden in some situations, e.g., a BUILD_FLAVOR != product
   171   # build.
   173   # Due to the multiple sub-make processes that occur this logic gets
   174   # executed multiple times. We reduce the noise by at least checking that
   175   # BUILD_FLAVOR has been set.
   176   ifneq ($(BUILD_FLAVOR),)
   177     ifeq ($(BUILD_FLAVOR), product)
   178       FULL_DEBUG_SYMBOLS ?= 1
   179       ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
   180     else
   181       # debug variants always get Full Debug Symbols (if available)
   182       ENABLE_FULL_DEBUG_SYMBOLS = 1
   183     endif
   184     _JUNK_ := $(shell \
   185       echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
   186     # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
   188     ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   189       # Default OBJCOPY comes from GNU Binutils on Linux
   190       ifeq ($(CROSS_COMPILE_ARCH),)
   191         DEF_OBJCOPY=/usr/bin/objcopy
   192       else
   193         # Assume objcopy is part of the cross-compilation toolset
   194         ifneq ($(ALT_COMPILER_PATH),)
   195           DEF_OBJCOPY=$(ALT_COMPILER_PATH)/objcopy
   196         endif
   197       endif
   198       OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
   199       ifneq ($(ALT_OBJCOPY),)
   200         _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
   201         OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
   202       endif
   204       ifeq ($(OBJCOPY),)
   205         _JUNK_ := $(shell \
   206           echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.")
   207         ENABLE_FULL_DEBUG_SYMBOLS=0
   208         _JUNK_ := $(shell \
   209           echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
   210       else
   211         _JUNK_ := $(shell \
   212           echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.")
   214         # Library stripping policies for .debuginfo configs:
   215         #   all_strip - strips everything from the library
   216         #   min_strip - strips most stuff from the library; leaves minimum symbols
   217         #   no_strip  - does not strip the library at all
   218         #
   219         # Oracle security policy requires "all_strip". A waiver was granted on
   220         # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE.
   221         #
   222         # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled.
   223         #
   224         STRIP_POLICY ?= min_strip
   226         _JUNK_ := $(shell \
   227           echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
   229         ZIP_DEBUGINFO_FILES ?= 1
   231         _JUNK_ := $(shell \
   232           echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
   233       endif
   234     endif # ENABLE_FULL_DEBUG_SYMBOLS=1
   235   endif # BUILD_FLAVOR
   236 endif # JDK_6_OR_EARLIER
   238 JDK_INCLUDE_SUBDIR=linux
   240 # Library suffix
   241 LIBRARY_SUFFIX=so
   243 EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html
   245 # client and server subdirectories have symbolic links to ../libjsig.so
   246 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
   247 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   248   ifeq ($(ZIP_DEBUGINFO_FILES),1)
   249     EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.diz
   250   else
   251     EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo
   252   endif
   253 endif
   254 EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
   255 EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
   256 EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal
   258 ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
   259   EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
   260   EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
   261   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   262     ifeq ($(ZIP_DEBUGINFO_FILES),1)
   263       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz
   264     else
   265       EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo
   266     endif
   267   endif
   268 endif
   270 ifeq ($(JVM_VARIANT_CLIENT),true)
   271   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
   272   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX)
   273   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   274     ifeq ($(ZIP_DEBUGINFO_FILES),1)
   275       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz
   276     else
   277       EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo
   278     endif
   279   endif
   280 endif
   282 ifeq ($(JVM_VARIANT_MINIMAL1),true)
   283   EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/Xusage.txt
   284   EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.$(LIBRARY_SUFFIX)
   286   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   287     ifeq ($(ZIP_DEBUGINFO_FILES),1)
   288 	EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.diz
   289     else
   290 	EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.debuginfo
   291     endif
   292   endif
   293 endif
   295 # Serviceability Binaries
   296 # No SA Support for PPC, IA64, ARM or zero
   297 ADD_SA_BINARIES/x86   = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
   298                         $(EXPORT_LIB_DIR)/sa-jdi.jar
   299 ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
   300                         $(EXPORT_LIB_DIR)/sa-jdi.jar
   301 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   302   ifeq ($(ZIP_DEBUGINFO_FILES),1)
   303     ADD_SA_BINARIES/x86   += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz
   304     ADD_SA_BINARIES/sparc += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz
   305   else
   306     ADD_SA_BINARIES/x86   += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo
   307     ADD_SA_BINARIES/sparc += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo
   308   endif
   309 endif
   310 ADD_SA_BINARIES/ppc   =
   311 ADD_SA_BINARIES/ia64  =
   312 ADD_SA_BINARIES/arm   =
   313 ADD_SA_BINARIES/zero  =
   315 -include $(HS_ALT_MAKE)/linux/makefiles/defs.make
   317 EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))

mercurial