source: trunk/kBuild/tools/VCC120X86.kmk

Last change on this file was 3303, checked in by bird, 6 years ago

VCC*.kmk,OPENWATCOM*.kmk: Try preserve .map and .rsp files so they can be inspected if linking fails. Fixed mssing .rsp cleaning up in OPENWATCOM.kmk for the archiver.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 20.4 KB
RevLine 
[434]1# $Id: VCC120X86.kmk 3303 2020-01-14 15:09:44Z bird $
2## @file
[3033]3# kBuild Tool Config - Visual C++ 12.0 (aka Visual 2013 and MSC v18), targeting x86.
[434]4#
[1547]5
6#
[3121]7# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
[434]8#
9# This file is part of kBuild.
10#
11# kBuild is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# kBuild is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with kBuild; if not, write to the Free Software
23# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24#
25#
[1547]26# As a special exception you are granted permission to include this file, via
[2182]27# the kmk include directive, as you wish without this in itself causing the
28# resulting makefile, program or whatever to be covered by the GPL license.
[1547]29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32#
[434]33
[3033]34TOOL_VCC120X86 := Visual C++ 12.0 (aka Visual 2013 and MSC v18), targeting x86.
[434]35
[667]36# Tool Specific Properties
[3033]37ifndef PATH_TOOL_VCC120X86
38 PATH_TOOL_VCC120X86 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v12*)
39 ifeq ($(PATH_TOOL_VCC120X86),)
40 PATH_TOOL_VCC120X86 := $(PATH_TOOL_VCC120)
[706]41 endif
[3033]42 ifeq ($(PATH_TOOL_VCC120X86),)
43 PATH_TOOL_VCC120X86 := $(PATH_TOOL_VCC120AMD64)
[667]44 endif
[3033]45 ifeq ($(PATH_TOOL_VCC120X86),)
46 PATH_TOOL_VCC120X86 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/vcc/v12*)
[706]47 endif
[3033]48 ifeq ($(PATH_TOOL_VCC120X86),)
49 PATH_TOOL_VCC120X86 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/vcc/v12*)
[857]50 endif
[3033]51 ifneq ($(PATH_TOOL_VCC120X86),)
52 PATH_TOOL_VCC120X86 := $(lastword $(sort $(PATH_TOOL_VCC120X86)))
[667]53 else
[3033]54 $(warning kBuild: PATH_TOOL_VCC120X86 cannot be determined!)
55 PATH_TOOL_VCC120X86 := $(KBUILD_DEVTOOLS)/x86.win/vcc/v12
[667]56 endif
57else
58 # Resolve any fancy stuff once and for all.
[3033]59 PATH_TOOL_VCC120X86 := $(PATH_TOOL_VCC120X86)
[667]60endif
[3036]61
[3037]62if "$(KBUILD_HOST).$(KBUILD_HOST_ARCH)" == "win.amd64" && exists("$(PATH_TOOL_VCC120AMD64)/bin/amd64_x86") # Missing in express edition.
[3048]63 PATH_TOOL_VCC120X86_BIN_DLL ?= $(PATH_TOOL_VCC120X86)/bin/amd64
64 PATH_TOOL_VCC120X86_BIN ?= $(PATH_TOOL_VCC120X86)/bin/amd64_x86
[3036]65else
[3048]66 PATH_TOOL_VCC120X86_BIN_DLL ?=
67 PATH_TOOL_VCC120X86_BIN ?= $(PATH_TOOL_VCC120X86)/bin
[3036]68endif
[3033]69PATH_TOOL_VCC120X86_BIN ?= $(PATH_TOOL_VCC120X86)/bin
70PATH_TOOL_VCC120X86_LIB ?= $(PATH_TOOL_VCC120X86)/lib
71PATH_TOOL_VCC120X86_INC ?= $(PATH_TOOL_VCC120X86)/include
72PATH_TOOL_VCC120X86_ATLMFC ?= $(PATH_TOOL_VCC120X86)/atlmfc
73PATH_TOOL_VCC120X86_ATLMFC_INC ?= $(PATH_TOOL_VCC120X86_ATLMFC)/include
74PATH_TOOL_VCC120X86_ATLMFC_LIB ?= $(PATH_TOOL_VCC120X86_ATLMFC)/lib
75TOOL_VCC120X86_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/cl.exe
76TOOL_VCC120X86_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/cl.exe
77TOOL_VCC120X86_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/ml.exe
78#TOOL_VCC120X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/lib.exe - just an exec wrapper for the below
79TOOL_VCC120X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/link.exe /LIB
80TOOL_VCC120X86_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/link.exe
81TOOL_VCC120X86_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/dumpbin.exe
82TOOL_VCC120X86_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120X86_BIN)/editbin.exe
83TOOL_VCC120X86_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC120_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC120_RC_CACHED)
84TOOL_VCC120X86_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC120_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC120_MT_CACHED)
85ifdef TOOL_VCC120X86_USE_KSUBMIT
[2870]86 ifeq ($(KBUILD_HOST),win)
[3044]87 if "$(substr $(PATH_TOOL_VCC120X86_BIN),-10)" == "/amd64_x86"
88 TOOL_VCC120X86_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
89 else
90 TOOL_VCC120X86_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
91 endif
92 ifdef PATH_TOOL_VCC120X86_BIN_DLL
93 TOOL_VCC120X86_KSUBMIT += --prepend 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)'
94 endif
[3033]95 TOOL_VCC120X86_KSUBMIT_DD = $(TOOL_VCC120X86_KSUBMIT) --
[2870]96 endif
[3036]97else ifdef PATH_TOOL_VCC120X86_BIN_DLL
[3044]98 TOOL_VCC120X86_KSUBMIT_DD = $(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)' --
[2870]99endif
[2604]100
[3033]101# The following in duplicated in VCC120.kmk and VCC120X86.kmk.
102TOOL_VCC120_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(firstword \
[2606]103 $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(wildcard $(PATH_SDK_WINPSDK71_BIN)/$2)) \
104 $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(wildcard $(PATH_SDK_WINPSDK_BIN)/$2)) \
105 $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
106 $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
[2604]107 $1))
[3033]108TOOL_VCC120_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC120_FN_FIND_SDK_TOOL_SUB),)$($3)
[2604]109
[735]110## Disabled fast DEP_IDB based dependencies.
[3033]111#VCC120X86_OLD_DEPS = 1
[434]112
113## Constructs the correct .pdb name (the name is lowercased).
114# @param $(1) Base name, no extention.
115# @param $(2) The extension.
[3033]116TOOL_VCC120X86_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
[434]117
[437]118
[667]119# General Properties used by kBuild
[3033]120TOOL_VCC120X86_COBJSUFF ?= .obj
121TOOL_VCC120X86_CFLAGS ?= -TC -nologo -Zi
122TOOL_VCC120X86_CFLAGS.debug ?=
123TOOL_VCC120X86_CFLAGS.dbgopt ?= -O2
124TOOL_VCC120X86_CFLAGS.release ?= -O2
125TOOL_VCC120X86_CFLAGS.profile ?= -O2
126TOOL_VCC120X86_CINCS ?= $(PATH_TOOL_VCC120X86_INC)
127TOOL_VCC120X86_CDEFS ?=
[434]128
[3033]129TOOL_VCC120X86_CXXOBJSUFF ?= .obj
130TOOL_VCC120X86_CXXFLAGS ?= -TP -nologo -Zi
131TOOL_VCC120X86_CXXFLAGS.debug ?=
132TOOL_VCC120X86_CXXFLAGS.dbgopt ?= -O2
133TOOL_VCC120X86_CXXFLAGS.release ?= -O2
134TOOL_VCC120X86_CXXFLAGS.profile ?= -O2
135TOOL_VCC120X86_CXXINCS ?= $(PATH_TOOL_VCC120X86_INC) $(PATH_TOOL_VCC120X86_ATLMFC_INC)
136TOOL_VCC120X86_CXXDEFS ?=
[434]137
[3033]138TOOL_VCC120X86_ASOBJSUFF ?= .obj
[434]139
[3033]140TOOL_VCC120X86_RCOBJSUFF ?= .res
141TOOL_VCC120X86_RCINCS ?= $(PATH_TOOL_VCC120X86_INC) $(PATH_TOOL_VCC120X86_ATLMFC_INC)
[667]142
[3044]143TOOL_VCC120X86_ARFLAGS ?= -nologo -machine:x86
[3033]144TOOL_VCC120X86_ARLIBSUFF ?= .lib
[667]145
[3033]146TOOL_VCC120X86_LDFLAGS ?= -nologo -machine:x86
147TOOL_VCC120X86_LDFLAGS.debug ?= -debug
148TOOL_VCC120X86_LDFLAGS.dbgopt ?= -debug
149TOOL_VCC120X86_LDFLAGS.profile ?= -debug
150TOOL_VCC120X86_LDFLAGS.release ?=
[667]151
152
153
[434]154## Compile C source.
155# @param $(target) Normalized main target name.
156# @param $(source) Source filename (relative).
157# @param $(obj) Object file name. This shall be (re)created by the compilation.
158# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
159# @param $(flags) Flags.
160# @param $(defs) Definitions. No -D or something.
161# @param $(incs) Includes. No -I or something.
162# @param $(dirdep) Directory creation dependency.
163# @param $(deps) Other dependencies.
164#
165# @param $(outbase) Output basename (full). Use this for list files and such.
166# @param $(objsuff) Object suffix.
[3033]167TOOL_VCC120X86_COMPILE_C_DEPEND =
168TOOL_VCC120X86_COMPILE_C_DEPORD =
169TOOL_VCC120X86_COMPILE_C_OUTPUT =
170TOOL_VCC120X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC120X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC120X86_PDB, $(outbase)-obj,idb)
171ifdef TOOL_VCC120X86_KSUBMIT
172 TOOL_VCC120X86_COMPILE_C_DONT_PURGE_OUTPUT = 1 # speed
173 define TOOL_VCC120X86_COMPILE_C_CMDS
174 $(QUIET)$(TOOL_VCC120X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
175 -- $(TOOL_VCC120X86_CC) -c\
[434]176 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
177 -Fd$(outbase)-obj.pdb \
178 -Fo$(obj)\
[697]179 $(subst /,\\,$(abspath $(source)))
[2951]180 endef
181else
[3033]182 define TOOL_VCC120X86_COMPILE_C_CMDS
[3036]183 $(QUIET)$(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL)\
[3044]184 ,$(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)' -- ,)$(TOOL_VCC120X86_CC) -c\
[2895]185 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
186 -Fd$(outbase)-obj.pdb \
187 -Fo$(obj)\
188 $(subst /,\\,$(abspath $(source)))
[2951]189 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
190 endef
[3033]191endif # !TOOL_VCC120X86_KSUBMIT
[434]192
193
194## Compile C++ source.
195# @param $(target) Normalized main target name.
196# @param $(source) Source filename (relative).
197# @param $(obj) Object file name. This shall be (re)created by the compilation.
198# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
199# @param $(flags) Flags.
200# @param $(defs) Definitions. No -D or something.
201# @param $(incs) Includes. No -I or something.
202# @param $(dirdep) Directory creation dependency.
203# @param $(deps) Other dependencies.
204#
205# @param $(outbase) Output basename (full). Use this for list files and such.
206# @param $(objsuff) Object suffix.
[3033]207TOOL_VCC120X86_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
208TOOL_VCC120X86_COMPILE_CXX_DEPORD =
209TOOL_VCC120X86_COMPILE_CXX_OUTPUT =
210TOOL_VCC120X86_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
211 ,,$(call TOOL_VCC120X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC120X86_PDB, $(outbase)-obj,idb))
212ifdef TOOL_VCC120X86_KSUBMIT
213 TOOL_VCC120X86_COMPILE_CXX_DONT_PURGE_OUTPUT = 1 # speed
214 define TOOL_VCC120X86_COMPILE_CXX_CMDS
215 $(QUIET)$(TOOL_VCC120X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
216 -- $(TOOL_VCC120X86_CXX) -c\
[434]217 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
[2956]218 $(if-expr defined($(target)_PCH_HDR)\
[3033]219 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
[2956]220 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
[434]221 -Fo$(obj)\
[697]222 $(subst /,\\,$(abspath $(source)))
[2951]223 endef
224else
[3033]225 define TOOL_VCC120X86_COMPILE_CXX_CMDS
[3036]226 $(QUIET)$(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL)\
[3044]227 ,$(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)' -- ,)$(TOOL_VCC120X86_CXX) -c\
[2895]228 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
[2956]229 $(if-expr defined($(target)_PCH_HDR)\
[3033]230 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
[2956]231 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
[2895]232 -Fo$(obj)\
233 $(subst /,\\,$(abspath $(source)))
[2951]234 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
235 endef
[3033]236endif # !TOOL_VCC120X86_KSUBMIT
[434]237
[2954]238
239#
240# Helper tool for creating the precompiled C++ header.
241#
242# It only have the C++ compile bits and it's purpose is to skip bits
243# related _1_VCC_PCH_FILE and add -Yc.
244#
[3033]245TOOL_VCC120X86-PCH := Helper for creating precompiled header using CXX handling.
246TOOL_VCC120X86-PCH_EXTENDS := VCC120X86
247TOOL_VCC120X86-PCH_CXXOBJSUFF := .obj
248TOOL_VCC120X86-PCH_CXXINCS = $(TOOL_VCC120X86_CXXINCS)
249TOOL_VCC120X86-PCH_CXXFLAGS = $(TOOL_VCC120X86_CXXFLAGS) -FS
250TOOL_VCC120X86-PCH_CXXFLAGS.debug = $(TOOL_VCC120X86_CXXFLAGS.debug)
251TOOL_VCC120X86-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC120X86_CXXFLAGS.dbgopt)
252TOOL_VCC120X86-PCH_CXXFLAGS.release = $(TOOL_VCC120X86_CXXFLAGS.release)
253TOOL_VCC120X86-PCH_CXXFLAGS.profile = $(TOOL_VCC120X86_CXXFLAGS.profile)
254TOOL_VCC120X86-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
255TOOL_VCC120X86-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
256TOOL_VCC120X86-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
257TOOL_VCC120X86-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
258ifdef TOOL_VCC120X86_KSUBMIT
259 define TOOL_VCC120X86-PCH_COMPILE_CXX_CMDS
260 $(QUIET)$(TOOL_VCC120X86_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
261 -- $(TOOL_VCC120X86_CXX) -c -Yc\
[2960]262 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
[2954]263 -Fp$($(target)_1_VCC_PCH_FILE) \
264 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
265 -Fo$(obj)\
266 -TP \
267 $(subst /,\\,$(abspath $(source)))
268 endef
269else
[3033]270 define TOOL_VCC120X86-PCH_COMPILE_CXX_CMDS
[3036]271 $(QUIET)$(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL)\
[3044]272 ,$(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)' -- ,)$(TOOL_VCC120X86_CXX) -c -Yc\
[2954]273 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
274 -Fp$($(target)_1_VCC_PCH_FILE) \
275 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
276 -Fo$(obj)\
277 -TP \
278 $(subst /,\\,$(abspath $(source)))
279 $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
280
281 endef
[3033]282endif # !TOOL_VCC120X86_KSUBMIT
[2954]283
284
[667]285## @todo configure the assembler template.
[434]286
[641]287## Compile resource source.
288# @param $(target) Normalized main target name.
289# @param $(source) Source filename (relative).
290# @param $(obj) Object file name. This shall be (re)created by the compilation.
291# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
292# @param $(flags) Flags.
293# @param $(defs) Definitions. No -D or something.
294# @param $(incs) Includes. No -I or something.
295# @param $(dirdep) Directory creation dependency.
296# @param $(deps) Other dependencies.
297#
298# @param $(outbase) Output basename (full). Use this for list files and such.
299# @param $(objsuff) Object suffix.
[3033]300TOOL_VCC120X86_COMPILE_RC_DEPEND =
301TOOL_VCC120X86_COMPILE_RC_DEPORD =
302TOOL_VCC120X86_COMPILE_RC_OUTPUT =
[3036]303## @todo Fix kmk_redirect so we can use it for setting PATH without spawning a shell or two
[3033]304define TOOL_VCC120X86_COMPILE_RC_CMDS
[3036]305 $(QUIET)$(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL)\
[3044]306 ,$(REDIRECT) --prepend 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)' -- ,) $(TOOL_VCC120X86_RC) \
[641]307 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
308 /fo$(obj)\
[697]309 $(subst /,\\,$(abspath $(source)))
[641]310endef
311
312
[434]313## Link library
314# @param $(target) Normalized main target name.
315# @param $(out) Library name.
316# @param $(objs) Object files to put in the library.
317# @param $(flags) Flags.
318# @param $(dirdep) Directory creation dependency.
319# @param $(deps) Other dependencies.
320# @param $(othersrc) Unhandled sources.
321# @param $(outbase) Output basename (full). Use this for list files and such.
322#
[3033]323TOOL_VCC120X86_LINK_LIBRARY_DEPEND = $(othersrc)
324TOOL_VCC120X86_LINK_LIBRARY_DEPORD =
325TOOL_VCC120X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
326TOOL_VCC120X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
327define TOOL_VCC120X86_LINK_LIBRARY_CMDS
[2557]328 $(QUIET)$(APPEND) -tn $(outbase).rsp \
[768]329 $(foreach arg,\
330 $(subst /,\\,$(objs) \
331 $(filter-out %.def,$(othersrc))) \
332 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
333 ,\"$(arg)\")
[3033]334 $(QUIET)$(TOOL_VCC120X86_KSUBMIT_DD) $(TOOL_VCC120X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
[768]335endef
[434]336
337
338## Link program
339# @param $(target) Normalized main target name.
340# @param $(out) Program name.
341# @param $(objs) Object files to link together.
342# @param $(libs) Libraries to search.
343# @param $(libpath) Library search paths.
344# @param $(flags) Flags.
345# @param $(dirdep) Directory creation dependency.
346# @param $(deps) Other dependencies.
347# @param $(othersrc) Unhandled sources.
348# @param $(custom_pre) Custom step invoked before linking.
349# @param $(custom_post) Custom step invoked after linking.
350# @param $(outbase) Output basename (full). Use this for list files and such.
351#
[3033]352TOOL_VCC120X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
353TOOL_VCC120X86_LINK_PROGRAM_DEPORD =
[3303]354TOOL_VCC120X86_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
[3033]355TOOL_VCC120X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
356TOOL_VCC120X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
357TOOL_VCC120X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
358define TOOL_VCC120X86_LINK_PROGRAM_CMDS
[2557]359 $(QUIET)$(APPEND) -tn $(outbase).rsp \
360 $(foreach arg,\
361 $(subst /,\\,$(objs)) \
362 $(subst /,\\,$(libs)) \
363 ,\"$(arg)\")
[3033]364 $(QUIET)$(TOOL_VCC120X86_KSUBMIT_DD) $(TOOL_VCC120X86_LD) $(flags) \
[434]365 /OUT:$(out) \
[437]366 /MAPINFO:EXPORTS /INCREMENTAL:NO \
[434]367 /MAP:$(outbase).map \
368 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
369 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
370 $(foreach p,$(libpath), /LIBPATH:$(p)) \
[2557]371 @$(outbase).rsp
[3033]372ifndef TOOL_VCC120X86_NO_AUTO_MANIFEST
[1295]373 $(QUIET)$(TEST) -f $(out).manifest -- \
[3033]374 $(TOOL_VCC120X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
[2735]375endif
[434]376endef
377
378
379## Link DLL.
380# @param $(target) Normalized main target name.
381# @param $(out) DLL name.
382# @param $(objs) Object files to link together.
383# @param $(libs) Libraries to search.
384# @param $(libpath) Library search paths.
385# @param $(flags) Flags.
386# @param $(dirdep) Directory creation dependency.
387# @param $(deps) Other dependencies.
388# @param $(othersrc) Unhandled sources.
389# @param $(custom_pre) Custom step invoked before linking.
390# @param $(custom_post) Custom step invoked after linking.
391#
392# @param $(outbase) Output basename (full). Use this for list files and such.
[3033]393TOOL_VCC120X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
394TOOL_VCC120X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
[3303]395TOOL_VCC120X86_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
[3033]396TOOL_VCC120X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
[3303]397TOOL_VCC120X86_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
[3033]398TOOL_VCC120X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
399TOOL_VCC120X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
400define TOOL_VCC120X86_LINK_DLL_CMDS
[2557]401 $(QUIET)$(APPEND) -tn $(outbase).rsp \
402 $(foreach arg,\
403 $(subst /,\\,$(objs)) \
404 $(subst /,\\,$(libs)) \
405 ,\"$(arg)\")
[3033]406 $(QUIET)$(TOOL_VCC120X86_KSUBMIT_DD) $(TOOL_VCC120X86_LD) $(flags) \
[434]407 /OUT:$(out) \
408 /IMPLIB:$(outbase).lib \
[437]409 /MAPINFO:EXPORTS /INCREMENTAL:NO \
[434]410 /MAP:$(outbase).map \
411 /DLL \
412 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
413 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
414 $(foreach p,$(libpath), /LIBPATH:$(p)) \
[2557]415 @$(outbase).rsp
[3033]416ifndef TOOL_VCC120X86_NO_AUTO_MANIFEST
[1295]417 $(QUIET)$(TEST) -f $(out).manifest -- \
[3033]418 $(TOOL_VCC120X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
[2735]419endif
[2795]420 $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
[2487]421 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
422$(eval _DIRS += $(PATH_STAGE_LIB))
[434]423endef
424
425
426## Link system module (windows aka driver, linux aka kernel module)
427# @param $(target) Normalized main target name.
428# @param $(out) System module name.
429# @param $(objs) Object files to link together.
430# @param $(libs) Libraries to search.
431# @param $(libpath) Library search paths.
432# @param $(flags) Flags.
433# @param $(dirdep) Directory creation dependency.
434# @param $(deps) Other dependencies.
435# @param $(othersrc) Unhandled sources.
436# @param $(custom_pre) Custom step invoked before linking.
437# @param $(custom_post) Custom step invoked after linking.
438#
439# @param $(outbase) Output basename (full). Use this for list files and such.
[3033]440TOOL_VCC120X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
441TOOL_VCC120X86_LINK_SYSMOD_DEPORD =
442TOOL_VCC120X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
[3303]443TOOL_VCC120X86_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
[3033]444TOOL_VCC120X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
445TOOL_VCC120X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
446define TOOL_VCC120X86_LINK_SYSMOD_CMDS
[2557]447 $(QUIET)$(APPEND) -tn $(outbase).rsp \
448 $(foreach arg,\
449 $(subst /,\\,$(objs)) \
450 $(subst /,\\,$(libs)) \
451 ,\"$(arg)\")
[3033]452 $(QUIET)$(TOOL_VCC120X86_KSUBMIT_DD) $(TOOL_VCC120X86_LD) $(flags) \
[434]453 /OUT:$(out) \
[437]454 /MAPINFO:EXPORTS /INCREMENTAL:NO \
[434]455 /MAP:$(outbase).map \
456 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
457 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
458 $(foreach p,$(libpath), /LIBPATH:$(p)) \
[2557]459 @$(outbase).rsp
[3033]460ifndef TOOL_VCC120X86_NO_AUTO_MANIFEST
[1295]461 $(QUIET)$(TEST) -f $(out).manifest -- \
[3033]462 $(TOOL_VCC120X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
[2735]463endif
[434]464endef
465
Note: See TracBrowser for help on using the repository browser.