Thu, 07 Jun 2012 20:25:06 -0700
7170079: Adjustments to build-infra makefiles
Reviewed-by: ohair, ohrstrom, ihse, jonas
Contributed-by: jonas <jonas.oreland@oracle.com>, erikj <erik.joelsson@oracle.com>, ihse <magnus.ihse.bursie@oracle.com>, tgranat <torbjorn.granat@oracle.com>, ykantser <yekaterina.kantserova@oracle.com>
ohair@425 | 1 | # |
ohair@425 | 2 | # Copyright (c) 2011, 2012, 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 | |
ohair@425 | 30 | ifeq (,$(_MAKEBASE_GMK)) |
erikj@445 | 31 | $(error You must include MakeBase.gmk prior to including NativeCompilation.gmk) |
ohair@425 | 32 | endif |
ohair@425 | 33 | |
ohair@425 | 34 | ifeq ($(COMPILER_TYPE),CC) |
ohair@425 | 35 | COMPILING_MSG=echo Compiling $1 |
ohair@425 | 36 | LINKING_MSG=echo Linking $1 |
ohair@425 | 37 | LINKING_EXE_MSG=echo Linking executable $1 |
ohair@425 | 38 | ARCHIVING_MSG=echo Archiving $1 |
ohair@425 | 39 | else |
ohair@425 | 40 | COMPILING_MSG= |
ohair@425 | 41 | LINKING_MSG= |
ohair@425 | 42 | LINKING_EXE_MSG= |
ohair@425 | 43 | ARCHIVING_MSG= |
ohair@425 | 44 | endif |
ohair@425 | 45 | |
ohair@425 | 46 | define add_native_source |
ohair@425 | 47 | # param 1 = BUILD_MYPACKAGE |
ohair@425 | 48 | # parma 2 = the source file name (..../alfa.c or .../beta.cpp) |
ohair@425 | 49 | # param 3 = the bin dir that stores all .o (.obj) and .d files. |
ohair@425 | 50 | # param 4 = the c flags to the compiler |
ohair@425 | 51 | # param 5 = the c compiler |
ohair@425 | 52 | # param 6 = the c++ flags to the compiler |
ohair@425 | 53 | # param 7 = the c++ compiler |
ohair@425 | 54 | |
ohair@425 | 55 | ifneq (,$$(filter %.c,$2)) |
ohair@425 | 56 | # Compile as a C file |
erikj@445 | 57 | $1_$2_FLAGS=$4 $$($1_$(notdir $2)_CFLAGS) |
ohair@425 | 58 | $1_$2_COMP=$5 |
erikj@445 | 59 | $1_$2_DEP_FLAG:=$(C_FLAG_DEPS) |
erikj@445 | 60 | else ifneq (,$$(filter %.m,$2)) |
erikj@445 | 61 | # Compile as a objective-c file |
erikj@445 | 62 | $1_$2_FLAGS=-x objective-c $4 $$($1_$(notdir $2)_CFLAGS) |
erikj@445 | 63 | $1_$2_COMP=$5 |
erikj@445 | 64 | $1_$2_DEP_FLAG:=$(C_FLAG_DEPS) |
ohair@425 | 65 | else |
ohair@425 | 66 | # Compile as a C++ file |
erikj@445 | 67 | $1_$2_FLAGS=$6 $$($1_$(notdir $2)_CXXFLAGS) |
ohair@425 | 68 | $1_$2_COMP=$7 |
erikj@445 | 69 | $1_$2_DEP_FLAG:=$(CXX_FLAG_DEPS) |
ohair@425 | 70 | endif |
ohair@425 | 71 | # Generate the .o (.obj) file name and place it in the bin dir. |
erikj@445 | 72 | $1_$2_OBJ:=$3/$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(patsubst %.m,%$(OBJ_SUFFIX),$$(notdir $2)))) |
ohair@425 | 73 | # Only continue if this object file hasn't been processed already. This lets the first found |
ohair@425 | 74 | # source file override any other with the same name. |
ohair@425 | 75 | ifeq (,$$(findstring $$($1_$2_OBJ),$$($1_OBJS_SO_FAR))) |
ohair@425 | 76 | $1_OBJS_SO_FAR+=$$($1_$2_OBJ) |
ohair@425 | 77 | # And this is the dependency file for this obj file. |
ohair@425 | 78 | $1_$2_DEP:=$$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_$2_OBJ)) |
ohair@425 | 79 | # Include previously generated dependency information. (if it exists) |
ohair@425 | 80 | -include $$($1_$2_DEP) |
ohair@425 | 81 | |
ohair@425 | 82 | ifeq ($(COMPILER_TYPE),CL) |
ohair@425 | 83 | $1_$2_DEBUG_OUT_FLAGS:=-Fd$$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ)) \ |
ohair@425 | 84 | -Fm$$(patsubst %$(OBJ_SUFFIX),%.map,$$($1_$2_OBJ)) |
ohair@425 | 85 | endif |
ohair@425 | 86 | |
ohair@425 | 87 | $$($1_$2_OBJ) : $2 |
ohair@425 | 88 | ifeq ($(COMPILER_TYPE),CC) |
ohair@425 | 89 | $$(call COMPILING_MSG,$$(notdir $2)) |
erikj@445 | 90 | $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) -c $(CC_OUT_OPTION)$$($1_$2_OBJ) $2 |
ohair@425 | 91 | endif |
ohair@425 | 92 | ifeq ($(COMPILER_TYPE),CL) |
ohair@425 | 93 | $$(call COMPILING_MSG,$$(notdir $2)) |
ohair@425 | 94 | $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEBUG_OUT_FLAGS) -c $(CC_OUT_OPTION)$$($1_$2_OBJ) $2 |
ohair@425 | 95 | endif |
ohair@425 | 96 | endif |
ohair@425 | 97 | endef |
ohair@425 | 98 | |
ohair@425 | 99 | define SetupNativeCompilation |
ohair@425 | 100 | # param 1 is for example BUILD_MYPACKAGE |
ohair@425 | 101 | # param 2,3,4,5,6,7,8 are named args. |
ohair@425 | 102 | # SRC one or more directory roots to scan for C/C++ files. |
ohair@425 | 103 | # LANG C or C++ |
ohair@425 | 104 | # CFLAGS the compiler flags to be used, used both for C and C++. |
ohair@425 | 105 | # CXXFLAGS the compiler flags to be used for c++, if set overrides CFLAGS. |
ohair@425 | 106 | # LDFLAGS the linker flags to be used, used both for C and C++. |
ohair@425 | 107 | # LDFLAGS_SUFFIX the linker flags to be added last on the commandline |
ohair@425 | 108 | # typically the libraries linked to. |
ohair@425 | 109 | # ARFLAGS the archiver flags to be used |
ohair@425 | 110 | # BIN the directory where we store the object files |
ohair@425 | 111 | # LIB the resulting library file |
ohair@425 | 112 | # EXE the resulting exec file |
ohair@425 | 113 | # INCLUDES only pick source from these directories |
ohair@425 | 114 | # EXCLUDES do not pick source from these directories |
ohair@425 | 115 | # INCLUDE_FILES only compile exactly these files! |
ohair@425 | 116 | # EXCLUDE_FILES with these names |
ohair@425 | 117 | # VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run |
ohair@425 | 118 | # RC_FLAGS flags for RC. |
erikj@445 | 119 | # MAPFILE mapfile |
erikj@445 | 120 | # REORDER reorder file |
ohair@425 | 121 | $(if $2,$1_$(strip $2)) |
ohair@425 | 122 | $(if $3,$1_$(strip $3)) |
ohair@425 | 123 | $(if $4,$1_$(strip $4)) |
ohair@425 | 124 | $(if $5,$1_$(strip $5)) |
ohair@425 | 125 | $(if $6,$1_$(strip $6)) |
ohair@425 | 126 | $(if $7,$1_$(strip $7)) |
ohair@425 | 127 | $(if $8,$1_$(strip $8)) |
ohair@425 | 128 | $(if $9,$1_$(strip $9)) |
ohair@425 | 129 | $(if $(10),$1_$(strip $(10))) |
ohair@425 | 130 | $(if $(11),$1_$(strip $(11))) |
ohair@425 | 131 | $(if $(12),$1_$(strip $(12))) |
ohair@425 | 132 | $(if $(13),$1_$(strip $(13))) |
ohair@425 | 133 | $(if $(14),$1_$(strip $(14))) |
ohair@425 | 134 | $(if $(15),$1_$(strip $(15))) |
ohair@425 | 135 | $(if $(16),$1_$(strip $(16))) |
ohair@425 | 136 | $(if $(17),$1_$(strip $(17))) |
ohair@425 | 137 | $(if $(18),$1_$(strip $(18))) |
ohair@425 | 138 | $(if $(19),$1_$(strip $(19))) |
ohair@425 | 139 | $(if $(20),$1_$(strip $(20))) |
ohair@425 | 140 | |
ohair@425 | 141 | ifeq (,$$($1_LANG)) |
ohair@425 | 142 | $$(error You have to specify LANG for native compilation $1) |
ohair@425 | 143 | endif |
ohair@425 | 144 | ifeq (C,$$($1_LANG)) |
ohair@425 | 145 | $1_LD:=$(LD) |
ohair@425 | 146 | $1_LDEXE:=$(LDEXE) |
ohair@425 | 147 | else |
ohair@425 | 148 | ifeq (C++,$$($1_LANG)) |
ohair@425 | 149 | $1_LD:=$(LDCXX) |
ohair@425 | 150 | $1_LDEXE:=$(LDEXECXX) |
ohair@425 | 151 | else |
ohair@425 | 152 | $$(error Unknown native language $$($1_LANG) for $1) |
ohair@425 | 153 | endif |
ohair@425 | 154 | endif |
ohair@425 | 155 | |
ohair@425 | 156 | # Make sure the dirs exist. |
ohair@425 | 157 | $$(shell $(MKDIR) -p $$($1_SRC) $$($1_BIN) $$(dir $$($1_LIB)) $$(dir $$($1_EXE))) |
ohair@425 | 158 | # Find all files in the source trees. Sort to remove duplicates. |
ohair@425 | 159 | $1_ALL_SRCS := $$(sort $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i -type f))) |
ohair@425 | 160 | # Extract the C/C++ files. |
ohair@425 | 161 | $1_EXCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_EXCLUDE_FILES))) |
ohair@425 | 162 | $1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES))) |
ohair@425 | 163 | ifneq ($$($1_EXCLUDE_FILES),) |
ohair@425 | 164 | $1_EXCLUDE_FILES:=$$(addprefix %,$$($1_EXCLUDE_FILES)) |
ohair@425 | 165 | endif |
erikj@445 | 166 | $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES),$$(filter %.c %.cpp %.m,$$($1_ALL_SRCS))) |
ohair@425 | 167 | ifneq (,$$(strip $$($1_INCLUDE_FILES))) |
ohair@425 | 168 | $1_SRCS := $$(filter $$($1_INCLUDE_FILES),$$($1_SRCS)) |
ohair@425 | 169 | endif |
ohair@425 | 170 | ifeq (,$$($1_SRCS)) |
ohair@425 | 171 | $$(error No sources found for $1 when looking inside the dirs $$($1_SRC)) |
ohair@425 | 172 | endif |
ohair@425 | 173 | # There can be only a single bin dir root, no need to foreach over the roots. |
ohair@425 | 174 | $1_BINS := $$(wildcard $$($1_BIN)/*$(OBJ_SUFFIX)) |
ohair@425 | 175 | # Now we have a list of all c/c++ files to compile: $$($1_SRCS) |
ohair@425 | 176 | # and we have a list of all existing object files: $$($1_BINS) |
ohair@425 | 177 | |
ohair@425 | 178 | # Prepend the source/bin path to the filter expressions. Then do the filtering. |
ohair@425 | 179 | ifneq ($$($1_INCLUDES),) |
ohair@425 | 180 | $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES)))) |
ohair@425 | 181 | $1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS)) |
ohair@425 | 182 | endif |
ohair@425 | 183 | ifneq ($$($1_EXCLUDES),) |
ohair@425 | 184 | $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES)))) |
ohair@425 | 185 | $1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS)) |
ohair@425 | 186 | endif |
ohair@425 | 187 | |
ohair@425 | 188 | # Calculate the expected output from compiling the sources (sort to remove duplicates. Also provides |
ohair@425 | 189 | # a reproducable order on the input files to the linker). |
erikj@445 | 190 | $1_EXPECTED_OBJS:=$$(sort $$(addprefix $$($1_BIN)/,$$(patsubst %.cpp,%$(OBJ_SUFFIX),$$(patsubst %.c,%$(OBJ_SUFFIX),$$(patsubst %.m,%$(OBJ_SUFFIX),$$(notdir $$($1_SRCS))))))) |
ohair@425 | 191 | $1 := $$($1_EXPECTED_OBJS) |
ohair@425 | 192 | # Are there too many object files on disk? Perhaps because some source file was removed? |
ohair@425 | 193 | $1_SUPERFLOUS_OBJS:=$$(sort $$(filter-out $$($1_EXPECTED_OBJS),$$($1_BINS))) |
ohair@425 | 194 | # Clean out the superfluous object files. |
ohair@425 | 195 | $$(shell $(RM) -f $$($1_SUPERFLUOUS_OBJS)) |
ohair@425 | 196 | |
ohair@425 | 197 | # Pickup extra HOST_OS_API and/or PLATFORM dependent variables for CFLAGS. |
ohair@425 | 198 | $1_EXTRA_CFLAGS:=$$($1_CFLAGS_$(HOST_OS_API)) $$($1_CFLAGS_$(PLATFORM)) |
ohair@425 | 199 | ifneq ($(DEBUG_LEVEL),release) |
ohair@425 | 200 | # Pickup extra debug dependent variables for CFLAGS |
ohair@425 | 201 | $1_EXTRA_CFLAGS+=$$($1_CFLAGS_debug) |
ohair@425 | 202 | $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(HOST_OS_API)_debug) |
ohair@425 | 203 | $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(PLATFORM)_debug) |
ohair@425 | 204 | else |
ohair@425 | 205 | $1_EXTRA_CFLAGS+=$$($1_CFLAGS_release) |
ohair@425 | 206 | $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(HOST_OS_API)_release) |
ohair@425 | 207 | $1_EXTRA_CFLAGS+=$$($1_CFLAGS_$(PLATFORM)_release) |
ohair@425 | 208 | endif |
ohair@425 | 209 | |
ohair@425 | 210 | # Pickup extra HOST_OS_API and/or PLATFORM dependent variables for CXXFLAGS. |
ohair@425 | 211 | $1_EXTRA_CXXFLAGS:=$$($1_CXXFLAGS_$(HOST_OS_API)) $$($1_CXXFLAGS_$(PLATFORM)) |
ohair@425 | 212 | ifneq ($(DEBUG_LEVEL),release) |
ohair@425 | 213 | # Pickup extra debug dependent variables for CXXFLAGS |
ohair@425 | 214 | $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_debug) |
ohair@425 | 215 | $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(HOST_OS_API)_debug) |
ohair@425 | 216 | $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(PLATFORM)_debug) |
ohair@425 | 217 | else |
ohair@425 | 218 | $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_release) |
ohair@425 | 219 | $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(HOST_OS_API)_release) |
ohair@425 | 220 | $1_EXTRA_CXXFLAGS+=$$($1_CXXFLAGS_$(PLATFORM)_release) |
ohair@425 | 221 | endif |
ohair@425 | 222 | |
ohair@425 | 223 | ifeq ($$($1_CXXFLAGS),) |
ohair@425 | 224 | $1_CXXFLAGS:=$$($1_CFLAGS) |
ohair@425 | 225 | endif |
ohair@425 | 226 | ifeq ($$(strip $$($1_EXTRA_CXXFLAGS)),) |
ohair@425 | 227 | $1_EXTRA_CXXFLAGS:=$$($1_EXTRA_CFLAGS) |
ohair@425 | 228 | endif |
ohair@425 | 229 | |
erikj@445 | 230 | ifneq (,$$($1_REORDER)) |
erikj@445 | 231 | $1_EXTRA_CFLAGS += $$(C_FLAG_REORDER) |
erikj@445 | 232 | $1_EXTRA_CXXFLAGS += $$(CXX_FLAG_REORDER) |
erikj@445 | 233 | endif |
erikj@445 | 234 | |
ohair@425 | 235 | # Now create a list of the packages that are about to compile. Used when sending source |
ohair@425 | 236 | # in a batch to the compiler. |
ohair@425 | 237 | $$(shell $(RM) $$($1_BIN)/_the.list_of_sources) |
ohair@425 | 238 | $$(eval $$(call ListPathsSafelyNow,$1_SRCS,\n, >> $$($1_BIN)/_the.list_of_sources)) |
ohair@425 | 239 | |
ohair@425 | 240 | # Now call add_native_source for each source file we are going to compile. |
ohair@425 | 241 | $$(foreach p,$$($1_SRCS),\ |
ohair@425 | 242 | $$(eval $$(call add_native_source,$1,$$p,$$($1_BIN),\ |
ohair@425 | 243 | $$($1_CFLAGS) $$($1_EXTRA_CFLAGS),$(CC),\ |
ohair@425 | 244 | $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS),$(CXX)))) |
ohair@425 | 245 | |
ohair@425 | 246 | # On windows we need to create a resource file |
ohair@425 | 247 | ifeq ($(HOST_OS_API), winapi) |
ohair@425 | 248 | ifneq (,$$($1_VERSIONINFO_RESOURCE)) |
ohair@425 | 249 | ifneq (,$$($1_LIB)) |
erikj@445 | 250 | $1_BASENAME:=$$(basename $$(notdir $$($1_LIB))) |
ohair@425 | 251 | endif |
ohair@425 | 252 | ifneq (,$$($1_EXE)) |
erikj@445 | 253 | $1_BASENAME:=$$(basename $$(notdir $$($1_EXE))) |
ohair@425 | 254 | endif |
erikj@445 | 255 | $1_RES:=$$($1_BIN)/$$($1_BASENAME).res |
ohair@425 | 256 | $$($1_RES): $$($1_VERSIONINFO_RESOURCE) |
ohair@425 | 257 | $(RC) $$($1_RC_FLAGS) $(CC_OUT_OPTION)$$@ $$($1_VERSIONINFO_RESOURCE) |
ohair@425 | 258 | endif |
erikj@445 | 259 | ifneq (,$$($1_MANIFEST)) |
erikj@445 | 260 | $1_PROGRAM:=$$(basename $$(notdir $$($1_EXE))) |
erikj@445 | 261 | $1_GEN_MANIFEST:=$$($1_BIN)/$$($1_PROGRAM).manifest |
erikj@445 | 262 | IMVERSIONVALUE:=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VERSION).$(COOKED_BUILD_NUMBER) |
erikj@445 | 263 | $$($1_GEN_MANIFEST): $$($1_MANIFEST) |
erikj@445 | 264 | $(SED) 's%IMVERSION%$$(IMVERSIONVALUE)%g;s%PROGRAM%$$($1_PROGRAM)%g' $$< > $$@ |
erikj@445 | 265 | endif |
erikj@445 | 266 | endif |
erikj@445 | 267 | |
erikj@445 | 268 | # mapfile doesnt seem to be implemented on macosx (yet??) |
erikj@445 | 269 | ifneq ($(HOST_OS),macosx) |
erikj@445 | 270 | ifneq ($(HOST_OS),windows) |
erikj@445 | 271 | $1_REAL_MAPFILE := $$($1_MAPFILE) |
erikj@445 | 272 | ifneq (,$$($1_REORDER)) |
erikj@445 | 273 | $1_REAL_MAPFILE := $$($1_BIN)/mapfile |
erikj@445 | 274 | |
erikj@445 | 275 | $$($1_REAL_MAPFILE) : $$($1_MAPFILE) $$($1_REORDER) |
erikj@445 | 276 | $$(MKDIR) -p $$(@D) |
erikj@445 | 277 | $$(CP) $$($1_MAPFILE) $$@.tmp |
erikj@445 | 278 | $$(SED) -e 's=OUTPUTDIR=$$($1_BIN)=' $$($1_REORDER) >> $$@.tmp |
erikj@445 | 279 | $$(MV) $$@.tmp $$@ |
erikj@445 | 280 | endif |
erikj@445 | 281 | endif |
ohair@425 | 282 | endif |
ohair@425 | 283 | |
ohair@425 | 284 | # Pickup extra HOST_OS_API dependent variables (posix or winapi) and |
ohair@425 | 285 | # (linux,solaris,windows,bsd) for LDFLAGS and LDFLAGS_SUFFIX |
ohair@425 | 286 | $1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(HOST_OS_API)) $$($1_LDFLAGS_$(PLATFORM)) |
ohair@425 | 287 | $1_EXTRA_LDFLAGS_SUFFIX:=$$($1_LDFLAGS_SUFFIX_$(HOST_OS_API)) $$($1_LDFLAGS_SUFFIX_$(PLATFORM)) |
erikj@445 | 288 | ifneq (,$$($1_REAL_MAPFILE)) |
erikj@445 | 289 | $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE)) |
erikj@445 | 290 | endif |
erikj@445 | 291 | |
ohair@425 | 292 | ifneq (,$$($1_LIB)) |
ohair@425 | 293 | ifeq (dynamic,$$(patsubst %$(SHARED_LIBRARY_SUFFIX),dynamic,$$($1_LIB))) |
ohair@425 | 294 | # Generating a dynamic library. |
ohair@425 | 295 | $1_EXTRA_LDFLAGS+=$$(call SET_SHARED_LIBRARY_NAME,$$(notdir $$($1_LIB))) |
erikj@445 | 296 | $$($1_LIB) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) |
ohair@425 | 297 | $$(call LINKING_MSG,$$(notdir $$($1_LIB))) |
ohair@425 | 298 | $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$($1_LIB) \ |
ohair@425 | 299 | $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) |
ohair@425 | 300 | else |
ohair@425 | 301 | # Generating a static library, ie object file archive. |
ohair@425 | 302 | $$($1_LIB) : $$($1_EXPECTED_OBJS) $$($1_RES) |
ohair@425 | 303 | $$(call ARCHIVING_MSG,$$(notdir $$($1_LIB))) |
ohair@425 | 304 | $(AR) $$($1_AR_FLAGS) $(AR_OUT_OPTION)$$($1_LIB) $$($1_EXPECTED_OBJS) \ |
ohair@425 | 305 | $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) |
ohair@425 | 306 | endif |
ohair@425 | 307 | endif |
ohair@425 | 308 | ifneq (,$$($1_EXE)) |
ohair@425 | 309 | # A executable binary has been specified, setup the target for it. |
erikj@445 | 310 | $$($1_EXE) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST) |
ohair@425 | 311 | $$(call LINKING_EXE_MSG,$$(notdir $$($1_EXE))) |
ohair@425 | 312 | $$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_EXE) \ |
erikj@445 | 313 | $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \ |
erikj@445 | 314 | $$($1_EXTRA_LDFLAGS_SUFFIX) |
erikj@445 | 315 | ifneq (,$$($1_GEN_MANIFEST)) |
erikj@445 | 316 | $(MT) -nologo /manifest $$($1_GEN_MANIFEST) /outputresource:$$@;#1 |
erikj@445 | 317 | endif |
ohair@425 | 318 | endif |
ohair@425 | 319 | endef |