make/common/NativeCompilation.gmk
changeset 36506 17612cee3530
parent 36052 484beb823486
child 36541 5a025732e169
equal deleted inserted replaced
36505:17460b0304f4 36506:17612cee3530
    72 #   LD - The Linker
    72 #   LD - The Linker
    73 #   AR - Static linker
    73 #   AR - Static linker
    74 #   AS - Assembler
    74 #   AS - Assembler
    75 #   MT - Windows MT tool
    75 #   MT - Windows MT tool
    76 #   RC - Windows RC tool
    76 #   RC - Windows RC tool
       
    77 #   OBJCOPY - The objcopy tool for debug symbol handling
    77 #   STRIP - The tool to use for stripping debug symbols
    78 #   STRIP - The tool to use for stripping debug symbols
    78 #   SYSROOT_CFLAGS - Compiler flags for using the specific sysroot
    79 #   SYSROOT_CFLAGS - Compiler flags for using the specific sysroot
    79 #   SYSROOT_LDFLAGS - Linker flags for using the specific sysroot
    80 #   SYSROOT_LDFLAGS - Linker flags for using the specific sysroot
    80 DefineNativeToolchain = $(NamedParamsMacroTemplate)
    81 DefineNativeToolchain = $(NamedParamsMacroTemplate)
    81 define DefineNativeToolchainBody
    82 define DefineNativeToolchainBody
    88     $$(call SetIfEmpty, $1_LD, $$($$($1_EXTENDS)_LD))
    89     $$(call SetIfEmpty, $1_LD, $$($$($1_EXTENDS)_LD))
    89     $$(call SetIfEmpty, $1_AR, $$($$($1_EXTENDS)_AR))
    90     $$(call SetIfEmpty, $1_AR, $$($$($1_EXTENDS)_AR))
    90     $$(call SetIfEmpty, $1_AS, $$($$($1_EXTENDS)_AS))
    91     $$(call SetIfEmpty, $1_AS, $$($$($1_EXTENDS)_AS))
    91     $$(call SetIfEmpty, $1_MT, $$($$($1_EXTENDS)_MT))
    92     $$(call SetIfEmpty, $1_MT, $$($$($1_EXTENDS)_MT))
    92     $$(call SetIfEmpty, $1_RC, $$($$($1_EXTENDS)_RC))
    93     $$(call SetIfEmpty, $1_RC, $$($$($1_EXTENDS)_RC))
       
    94     $$(call SetIfEmpty, $1_OBJCOPY, $$($$($1_EXTENDS)_OBJCOPY))
    93     $$(call SetIfEmpty, $1_STRIP, $$($$($1_EXTENDS)_STRIP))
    95     $$(call SetIfEmpty, $1_STRIP, $$($$($1_EXTENDS)_STRIP))
    94     $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_EXTENDS)_SYSROOT_CFLAGS))
    96     $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_EXTENDS)_SYSROOT_CFLAGS))
    95     $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_EXTENDS)_SYSROOT_LDFLAGS))
    97     $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_EXTENDS)_SYSROOT_LDFLAGS))
    96   endif
    98   endif
    97 endef
    99 endef
   103     LD := $(LD), \
   105     LD := $(LD), \
   104     AR := $(AR), \
   106     AR := $(AR), \
   105     AS := $(AS), \
   107     AS := $(AS), \
   106     MT := $(MT), \
   108     MT := $(MT), \
   107     RC := $(RC), \
   109     RC := $(RC), \
       
   110     OBJCOPY := $(OBJCOPY), \
   108     STRIP := $(STRIP), \
   111     STRIP := $(STRIP), \
   109     SYSROOT_CFLAGS := $(SYSROOT_CFLAGS), \
   112     SYSROOT_CFLAGS := $(SYSROOT_CFLAGS), \
   110     SYSROOT_LDFLAGS := $(SYSROOT_LDFLAGS), \
   113     SYSROOT_LDFLAGS := $(SYSROOT_LDFLAGS), \
   111 ))
   114 ))
   112 
   115 
   116     LD := $(LDCXX), \
   119     LD := $(LDCXX), \
   117 ))
   120 ))
   118 
   121 
   119 # Create a toolchain with the BUILD compiler, used for build tools that
   122 # Create a toolchain with the BUILD compiler, used for build tools that
   120 # are to be run during the build.
   123 # are to be run during the build.
   121 # The BUILD_SYSROOT_*FLAGS variables are empty for now.
       
   122 $(eval $(call DefineNativeToolchain, TOOLCHAIN_BUILD, \
   124 $(eval $(call DefineNativeToolchain, TOOLCHAIN_BUILD, \
   123     CC := $(BUILD_CC), \
   125     CC := $(BUILD_CC), \
   124     CXX := $(BUILD_CXX), \
   126     CXX := $(BUILD_CXX), \
   125     LD := $(BUILD_LD), \
   127     LD := $(BUILD_LD), \
   126     AR := $(BUILD_AR), \
   128     AR := $(BUILD_AR), \
   127     AS := $(BUILD_AS), \
   129     AS := $(BUILD_AS), \
       
   130     OBJCOPY := $(BUILD_OBJCOPY), \
       
   131     STRIP := $(BUILD_STRIP), \
   128     SYSROOT_CFLAGS := $(BUILD_SYSROOT_CFLAGS), \
   132     SYSROOT_CFLAGS := $(BUILD_SYSROOT_CFLAGS), \
   129     SYSROOT_LDFLAGS := $(BUILD_SYSROOT_LDFLAGS), \
   133     SYSROOT_LDFLAGS := $(BUILD_SYSROOT_LDFLAGS), \
   130 ))
   134 ))
   131 
   135 
   132 # BUILD toolchain with the C++ linker
   136 # BUILD toolchain with the C++ linker
   435   $$(call SetIfEmpty, $1_LD, $$($$($1_TOOLCHAIN)_LD))
   439   $$(call SetIfEmpty, $1_LD, $$($$($1_TOOLCHAIN)_LD))
   436   $$(call SetIfEmpty, $1_AR, $$($$($1_TOOLCHAIN)_AR))
   440   $$(call SetIfEmpty, $1_AR, $$($$($1_TOOLCHAIN)_AR))
   437   $$(call SetIfEmpty, $1_AS, $$($$($1_TOOLCHAIN)_AS))
   441   $$(call SetIfEmpty, $1_AS, $$($$($1_TOOLCHAIN)_AS))
   438   $$(call SetIfEmpty, $1_MT, $$($$($1_TOOLCHAIN)_MT))
   442   $$(call SetIfEmpty, $1_MT, $$($$($1_TOOLCHAIN)_MT))
   439   $$(call SetIfEmpty, $1_RC, $$($$($1_TOOLCHAIN)_RC))
   443   $$(call SetIfEmpty, $1_RC, $$($$($1_TOOLCHAIN)_RC))
       
   444   $$(call SetIfEmpty, $1_OBJCOPY, $$($$($1_TOOLCHAIN)_OBJCOPY))
   440   $$(call SetIfEmpty, $1_STRIP, $$($$($1_TOOLCHAIN)_STRIP))
   445   $$(call SetIfEmpty, $1_STRIP, $$($$($1_TOOLCHAIN)_STRIP))
   441   $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_CFLAGS))
   446   $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_CFLAGS))
   442   $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_LDFLAGS))
   447   $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_LDFLAGS))
   443 
   448 
   444   ifneq ($$($1_MANIFEST), )
   449   ifneq ($$($1_MANIFEST), )
   718         else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
   723         else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
   719           $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
   724           $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
   720           # Setup the command line creating debuginfo files, to be run after linking.
   725           # Setup the command line creating debuginfo files, to be run after linking.
   721           # It cannot be run separately since it updates the original target file
   726           # It cannot be run separately since it updates the original target file
   722           $1_CREATE_DEBUGINFO_CMDS := \
   727           $1_CREATE_DEBUGINFO_CMDS := \
   723               $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
   728             $$($1_OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
   724               $(CD) $$($1_OUTPUT_DIR) && \
   729             $(CD) $$($1_OUTPUT_DIR) && \
   725                   $(OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
   730                 $$($1_OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
   726 
   731 
   727         else ifeq ($(OPENJDK_TARGET_OS), macosx)
   732         else ifeq ($(OPENJDK_TARGET_OS), macosx)
   728           $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM
   733           $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM
   729           # On Macosx, the debuginfo generation doesn't touch the linked binary, but
   734           # On Macosx, the debuginfo generation doesn't touch the linked binary, but
   730           # to avoid always relinking, touch it anyway to force a later timestamp than
   735           # to avoid always relinking, touch it anyway to force a later timestamp than