make/common/NativeCompilation.gmk

Thu, 27 Dec 2018 11:47:57 +0800

author
aoqi
date
Thu, 27 Dec 2018 11:47:57 +0800
changeset 2316
64a3eeabf6e5
parent 2236
19e8754f5415
parent 2003
2224002fc647
child 2408
2e38e8d106de
permissions
-rw-r--r--

Merge

aoqi@0 1 #
kevinw@2206 2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 #
aoqi@0 5 # This code is free software; you can redistribute it and/or modify it
aoqi@0 6 # under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 # published by the Free Software Foundation. Oracle designates this
aoqi@0 8 # particular file as subject to the "Classpath" exception as provided
aoqi@0 9 # by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 #
aoqi@0 11 # This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 # version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 # accompanied this code).
aoqi@0 16 #
aoqi@0 17 # You should have received a copy of the GNU General Public License version
aoqi@0 18 # 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 #
aoqi@0 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 # or visit www.oracle.com if you need additional information or have any
aoqi@0 23 # questions.
aoqi@0 24 #
aoqi@0 25
aoqi@0 26 # When you read this source. Remember that $(sort ...) has the side effect
aoqi@0 27 # of removing duplicates. It is actually this side effect that is
aoqi@0 28 # desired whenever sort is used below!
aoqi@0 29
aoqi@0 30 ifeq (,$(_MAKEBASE_GMK))
aoqi@0 31 $(error You must include MakeBase.gmk prior to including NativeCompilation.gmk)
aoqi@0 32 endif
aoqi@0 33
kevinw@2206 34 ifneq ($(TOOLCHAIN_TYPE), microsoft)
aoqi@0 35 COMPILING_MSG=echo $(LOG_INFO) "Compiling $(notdir $1) (for $(notdir $2))"
aoqi@0 36 LINKING_MSG=echo $(LOG_INFO) "Linking $1"
aoqi@0 37 LINKING_EXE_MSG=echo $(LOG_INFO) "Linking executable $1"
aoqi@0 38 ARCHIVING_MSG=echo $(LOG_INFO) "Archiving $1"
aoqi@0 39 else
aoqi@0 40 COMPILING_MSG=
aoqi@0 41 LINKING_MSG=
aoqi@0 42 LINKING_EXE_MSG=
aoqi@0 43 ARCHIVING_MSG=
aoqi@0 44 endif
aoqi@0 45
kevinw@2219 46 ifeq ($(OPENJDK_BUILD_OS_ENV), windows.cygwin)
kevinw@2219 47 UNIX_PATH_PREFIX := /cygdrive
kevinw@2219 48 else ifeq ($(OPENJDK_BUILD_OS_ENV), windows.msys)
kevinw@2219 49 UNIX_PATH_PREFIX :=
kevinw@2219 50 endif
kevinw@2219 51
aoqi@0 52 define add_native_source
aoqi@0 53 # param 1 = BUILD_MYPACKAGE
aoqi@0 54 # parma 2 = the source file name (..../alfa.c or .../beta.cpp)
aoqi@0 55 # param 3 = the bin dir that stores all .o (.obj) and .d files.
aoqi@0 56 # param 4 = the c flags to the compiler
aoqi@0 57 # param 5 = the c compiler
aoqi@0 58 # param 6 = the c++ flags to the compiler
aoqi@0 59 # param 7 = the c++ compiler
aoqi@0 60 # param 8 = the flags to the assembler
aoqi@0 61
aoqi@0 62 ifneq (,$$(filter %.c,$2))
aoqi@0 63 # Compile as a C file
aoqi@0 64 $1_$2_FLAGS=$4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$(<F)"' -c
aoqi@0 65 $1_$2_COMP=$5
aoqi@0 66 $1_$2_DEP_FLAG:=$(C_FLAG_DEPS)
aoqi@0 67 else ifneq (,$$(filter %.m,$2))
aoqi@0 68 # Compile as a objective-c file
aoqi@0 69 $1_$2_FLAGS=-x objective-c $4 $$($1_$(notdir $2)_CFLAGS) -DTHIS_FILE='"$$(<F)"' -c
aoqi@0 70 $1_$2_COMP=$5
aoqi@0 71 $1_$2_DEP_FLAG:=$(C_FLAG_DEPS)
aoqi@0 72 else ifneq (,$$(filter %.s,$2))
aoqi@0 73 # Compile as assembler file
aoqi@0 74 $1_$2_FLAGS=$8 -DTHIS_FILE='"$$(<F)"'
aoqi@0 75 $1_$2_COMP=$(AS)
aoqi@0 76 $1_$2_DEP_FLAG:=
aoqi@0 77 else
aoqi@0 78 # Compile as a C++ file
aoqi@0 79 $1_$2_FLAGS=$6 $$($1_$(notdir $2)_CXXFLAGS) -DTHIS_FILE='"$$(<F)"' -c
aoqi@0 80 $1_$2_COMP=$7
aoqi@0 81 $1_$2_DEP_FLAG:=$(CXX_FLAG_DEPS)
aoqi@0 82 endif
aoqi@0 83 # Generate the .o (.obj) file name and place it in the bin dir.
aoqi@0 84 $1_$2_OBJ:=$3/$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(patsubst %.m,%$(OBJ_SUFFIX),$$(patsubst %.s,%$(OBJ_SUFFIX),$$(notdir $2)))))
aoqi@0 85 # Only continue if this object file hasn't been processed already. This lets the first found
aoqi@0 86 # source file override any other with the same name.
aoqi@0 87 ifeq (,$$(findstring $$($1_$2_OBJ),$$($1_OBJS_SO_FAR)))
aoqi@0 88 $1_OBJS_SO_FAR+=$$($1_$2_OBJ)
aoqi@0 89 ifeq (,$$(filter %.s,$2))
aoqi@0 90 # And this is the dependency file for this obj file.
aoqi@0 91 $1_$2_DEP:=$$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_$2_OBJ))
aoqi@0 92 # Include previously generated dependency information. (if it exists)
aoqi@0 93 -include $$($1_$2_DEP)
aoqi@0 94
kevinw@2206 95 ifeq ($(TOOLCHAIN_TYPE), microsoft)
aoqi@0 96 $1_$2_DEBUG_OUT_FLAGS:=-Fd$$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ)) \
aoqi@0 97 -Fm$$(patsubst %$(OBJ_SUFFIX),%.map,$$($1_$2_OBJ))
aoqi@0 98 endif
aoqi@0 99 endif
aoqi@0 100
aoqi@0 101 $$($1_$2_OBJ) : $2
kevinw@2206 102 ifneq ($(TOOLCHAIN_TYPE), microsoft)
aoqi@0 103 $$(call COMPILING_MSG,$2,$$($1_TARGET))
kevinw@2206 104 # The Solaris studio compiler doesn't output the full path to the object file in the
aoqi@0 105 # generated deps files. Fixing it with sed. If compiling assembly, don't try this.
kevinw@2206 106 ifeq ($(TOOLCHAIN_TYPE)$$(filter %.s,$2), solstudio)
aoqi@0 107 $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP).tmp $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
aoqi@0 108 $(SED) 's|^$$(@F):|$$@:|' $$($1_$2_DEP).tmp > $$($1_$2_DEP)
aoqi@0 109 else
aoqi@0 110 $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
aoqi@0 111 endif
aoqi@0 112 endif
aoqi@0 113 # The Visual Studio compiler lacks a feature for generating make dependencies, but by
aoqi@0 114 # setting -showIncludes, all included files are printed. These are filtered out and
aoqi@0 115 # parsed into make dependences.
kevinw@2206 116 ifeq ($(TOOLCHAIN_TYPE), microsoft)
aoqi@0 117 ($$($1_$2_COMP) $$($1_$2_FLAGS) -showIncludes $$($1_$2_DEBUG_OUT_FLAGS) \
aoqi@0 118 $(CC_OUT_OPTION)$$($1_$2_OBJ) $2 ; echo $$$$? > $$($1_$2_DEP).exitvalue) \
aoqi@0 119 | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v "^Note: including file:" \
aoqi@0 120 && exit `cat $$($1_$2_DEP).exitvalue`
aoqi@0 121 $(RM) $$($1_$2_DEP).exitvalue
aoqi@0 122 ($(ECHO) $$@: \\ \
aoqi@0 123 && $(SED) -e '/^Note: including file:/!d' \
aoqi@0 124 -e 's|Note: including file: *||' \
kevinw@2217 125 -e 's|\r||g' \
aoqi@0 126 -e 's|\\|/|g' \
kevinw@2219 127 -e 's|^\([a-zA-Z]\):|$(UNIX_PATH_PREFIX)/\1|g' \
aoqi@0 128 -e '/$(subst /,\/,$(TOPDIR))/!d' \
aoqi@0 129 -e 's|$$$$| \\|g' \
aoqi@0 130 $$($1_$2_DEP).raw) > $$($1_$2_DEP)
aoqi@0 131 endif
aoqi@0 132 endif
aoqi@0 133 endef
aoqi@0 134
aoqi@0 135 define SetupNativeCompilation
aoqi@0 136 # param 1 is for example BUILD_MYPACKAGE
aoqi@0 137 # param 2,3,4,5,6,7,8 are named args.
aoqi@0 138 # SRC one or more directory roots to scan for C/C++ files.
aoqi@0 139 # LANG C or C++
aoqi@0 140 # CFLAGS the compiler flags to be used, used both for C and C++.
aoqi@0 141 # CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS.
aoqi@0 142 # LDFLAGS the linker flags to be used, used both for C and C++.
aoqi@0 143 # LDFLAGS_SUFFIX the linker flags to be added last on the commandline
aoqi@0 144 # typically the libraries linked to.
aoqi@0 145 # ARFLAGS the archiver flags to be used
aoqi@0 146 # OBJECT_DIR the directory where we store the object files
aoqi@0 147 # LIBRARY the resulting library file
aoqi@0 148 # PROGRAM the resulting exec file
aoqi@0 149 # INCLUDES only pick source from these directories
aoqi@0 150 # EXCLUDES do not pick source from these directories
aoqi@0 151 # INCLUDE_FILES only compile exactly these files!
aoqi@0 152 # EXCLUDE_FILES with these names
aoqi@0 153 # VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
aoqi@0 154 # RC_FLAGS flags for RC.
aoqi@0 155 # MAPFILE mapfile
aoqi@0 156 # REORDER reorder file
aoqi@0 157 # DEBUG_SYMBOLS add debug symbols (if configured on)
aoqi@0 158 # CC the compiler to use, default is $(CC)
aoqi@0 159 # LDEXE the linker to use for linking executables, default is $(LDEXE)
aoqi@0 160 # OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST
aoqi@0 161 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
aoqi@0 162 $(call LogSetupMacroEntry,SetupNativeCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25),$(26))
aoqi@0 163 $(if $(27),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
aoqi@0 164
aoqi@0 165 ifneq (,$$($1_BIN))
aoqi@0 166 $$(error BIN has been replaced with OBJECT_DIR)
aoqi@0 167 endif
aoqi@0 168
aoqi@0 169 ifneq (,$$($1_LIB))
aoqi@0 170 $$(error LIB has been replaced with LIBRARY)
aoqi@0 171 endif
aoqi@0 172
aoqi@0 173 ifneq (,$$($1_EXE))
aoqi@0 174 $$(error EXE has been replaced with PROGRAM)
aoqi@0 175 endif
aoqi@0 176
aoqi@0 177 ifneq (,$$($1_LIBRARY))
aoqi@0 178 ifeq (,$$($1_OUTPUT_DIR))
aoqi@0 179 $$(error LIBRARY requires OUTPUT_DIR)
aoqi@0 180 endif
aoqi@0 181
aoqi@0 182 ifneq ($$($1_LIBRARY),$(basename $$($1_LIBRARY)))
aoqi@0 183 $$(error directory of LIBRARY should be specified using OUTPUT_DIR)
aoqi@0 184 endif
aoqi@0 185
aoqi@0 186 ifneq (,$(findstring $(SHARED_LIBRARY_SUFFIX),$$($1_LIBRARY)))
aoqi@0 187 $$(error LIBRARY should be specified without SHARED_LIBRARY_SUFFIX: $(SHARED_LIBRARY_SUFFIX))
aoqi@0 188 endif
aoqi@0 189
aoqi@0 190 ifneq (,$(findstring $(LIBRARY_PREFIX),$$($1_LIBRARY)))
aoqi@0 191 $$(error LIBRARY should be specified without LIBRARY_PREFIX: $(LIBRARY_PREFIX))
aoqi@0 192 endif
aoqi@0 193
aoqi@0 194 $1_BASENAME:=$(LIBRARY_PREFIX)$$($1_LIBRARY)$(SHARED_LIBRARY_SUFFIX)
aoqi@0 195 $1_TARGET:=$$($1_OUTPUT_DIR)/$$($1_BASENAME)
aoqi@0 196
aoqi@0 197 endif
aoqi@0 198
aoqi@0 199 ifneq (,$$($1_STATIC_LIBRARY))
aoqi@0 200 ifeq (,$$($1_OUTPUT_DIR))
aoqi@0 201 $$(error STATIC_LIBRARY requires OUTPUT_DIR)
aoqi@0 202 endif
aoqi@0 203
aoqi@0 204 ifneq ($$($1_STATIC_LIBRARY),$(basename $$($1_STATIC_LIBRARY)))
aoqi@0 205 $$(error directory of STATIC_LIBRARY should be specified using OUTPUT_DIR)
aoqi@0 206 endif
aoqi@0 207
aoqi@0 208 ifneq (,$(findstring $(STATIC_LIBRARY_SUFFIX),$$($1_STATIC_LIBRARY)))
aoqi@0 209 $$(error STATIC_LIBRARY should be specified without STATIC_LIBRARY_SUFFIX: $(STATIC_LIBRARY_SUFFIX))
aoqi@0 210 endif
aoqi@0 211
aoqi@0 212 ifneq (,$(findstring $(LIBRARY_PREFIX),$$($1_STATIC_LIBRARY)))
aoqi@0 213 $$(error STATIC_LIBRARY should be specified without LIBRARY_PREFIX: $(LIBRARY_PREFIX))
aoqi@0 214 endif
aoqi@0 215
aoqi@0 216 $1_BASENAME:=$(LIBRARY_PREFIX)$$($1_STATIC_LIBRARY)$(STATIC_LIBRARY_SUFFIX)
aoqi@0 217 $1_TARGET:=$$($1_OUTPUT_DIR)/$$($1_BASENAME)
aoqi@0 218 endif
aoqi@0 219
aoqi@0 220 ifneq (,$$($1_PROGRAM))
aoqi@0 221 ifeq (,$$($1_OUTPUT_DIR))
aoqi@0 222 $$(error PROGRAM requires OUTPUT_DIR)
aoqi@0 223 endif
aoqi@0 224
aoqi@0 225 ifneq ($$($1_PROGRAM),$(basename $$($1_PROGRAM)))
aoqi@0 226 $$(error directory of PROGRAM should be specified using OUTPUT_DIR)
aoqi@0 227 endif
aoqi@0 228
aoqi@0 229 ifneq (,$(findstring $(EXE_SUFFIX),$$($1_PROGRAM)))
aoqi@0 230 $$(error PROGRAM should be specified without EXE_SUFFIX: $(EXE_SUFFIX))
aoqi@0 231 endif
aoqi@0 232
aoqi@0 233 $1_BASENAME:=$$($1_PROGRAM)$(EXE_SUFFIX)
aoqi@0 234 $1_TARGET:=$$($1_OUTPUT_DIR)/$$($1_BASENAME)
aoqi@0 235
aoqi@0 236 endif
aoqi@0 237
aoqi@0 238 ifeq (,$$($1_TARGET))
aoqi@0 239 $$(error Neither PROGRAM, LIBRARY nor STATIC_LIBRARY has been specified for SetupNativeCompilation)
aoqi@0 240 endif
aoqi@0 241
aoqi@0 242 ifeq (,$$($1_LANG))
aoqi@0 243 $$(error You have to specify LANG for native compilation $1)
aoqi@0 244 endif
aoqi@0 245 ifeq (C,$$($1_LANG))
aoqi@0 246 ifeq ($$($1_LDEXE),)
aoqi@0 247 $1_LDEXE:=$(LDEXE)
aoqi@0 248 endif
aoqi@0 249 $1_LD:=$(LD)
aoqi@0 250 else
aoqi@0 251 ifeq (C++,$$($1_LANG))
aoqi@0 252 $1_LD:=$(LDCXX)
aoqi@0 253 $1_LDEXE:=$(LDEXECXX)
aoqi@0 254 else
aoqi@0 255 $$(error Unknown native language $$($1_LANG) for $1)
aoqi@0 256 endif
aoqi@0 257 endif
aoqi@0 258
aoqi@0 259 ifeq ($$($1_CC),)
aoqi@0 260 $1_CC:=$(CC)
aoqi@0 261 endif
aoqi@0 262
sgehwolf@2236 263 ifeq ($$($1_STRIP_POLICY),)
sgehwolf@2236 264 $1_STRIP_POLICY:=$$(STRIP_POLICY)
sgehwolf@2236 265 endif
sgehwolf@2236 266
aoqi@0 267 # Make sure the dirs exist.
aoqi@0 268 $$(eval $$(call MakeDir,$$($1_OBJECT_DIR) $$($1_OUTPUT_DIR)))
aoqi@0 269 $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d)))
aoqi@0 270
aoqi@0 271 # Find all files in the source trees. Sort to remove duplicates.
aoqi@0 272 $1_ALL_SRCS := $$(sort $$(call CacheFind,$$($1_SRC)))
aoqi@0 273 # Extract the C/C++ files.
aoqi@0 274 $1_EXCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_EXCLUDE_FILES)))
aoqi@0 275 $1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
aoqi@0 276 ifneq ($$($1_EXCLUDE_FILES),)
aoqi@0 277 $1_EXCLUDE_FILES:=$$(addprefix %,$$($1_EXCLUDE_FILES))
aoqi@0 278 endif
aoqi@0 279 $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES),$$(filter %.s %.c %.cpp %.m,$$($1_ALL_SRCS)))
aoqi@0 280 ifneq (,$$(strip $$($1_INCLUDE_FILES)))
aoqi@0 281 $1_SRCS := $$(filter $$($1_INCLUDE_FILES),$$($1_SRCS))
aoqi@0 282 endif
aoqi@0 283 ifeq (,$$($1_SRCS))
aoqi@0 284 $$(error No sources found for $1 when looking inside the dirs $$($1_SRC))
aoqi@0 285 endif
aoqi@0 286 # There can be only a single bin dir root, no need to foreach over the roots.
aoqi@0 287 $1_BINS := $$(wildcard $$($1_OBJECT_DIR)/*$(OBJ_SUFFIX))
aoqi@0 288 # Now we have a list of all c/c++ files to compile: $$($1_SRCS)
aoqi@0 289 # and we have a list of all existing object files: $$($1_BINS)
aoqi@0 290
aoqi@0 291 # Prepend the source/bin path to the filter expressions. Then do the filtering.
aoqi@0 292 ifneq ($$($1_INCLUDES),)
aoqi@0 293 $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES))))
aoqi@0 294 $1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
aoqi@0 295 endif
aoqi@0 296 ifneq ($$($1_EXCLUDES),)
aoqi@0 297 $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
aoqi@0 298 $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
aoqi@0 299 endif
aoqi@0 300
aoqi@0 301 # Calculate the expected output from compiling the sources (sort to remove duplicates. Also provides
aoqi@0 302 # a reproducable order on the input files to the linker).
aoqi@0 303 $1_EXPECTED_OBJS:=$$(sort $$(addprefix $$($1_OBJECT_DIR)/,$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(patsubst %.m,%$(OBJ_SUFFIX),$$(patsubst %.s,%$(OBJ_SUFFIX),$$(notdir $$($1_SRCS))))))))
aoqi@0 304 # Are there too many object files on disk? Perhaps because some source file was removed?
aoqi@0 305 $1_SUPERFLOUS_OBJS:=$$(sort $$(filter-out $$($1_EXPECTED_OBJS),$$($1_BINS)))
aoqi@0 306 # Clean out the superfluous object files.
aoqi@0 307 ifneq ($$($1_SUPERFLUOUS_OBJS),)
aoqi@0 308 $$(shell $(RM) -f $$($1_SUPERFLUOUS_OBJS))
aoqi@0 309 endif
aoqi@0 310
gromero@1879 311 # Pickup extra OPENJDK_TARGET_OS_API, OPENJDK_TARGET_OS, and/or OPENJDK_TARGET_OS plus
gromero@1879 312 # OPENJDK_TARGET_CPU pair dependent variables for CFLAGS.
gromero@1879 313 $1_EXTRA_CFLAGS:=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_CFLAGS_$(OPENJDK_TARGET_OS)) \
gromero@1879 314 $$($1_CFLAGS_$(OPENJDK_TARGET_OS)_$(OPENJDK_TARGET_CPU))
aoqi@0 315 ifneq ($(DEBUG_LEVEL),release)
aoqi@0 316 # Pickup extra debug dependent variables for CFLAGS
aoqi@0 317 $1_EXTRA_CFLAGS+=$$($1_CFLAGS_debug)
aoqi@0 318 $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)_debug)
aoqi@0 319 $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS)_debug)
gromero@1879 320 $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS)_$(OPENJDK_TARGET_CPU)_debug)
aoqi@0 321 else
aoqi@0 322 $1_EXTRA_CFLAGS+=$$($1_CFLAGS_release)
aoqi@0 323 $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)_release)
aoqi@0 324 $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS)_release)
gromero@1879 325 $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(OPENJDK_TARGET_OS)_$(OPENJDK_TARGET_CPU)_release)
aoqi@0 326 endif
aoqi@0 327
aoqi@0 328 # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables for CXXFLAGS.
aoqi@0 329 $1_EXTRA_CXXFLAGS:=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_CXXFLAGS_$(OPENJDK_TARGET_OS))
aoqi@0 330 ifneq ($(DEBUG_LEVEL),release)
aoqi@0 331 # Pickup extra debug dependent variables for CXXFLAGS
aoqi@0 332 $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_debug)
aoqi@0 333 $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_API)_debug)
aoqi@0 334 $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_debug)
aoqi@0 335 else
aoqi@0 336 $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_release)
aoqi@0 337 $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS_API)_release)
aoqi@0 338 $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(OPENJDK_TARGET_OS)_release)
aoqi@0 339 endif
aoqi@0 340
omajid@1409 341 ifeq ($$($1_CXXFLAGS),)
omajid@1409 342 $1_CXXFLAGS:=$$($1_CFLAGS)
omajid@1409 343 endif
omajid@1409 344 ifeq ($$(strip $$($1_EXTRA_CXXFLAGS)),)
omajid@1409 345 $1_EXTRA_CXXFLAGS:=$$($1_EXTRA_CFLAGS)
omajid@1409 346 endif
omajid@1409 347
aoqi@0 348 ifneq (,$$($1_DEBUG_SYMBOLS))
aoqi@0 349 ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
aoqi@0 350 ifdef OPENJDK
aoqi@0 351 # Always add debug symbols
aoqi@0 352 $1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
aoqi@0 353 $1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
aoqi@0 354 else
aoqi@0 355 # Programs don't get the debug symbols added in the old build. It's not clear if
aoqi@0 356 # this is intentional.
aoqi@0 357 ifeq ($$($1_PROGRAM),)
aoqi@0 358 $1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
aoqi@0 359 $1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
aoqi@0 360 endif
aoqi@0 361 endif
aoqi@0 362 endif
aoqi@0 363 endif
aoqi@0 364
aoqi@0 365 ifneq (,$$($1_REORDER))
aoqi@0 366 $1_EXTRA_CFLAGS += $$(C_FLAG_REORDER)
aoqi@0 367 $1_EXTRA_CXXFLAGS += $$(CXX_FLAG_REORDER)
aoqi@0 368 endif
aoqi@0 369
aoqi@0 370 ifeq (NONE, $$($1_OPTIMIZATION))
aoqi@0 371 $1_EXTRA_CFLAGS += $(C_O_FLAG_NONE)
aoqi@0 372 $1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_NONE)
aoqi@0 373 else ifeq (LOW, $$($1_OPTIMIZATION))
aoqi@0 374 $1_EXTRA_CFLAGS += $(C_O_FLAG_NORM)
aoqi@0 375 $1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_NORM)
aoqi@0 376 else ifeq (HIGH, $$($1_OPTIMIZATION))
aoqi@0 377 $1_EXTRA_CFLAGS += $(C_O_FLAG_HI)
aoqi@0 378 $1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_HI)
aoqi@0 379 else ifeq (HIGHEST, $$($1_OPTIMIZATION))
aoqi@0 380 $1_EXTRA_CFLAGS += $(C_O_FLAG_HIGHEST)
aoqi@0 381 $1_EXTRA_CXXFLAGS += $(CXX_O_FLAG_HIGHEST)
aoqi@0 382 else ifneq (, $$($1_OPTIMIZATION))
aoqi@0 383 $$(error Unknown value for OPTIMIZATION: $$($1_OPTIMIZATION))
aoqi@0 384 endif
aoqi@0 385
kevinw@2215 386 # Add sys root specific cflags last
kevinw@2215 387 $1_EXTRA_CFLAGS += $(SYSROOT_CFLAGS)
kevinw@2215 388 $1_EXTRA_CXXFLAGS += $(SYSROOT_CFLAGS)
kevinw@2215 389
aoqi@0 390 # Now call add_native_source for each source file we are going to compile.
aoqi@0 391 $$(foreach p,$$($1_SRCS), \
aoqi@0 392 $$(eval $$(call add_native_source,$1,$$p,$$($1_OBJECT_DIR), \
aoqi@0 393 $$($1_CFLAGS) $$($1_EXTRA_CFLAGS),$$($1_CC), \
aoqi@0 394 $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS),$(CXX),$$($1_ASFLAGS))))
aoqi@0 395
aoqi@0 396 # On windows we need to create a resource file
aoqi@0 397 ifeq ($(OPENJDK_TARGET_OS), windows)
aoqi@0 398 ifneq (,$$($1_VERSIONINFO_RESOURCE))
aoqi@0 399 $1_RES:=$$($1_OBJECT_DIR)/$$($1_BASENAME).res
aoqi@0 400 $$($1_RES): $$($1_VERSIONINFO_RESOURCE)
aoqi@0 401 $(RC) $$($1_RC_FLAGS) $(CC_OUT_OPTION)$$@ $$($1_VERSIONINFO_RESOURCE)
aoqi@0 402 endif
aoqi@0 403 ifneq (,$$($1_MANIFEST))
aoqi@0 404 $1_GEN_MANIFEST:=$$($1_OBJECT_DIR)/$$($1_PROGRAM).manifest
aoqi@0 405 IMVERSIONVALUE:=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VERSION).$(COOKED_BUILD_NUMBER)
aoqi@0 406 $$($1_GEN_MANIFEST): $$($1_MANIFEST)
aoqi@0 407 $(SED) 's%IMVERSION%$$(IMVERSIONVALUE)%g;s%PROGRAM%$$($1_PROGRAM)%g' $$< > $$@
aoqi@0 408 endif
aoqi@0 409 endif
aoqi@0 410
aoqi@0 411 # mapfile doesnt seem to be implemented on macosx (yet??)
aoqi@0 412 ifneq ($(OPENJDK_TARGET_OS),macosx)
aoqi@0 413 ifneq ($(OPENJDK_TARGET_OS),windows)
aoqi@0 414 $1_REAL_MAPFILE:=$$($1_MAPFILE)
aoqi@0 415 ifneq (,$$($1_REORDER))
aoqi@0 416 $1_REAL_MAPFILE:=$$($1_OBJECT_DIR)/mapfile
aoqi@0 417
aoqi@0 418 $$($1_REAL_MAPFILE) : $$($1_MAPFILE) $$($1_REORDER)
aoqi@0 419 $$(MKDIR) -p $$(@D)
aoqi@0 420 $$(CP) $$($1_MAPFILE) $$@.tmp
aoqi@0 421 $$(SED) -e 's=OUTPUTDIR=$$($1_OBJECT_DIR)=' $$($1_REORDER) >> $$@.tmp
aoqi@0 422 $$(MV) $$@.tmp $$@
aoqi@0 423 endif
aoqi@0 424 endif
aoqi@0 425 endif
aoqi@0 426
aoqi@0 427 # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables
aoqi@0 428 # for LDFLAGS and LDFLAGS_SUFFIX
aoqi@0 429 $1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS))
aoqi@0 430 $1_EXTRA_LDFLAGS_SUFFIX:=$$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS_API)) $$($1_LDFLAGS_SUFFIX_$(OPENJDK_TARGET_OS))
aoqi@0 431 ifneq (,$$($1_REAL_MAPFILE))
aoqi@0 432 $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE))
aoqi@0 433 endif
aoqi@0 434
kevinw@2215 435 $1_EXTRA_LDFLAGS += $(SYSROOT_LDFLAGS)
kevinw@2215 436
aoqi@0 437 $1 := $$($1_TARGET)
aoqi@0 438 ifneq (,$$($1_LIBRARY))
aoqi@0 439 # Generating a dynamic library.
aoqi@0 440 $1_EXTRA_LDFLAGS+=$$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
aoqi@0 441 ifeq ($(OPENJDK_TARGET_OS), windows)
aoqi@0 442 $1_EXTRA_LDFLAGS+="-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
aoqi@0 443 endif
aoqi@0 444
aoqi@0 445 $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
aoqi@0 446
aoqi@0 447 ifneq (,$$($1_DEBUG_SYMBOLS))
aoqi@0 448 ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
aoqi@0 449 ifeq ($(OPENJDK_TARGET_OS), windows)
aoqi@0 450 $1_EXTRA_LDFLAGS+="-pdb:$$($1_OBJECT_DIR)/$$($1_LIBRARY).pdb" \
aoqi@0 451 "-map:$$($1_OBJECT_DIR)/$$($1_LIBRARY).map"
aoqi@0 452 endif
aoqi@0 453
aoqi@0 454 ifneq ($$($1_OUTPUT_DIR),$$($1_OBJECT_DIR))
aoqi@0 455 $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/%
aoqi@0 456 $(CP) $$< $$@
aoqi@0 457 endif
aoqi@0 458
aoqi@0 459 ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X
aoqi@0 460 ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows
aoqi@0 461 ifeq ($(OPENJDK_TARGET_OS), solaris)
sgehwolf@2236 462 ifneq ($$($1_STRIP_POLICY), no_strip)
sgehwolf@2236 463 # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
sgehwolf@2236 464 # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
sgehwolf@2236 465 # empty section headers until a fixed $(OBJCOPY) is available.
sgehwolf@2236 466 # An empty section header has sh_addr == 0 and sh_size == 0.
sgehwolf@2236 467 # This problem has only been seen on Solaris X64, but we call this tool
sgehwolf@2236 468 # on all Solaris builds just in case.
sgehwolf@2236 469 #
sgehwolf@2236 470 # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
sgehwolf@2236 471 # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
sgehwolf@2236 472 $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \
aoqi@0 473 $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
aoqi@0 474 $(RM) $$@
aoqi@0 475 $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
aoqi@0 476 $(OBJCOPY) --only-keep-debug $$< $$@
aoqi@0 477 $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
sgehwolf@2236 478 endif
aoqi@0 479 else # not solaris
sgehwolf@2236 480 ifneq ($$($1_STRIP_POLICY), no_strip)
sgehwolf@2236 481 $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET)
aoqi@0 482 $(RM) $$@
aoqi@0 483 $(OBJCOPY) --only-keep-debug $$< $$@
aoqi@0 484 $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
sgehwolf@2236 485 endif
aoqi@0 486 endif # Touch to not retrigger rule on rebuild
sgehwolf@2236 487 ifneq ($$($1_STRIP_POLICY), no_strip)
aoqi@0 488 $(TOUCH) $$@
sgehwolf@2236 489 endif
aoqi@0 490 endif # !windows
aoqi@0 491 endif # !macosx
aoqi@0 492
aoqi@0 493 ifeq ($(ZIP_DEBUGINFO_FILES), true)
aoqi@0 494 ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet
aoqi@0 495 $1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).diz
aoqi@0 496
aoqi@0 497 ifeq ($(OPENJDK_TARGET_OS), windows)
aoqi@0 498 $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).diz : $$($1_TARGET)
aoqi@0 499 $(CD) $$($1_OBJECT_DIR) \
aoqi@0 500 && $(ZIP) -q $$@ $$($1_LIBRARY).map $$($1_LIBRARY).pdb
aoqi@0 501 else
aoqi@0 502 $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).diz : $$($1_TARGET) \
aoqi@0 503 $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
aoqi@0 504 $(CD) $$($1_OBJECT_DIR) \
aoqi@0 505 && $(ZIP) -q $$@ $$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
aoqi@0 506 endif
aoqi@0 507 endif # no MacOS X support yet
aoqi@0 508 else
aoqi@0 509 ifeq ($(OPENJDK_TARGET_OS), windows)
aoqi@0 510 $1 += $$($1_OUTPUT_DIR)/$$($1_LIBRARY).map \
aoqi@0 511 $$($1_OUTPUT_DIR)/$$($1_LIBRARY).pdb
aoqi@0 512 else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
sgehwolf@2236 513 ifneq ($$($1_STRIP_POLICY), no_strip)
sgehwolf@2236 514 $1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
sgehwolf@2236 515 endif
aoqi@0 516 endif
aoqi@0 517 endif
aoqi@0 518 endif
aoqi@0 519 endif
aoqi@0 520
aoqi@0 521 $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE)
aoqi@0 522 $$(call LINKING_MSG,$$($1_BASENAME))
aoqi@0 523 $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \
aoqi@0 524 $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
aoqi@0 525 $$($1_EXTRA_LDFLAGS_SUFFIX)
aoqi@0 526
aoqi@0 527 endif
aoqi@0 528
aoqi@0 529 ifneq (,$$($1_STATIC_LIBRARY))
aoqi@0 530 # Generating a static library, ie object file archive.
aoqi@0 531 $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES)
aoqi@0 532 $$(call ARCHIVING_MSG,$$($1_LIBRARY))
aoqi@0 533 $(AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_EXPECTED_OBJS) \
aoqi@0 534 $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
aoqi@0 535 endif
aoqi@0 536
aoqi@0 537 ifneq (,$$($1_PROGRAM))
aoqi@0 538 # A executable binary has been specified, setup the target for it.
aoqi@0 539 ifneq (,$$($1_DEBUG_SYMBOLS))
aoqi@0 540 ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
aoqi@0 541 ifeq ($(OPENJDK_TARGET_OS), windows)
aoqi@0 542 $1_EXTRA_LDFLAGS+="-pdb:$$($1_OBJECT_DIR)/$$($1_PROGRAM).pdb" \
aoqi@0 543 "-map:$$($1_OBJECT_DIR)/$$($1_PROGRAM).map"
aoqi@0 544 endif
aoqi@0 545
aoqi@0 546 ifneq ($$($1_OUTPUT_DIR),$$($1_OBJECT_DIR))
aoqi@0 547 $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/%
aoqi@0 548 $(CP) $$< $$@
aoqi@0 549 endif
aoqi@0 550
aoqi@0 551 ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X
aoqi@0 552 ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows
aoqi@0 553 ifeq ($(OPENJDK_TARGET_OS), solaris)
sgehwolf@2236 554 ifneq ($$($1_STRIP_POLICY), no_strip)
sgehwolf@2236 555 # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
sgehwolf@2236 556 # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
sgehwolf@2236 557 # empty section headers until a fixed $(OBJCOPY) is available.
sgehwolf@2236 558 # An empty section header has sh_addr == 0 and sh_size == 0.
sgehwolf@2236 559 # This problem has only been seen on Solaris X64, but we call this tool
sgehwolf@2236 560 # on all Solaris builds just in case.
sgehwolf@2236 561 #
sgehwolf@2236 562 # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
sgehwolf@2236 563 # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
sgehwolf@2236 564 $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \
aoqi@0 565 $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
aoqi@0 566 $(RM) $$@
aoqi@0 567 $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
aoqi@0 568 $(OBJCOPY) --only-keep-debug $$< $$@
aoqi@0 569 $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
sgehwolf@2236 570 endif
aoqi@0 571 else # not solaris
sgehwolf@2236 572 ifneq ($$($1_STRIP_POLICY), no_strip)
sgehwolf@2236 573 $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET)
aoqi@0 574 $(RM) $$@
aoqi@0 575 $(OBJCOPY) --only-keep-debug $$< $$@
aoqi@0 576 $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
sgehwolf@2236 577 endif
aoqi@0 578 endif
sgehwolf@2236 579 ifneq ($$($1_STRIP_POLICY), no_strip)
aoqi@0 580 $(TOUCH) $$@
sgehwolf@2236 581 endif
aoqi@0 582 endif # !windows
aoqi@0 583 endif # !macosx
aoqi@0 584
aoqi@0 585 ifeq ($(ZIP_DEBUGINFO_FILES), true)
aoqi@0 586 ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet
aoqi@0 587 $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).diz
aoqi@0 588
aoqi@0 589 ifeq ($(OPENJDK_TARGET_OS), windows)
aoqi@0 590 $$($1_OBJECT_DIR)/$$($1_PROGRAM).diz : $$($1_TARGET)
aoqi@0 591 $(CD) $$($1_OBJECT_DIR) \
aoqi@0 592 && $(ZIP) -q $$@ $$($1_PROGRAM).map $$($1_PROGRAM).pdb
aoqi@0 593 else
aoqi@0 594 $$($1_OBJECT_DIR)/$$(PROGRAM_PREFIX)$$($1_PROGRAM).diz : $$($1_TARGET) \
aoqi@0 595 $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo
aoqi@0 596 $(CD) $$($1_OBJECT_DIR) \
aoqi@0 597 && $(ZIP) -q $$@ $$($1_PROGRAM).debuginfo
aoqi@0 598 endif
aoqi@0 599 endif # no MacOS X support yet
aoqi@0 600 else
aoqi@0 601 ifeq ($(OPENJDK_TARGET_OS), windows)
aoqi@0 602 $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).map \
aoqi@0 603 $$($1_OUTPUT_DIR)/$$($1_PROGRAM).pdb
aoqi@0 604 else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
sgehwolf@2236 605 ifneq ($$($1_STRIP_POLICY), no_strip)
sgehwolf@2236 606 $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).debuginfo
sgehwolf@2236 607 endif
aoqi@0 608 endif
aoqi@0 609 endif
aoqi@0 610 endif
aoqi@0 611 endif
aoqi@0 612
aoqi@0 613 $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
aoqi@0 614
aoqi@0 615 $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST)
aoqi@0 616 $$(call LINKING_EXE_MSG,$$($1_BASENAME))
aoqi@0 617 $$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \
aoqi@0 618 $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
aoqi@0 619 $$($1_EXTRA_LDFLAGS_SUFFIX)
aoqi@0 620 ifneq (,$$($1_GEN_MANIFEST))
aoqi@0 621 $(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
aoqi@0 622 endif
aoqi@0 623 # This only works if the openjdk_codesign identity is present on the system. Let
aoqi@0 624 # silently fail otherwise.
aoqi@0 625 ifneq (,$(CODESIGN))
aoqi@0 626 ifneq (,$$($1_CODESIGN))
aoqi@0 627 $(CODESIGN) -s openjdk_codesign $$@
aoqi@0 628 endif
aoqi@0 629 endif
aoqi@0 630 endif
aoqi@0 631 endef

mercurial