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