source: trunk/kBuild/tools/VCC141X86.kmk@ 3597

Last change on this file since 3597 was 3597, checked in by bird, 2 years ago

win-common.kmk,tools/VCC14[012]*.kmk,retry-10-delay-500ms.sh: Retry mt.exe operations as we sometimes run into a race with AV software when adding a manifest right after linking.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 20.1 KB
Line 
1# $Id: VCC141X86.kmk 3597 2023-06-16 20:56:17Z bird $
2## @file
3# kBuild Tool Config - Visual C++ 14.1 (aka Visual 2017 and MSC v19.10), targeting x86.
4#
5
6#
7# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@anduin.net>
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#
26# As a special exception you are granted permission to include this file, via
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.
29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32#
33
34ifndef TOOL_VCC141
35 include $(KBUILD_PATH)/tools/VCC141.kmk
36endif
37
38TOOL_VCC141X86 := Visual C++ 14.1 (aka Visual 2017 and MSC v19.1), targeting x86
39
40#
41# Tool Specific Properties
42#
43ifndef PATH_TOOL_VCC141X86
44 PATH_TOOL_VCC141X86 := $(PATH_TOOL_VCC141)
45else
46 # Resolve any fancy stuff once and for all.
47 PATH_TOOL_VCC141X86 := $(PATH_TOOL_VCC141X86)
48endif
49
50ifndef PATH_TOOL_VCC141X86_BIN
51PATH_TOOL_VCC141X86_BIN := $(PATH_TOOL_VCC141_HOST_BIN)/x86
52else
53PATH_TOOL_VCC141X86_BIN := $(PATH_TOOL_VCC141X86_BIN)
54endif
55PATH_TOOL_VCC141X86_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC141X86_BIN))
56
57# A bunch of DLLs are only in the subdir matching the host one, so we need to add it to the PATH when cross compiling.
58ifndef PATH_TOOL_VCC141X86_DLL_BIN
59 ifneq ($(PATH_TOOL_VCC141_HOST_DLL_BIN),$(PATH_TOOL_VCC141X86_BIN))
60PATH_TOOL_VCC141X86_DLL_BIN := $(PATH_TOOL_VCC141_HOST_DLL_BIN)
61 endif
62endif
63
64ifndef PATH_TOOL_VCC141X86_LIB
65PATH_TOOL_VCC141X86_LIB := $(PATH_TOOL_VCC141_LIB.x86)
66endif
67ifndef PATH_TOOL_VCC141_ONECORE_LIB
68PATH_TOOL_VCC141_ONECORE_LIB := $(PATH_TOOL_VCC141_ONECORE_LIB.x86)
69endif
70
71ifndef PATH_TOOL_VCC141X86_INC
72PATH_TOOL_VCC141X86_INC := $(PATH_TOOL_VCC141_INC)
73endif
74
75ifndef PATH_TOOL_VCC141X86_ATLMFC_INC
76PATH_TOOL_VCC141X86_ATLMFC_INC := $(PATH_TOOL_VCC141_ATLMFC_INC.x86)
77endif
78ifndef PATH_TOOL_VCC141X86_ATLMFC_LIB
79PATH_TOOL_VCC141X86_ATLMFC_LIB := $(PATH_TOOL_VCC141_ATLMFC_LIB.x86)
80endif
81
82TOOL_VCC141X86_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/cl.exe
83TOOL_VCC141X86_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/cl.exe
84TOOL_VCC141X86_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/ml.exe
85#TOOL_VCC141X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/lib.exe - just an exec wrapper for the below
86TOOL_VCC141X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/link.exe /LIB
87TOOL_VCC141X86_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/link.exe
88TOOL_VCC141X86_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/dumpbin.exe
89TOOL_VCC141X86_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141X86_BIN_QSH)/editbin.exe
90
91TOOL_VCC141X86_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC141_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC141_RC_CACHED)
92TOOL_VCC141X86_MT ?= $(TOOL_VCC141X86_MT_RETRY) $(EXEC_X86_WIN32) $(call TOOL_VCC141_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC141_MT_CACHED)
93TOOL_VCC141X86_MT_RETRY ?= $(TOOL_VCC141_MT_RETRY)
94
95undefine TOOL_VCC141X86_USE_KSUBMIT # for now
96ifdef TOOL_VCC141X86_USE_KSUBMIT
97 ifeq ($(KBUILD_HOST),win)
98 ifneq ($(substr $(qdir un,$(PATH_TOOL_VCC141X86_BIN)),-3),64/)
99 TOOL_VCC141X86_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
100 else
101 TOOL_VCC141X86_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
102 endif
103 ifdef PATH_TOOL_VCC141X86_DLL_BIN
104 TOOL_VCC141X86_KSUBMIT := $(TOOL_VCC141X86_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC141X86_DLL_BIN));"
105 endif
106 TOOL_VCC141X86_KSUBMIT_DD := $(TOOL_VCC141X86_KSUBMIT) --
107 endif
108endif
109ifdef PATH_TOOL_VCC141X86_DLL_BIN
110 TOOL_VCC141X86_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC141X86_DLL_BIN));" --$(SP)
111 ifndef TOOL_VCC141X86_KSUBMIT_DD
112 TOOL_VCC141X86_KSUBMIT_DD := $(TOOL_VCC141X86_SETUP_ENV)
113 endif
114endif
115
116# Redist (more stuff in VCC141.kmk).
117PATH_TOOL_VCC141X86_REDIST ?= $(PATH_TOOL_VCC141_REDIST)/x86
118PATH_TOOL_VCC141X86_REDIST_CRT = $(PATH_TOOL_VCC141X86_REDIST)/$(TOOL_VCC141_REDIST_CRT_SUBDIR)
119PATH_TOOL_VCC141X86_REDIST_DEBUG ?= $(PATH_TOOL_VCC141_REDIST_DEBUG)/x86
120PATH_TOOL_VCC141X86_REDIST_DEBUG_CRT = $(PATH_TOOL_VCC141X86_REDIST_DEBUG)/$(TOOL_VCC141_REDIST_DEBUG_CRT_SUBDIR)
121TOOL_VCC141X64_REDIST_CRT_DLLS = $(TOOL_VCC141_REDIST_CRT_DLLS.x86)
122TOOL_VCC141X64_REDIST_CONCRT_DLLS = $(TOOL_VCC141_REDIST_CONCRT_DLLS.x86)
123TOOL_VCC141X64_REDIST_CPP_DLLS = $(TOOL_VCC141_REDIST_CPP_DLLS.x86)
124TOOL_VCC141X64_REDIST_WINRT_DLLS = $(TOOL_VCC141_REDIST_WINRT_DLLS.x86)
125
126
127#
128# Properties used by kBuild
129#
130TOOL_VCC141X86_COBJSUFF ?= .obj
131TOOL_VCC141X86_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
132TOOL_VCC141X86_CFLAGS.debug ?=
133TOOL_VCC141X86_CFLAGS.dbgopt ?= -O2
134TOOL_VCC141X86_CFLAGS.release ?= -O2
135TOOL_VCC141X86_CFLAGS.profile ?= -O2
136TOOL_VCC141X86_CINCS ?= $(PATH_TOOL_VCC141X86_INC)
137TOOL_VCC141X86_CDEFS ?=
138
139TOOL_VCC141X86_CXXOBJSUFF ?= .obj
140TOOL_VCC141X86_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
141TOOL_VCC141X86_CXXFLAGS.debug ?=
142TOOL_VCC141X86_CXXFLAGS.dbgopt ?= -O2
143TOOL_VCC141X86_CXXFLAGS.release ?= -O2
144TOOL_VCC141X86_CXXFLAGS.profile ?= -O2
145TOOL_VCC141X86_CXXINCS ?= $(PATH_TOOL_VCC141X86_INC) $(PATH_TOOL_VCC141X86_ATLMFC_INC)
146TOOL_VCC141X86_CXXDEFS ?=
147
148TOOL_VCC141X86_ASOBJSUFF ?= .obj
149
150TOOL_VCC141X86_RCOBJSUFF ?= .res
151TOOL_VCC141X86_RCINCS ?= $(PATH_TOOL_VCC141X86_INC) $(PATH_TOOL_VCC141X86_ATLMFC_INC)
152
153TOOL_VCC141X86_ARFLAGS ?= -nologo -machine:x86
154TOOL_VCC141X86_ARLIBSUFF ?= .lib
155
156TOOL_VCC141X86_LDFLAGS ?= -nologo -machine:x86
157TOOL_VCC141X86_LDFLAGS.debug ?= -debug
158TOOL_VCC141X86_LDFLAGS.dbgopt ?= -debug
159TOOL_VCC141X86_LDFLAGS.profile ?= -debug
160TOOL_VCC141X86_LDFLAGS.release ?=
161
162
163
164## Compile C source.
165# @param $(target) Normalized main target name.
166# @param $(source) Source filename (relative).
167# @param $(obj) Object file name. This shall be (re)created by the compilation.
168# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
169# @param $(flags) Flags.
170# @param $(defs) Definitions. No -D or something.
171# @param $(incs) Includes. No -I or something.
172# @param $(dirdep) Directory creation dependency.
173# @param $(deps) Other dependencies.
174#
175# @param $(outbase) Output basename (full). Use this for list files and such.
176# @param $(objsuff) Object suffix.
177TOOL_VCC141X86_COMPILE_C_DEPEND =
178TOOL_VCC141X86_COMPILE_C_DEPORD =
179TOOL_VCC141X86_COMPILE_C_OUTPUT =
180TOOL_VCC141X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC141_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC141_PDB, $(outbase)-obj,idb)
181ifdef TOOL_VCC141X86_KSUBMIT
182 TOOL_VCC141X86_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
183 define TOOL_VCC141X86_COMPILE_C_CMDS
184 $(QUIET)$(TOOL_VCC141X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
185 -- $(TOOL_VCC141X86_CC) -c\
186 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
187 -Fd$(outbase)-obj.pdb \
188 -Fo$(obj)\
189 $(subst /,\\,$(abspath $(source)))
190 endef
191else
192 define TOOL_VCC141X86_COMPILE_C_CMDS
193 $(QUIET)$(TOOL_VCC141X86_SETUP_ENV)$(TOOL_VCC141X86_CC) -c\
194 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
195 -Fd$(outbase)-obj.pdb \
196 -Fo$(obj)\
197 $(subst /,\\,$(abspath $(source)))
198 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
199 endef
200endif # !TOOL_VCC141X86_KSUBMIT
201
202
203## Compile C++ source.
204# @param $(target) Normalized main target name.
205# @param $(source) Source filename (relative).
206# @param $(obj) Object file name. This shall be (re)created by the compilation.
207# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
208# @param $(flags) Flags.
209# @param $(defs) Definitions. No -D or something.
210# @param $(incs) Includes. No -I or something.
211# @param $(dirdep) Directory creation dependency.
212# @param $(deps) Other dependencies.
213#
214# @param $(outbase) Output basename (full). Use this for list files and such.
215# @param $(objsuff) Object suffix.
216TOOL_VCC141X86_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
217TOOL_VCC141X86_COMPILE_CXX_DEPORD =
218TOOL_VCC141X86_COMPILE_CXX_OUTPUT =
219TOOL_VCC141X86_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
220 ,,$(call TOOL_VCC141_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC141_PDB, $(outbase)-obj,idb))
221ifdef TOOL_VCC141X86_KSUBMIT
222 TOOL_VCC141X86_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
223 define TOOL_VCC141X86_COMPILE_CXX_CMDS
224 $(QUIET)$(TOOL_VCC141X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
225 -- $(TOOL_VCC141X86_CXX) -c\
226 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
227 $(if-expr defined($(target)_PCH_HDR)\
228 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
229 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
230 -Fo$(obj)\
231 $(subst /,\\,$(abspath $(source)))
232 endef
233else
234 define TOOL_VCC141X86_COMPILE_CXX_CMDS
235 $(QUIET)$(TOOL_VCC141X86_SETUP_ENV)$(TOOL_VCC141X86_CXX) -c\
236 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
237 $(if-expr defined($(target)_PCH_HDR)\
238 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
239 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
240 -Fo$(obj)\
241 $(subst /,\\,$(abspath $(source)))
242 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
243 endef
244endif # !TOOL_VCC141X86_KSUBMIT
245
246
247#
248# Helper tool for creating the precompiled C++ header.
249#
250# It only have the C++ compile bits and it's purpose is to skip bits
251# related _1_VCC_PCH_FILE and add -Yc.
252#
253TOOL_VCC141X86-PCH := Helper for creating precompiled header using CXX handling.
254TOOL_VCC141X86-PCH_EXTENDS := VCC141X86
255TOOL_VCC141X86-PCH_CXXOBJSUFF := .obj
256TOOL_VCC141X86-PCH_CXXINCS = $(TOOL_VCC141X86_CXXINCS)
257TOOL_VCC141X86-PCH_CXXFLAGS = $(TOOL_VCC141X86_CXXFLAGS) -FS
258TOOL_VCC141X86-PCH_CXXFLAGS.debug = $(TOOL_VCC141X86_CXXFLAGS.debug)
259TOOL_VCC141X86-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC141X86_CXXFLAGS.dbgopt)
260TOOL_VCC141X86-PCH_CXXFLAGS.release = $(TOOL_VCC141X86_CXXFLAGS.release)
261TOOL_VCC141X86-PCH_CXXFLAGS.profile = $(TOOL_VCC141X86_CXXFLAGS.profile)
262TOOL_VCC141X86-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
263TOOL_VCC141X86-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
264TOOL_VCC141X86-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
265TOOL_VCC141X86-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
266ifdef TOOL_VCC141X86_KSUBMIT
267 define TOOL_VCC141X86-PCH_COMPILE_CXX_CMDS
268 $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
269 $(QUIET)$(TOOL_VCC141X86_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
270 -- $(TOOL_VCC141X86_CXX) -c -Yc\
271 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
272 -Fp$($(target)_1_VCC_PCH_FILE) \
273 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
274 -Fo$(obj)\
275 -TP \
276 $(subst /,\\,$(abspath $(source)))
277 endef
278else
279 define TOOL_VCC141X86-PCH_COMPILE_CXX_CMDS
280 $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
281 $(QUIET)$(TOOL_VCC141X86_SETUP_ENV)$(TOOL_VCC141X86_CXX) -c -Yc\
282 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
283 -Fp$($(target)_1_VCC_PCH_FILE) \
284 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
285 -Fo$(obj)\
286 -TP \
287 $(subst /,\\,$(abspath $(source)))
288 $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
289
290 endef
291endif # !TOOL_VCC141X86_KSUBMIT
292
293
294## @todo configure the assembler template.
295
296## Compile resource source.
297# @param $(target) Normalized main target name.
298# @param $(source) Source filename (relative).
299# @param $(obj) Object file name. This shall be (re)created by the compilation.
300# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
301# @param $(flags) Flags.
302# @param $(defs) Definitions. No -D or something.
303# @param $(incs) Includes. No -I or something.
304# @param $(dirdep) Directory creation dependency.
305# @param $(deps) Other dependencies.
306#
307# @param $(outbase) Output basename (full). Use this for list files and such.
308# @param $(objsuff) Object suffix.
309TOOL_VCC141X86_COMPILE_RC_DEPEND =
310TOOL_VCC141X86_COMPILE_RC_DEPORD =
311TOOL_VCC141X86_COMPILE_RC_OUTPUT =
312define TOOL_VCC141X86_COMPILE_RC_CMDS
313 $(QUIET)$(TOOL_VCC141X86_RC) \
314 $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
315 /fo$(obj)\
316 $(subst /,\\,$(abspath $(source)))
317endef
318
319
320## Link library
321# @param $(target) Normalized main target name.
322# @param $(out) Library name.
323# @param $(objs) Object files to put in the library.
324# @param $(flags) Flags.
325# @param $(dirdep) Directory creation dependency.
326# @param $(deps) Other dependencies.
327# @param $(othersrc) Unhandled sources.
328# @param $(outbase) Output basename (full). Use this for list files and such.
329#
330TOOL_VCC141X86_LINK_LIBRARY_DEPEND = $(othersrc)
331TOOL_VCC141X86_LINK_LIBRARY_DEPORD =
332TOOL_VCC141X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
333TOOL_VCC141X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
334define TOOL_VCC141X86_LINK_LIBRARY_CMDS
335 $(QUIET)$(APPEND) -tn $(outbase).rsp \
336 $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
337 $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
338 $(QUIET)$(TOOL_VCC141X86_KSUBMIT_DD) $(TOOL_VCC141X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
339endef
340
341
342## Link program
343# @param $(target) Normalized main target name.
344# @param $(out) Program name.
345# @param $(objs) Object files to link together.
346# @param $(libs) Libraries to search.
347# @param $(libpath) Library search paths.
348# @param $(flags) Flags.
349# @param $(dirdep) Directory creation dependency.
350# @param $(deps) Other dependencies.
351# @param $(othersrc) Unhandled sources.
352# @param $(custom_pre) Custom step invoked before linking.
353# @param $(custom_post) Custom step invoked after linking.
354# @param $(outbase) Output basename (full). Use this for list files and such.
355#
356TOOL_VCC141X86_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
357TOOL_VCC141X86_LINK_PROGRAM_DEPORD =
358TOOL_VCC141X86_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
359TOOL_VCC141X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
360TOOL_VCC141X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
361TOOL_VCC141X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
362define TOOL_VCC141X86_LINK_PROGRAM_CMDS
363 $(QUIET)$(APPEND) -tn $(outbase).rsp \
364 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
365 $(QUIET)$(TOOL_VCC141X86_KSUBMIT_DD) $(TOOL_VCC141X86_LD) $(flags) \
366 /OUT:$(out) \
367 /MAPINFO:EXPORTS /INCREMENTAL:NO \
368 /MAP:$(outbase).map \
369 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
370 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
371 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
372 @$(outbase).rsp
373ifndef TOOL_VCC141X86_NO_AUTO_MANIFEST
374 $(QUIET)$(TEST) -f $(out).manifest -- \
375 $(TOOL_VCC141X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
376endif
377endef
378
379
380## Link DLL.
381# @param $(target) Normalized main target name.
382# @param $(out) DLL name.
383# @param $(objs) Object files to link together.
384# @param $(libs) Libraries to search.
385# @param $(libpath) Library search paths.
386# @param $(flags) Flags.
387# @param $(dirdep) Directory creation dependency.
388# @param $(deps) Other dependencies.
389# @param $(othersrc) Unhandled sources.
390# @param $(custom_pre) Custom step invoked before linking.
391# @param $(custom_post) Custom step invoked after linking.
392#
393# @param $(outbase) Output basename (full). Use this for list files and such.
394TOOL_VCC141X86_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
395TOOL_VCC141X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
396TOOL_VCC141X86_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
397TOOL_VCC141X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
398TOOL_VCC141X86_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
399TOOL_VCC141X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
400TOOL_VCC141X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
401define TOOL_VCC141X86_LINK_DLL_CMDS
402 $(QUIET)$(APPEND) -tn $(outbase).rsp \
403 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
404 $(QUIET)$(TOOL_VCC141X86_KSUBMIT_DD) $(TOOL_VCC141X86_LD) $(flags) \
405 /OUT:$(out) \
406 /IMPLIB:$(outbase).lib \
407 /MAPINFO:EXPORTS /INCREMENTAL:NO \
408 /MAP:$(outbase).map \
409 /DLL \
410 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
411 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
412 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
413 @$(outbase).rsp
414ifndef TOOL_VCC141X86_NO_AUTO_MANIFEST
415 $(QUIET)$(TEST) -f $(out).manifest -- \
416 $(TOOL_VCC141X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
417endif
418 $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
419 $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
420$(eval _DIRS += $(PATH_STAGE_LIB))
421endef
422
423
424## Link system module (windows aka driver, linux aka kernel module)
425# @param $(target) Normalized main target name.
426# @param $(out) System module name.
427# @param $(objs) Object files to link together.
428# @param $(libs) Libraries to search.
429# @param $(libpath) Library search paths.
430# @param $(flags) Flags.
431# @param $(dirdep) Directory creation dependency.
432# @param $(deps) Other dependencies.
433# @param $(othersrc) Unhandled sources.
434# @param $(custom_pre) Custom step invoked before linking.
435# @param $(custom_post) Custom step invoked after linking.
436#
437# @param $(outbase) Output basename (full). Use this for list files and such.
438TOOL_VCC141X86_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
439TOOL_VCC141X86_LINK_SYSMOD_DEPORD =
440TOOL_VCC141X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
441TOOL_VCC141X86_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
442TOOL_VCC141X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
443TOOL_VCC141X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
444define TOOL_VCC141X86_LINK_SYSMOD_CMDS
445 $(QUIET)$(APPEND) -tn $(outbase).rsp \
446 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
447 $(QUIET)$(TOOL_VCC141X86_KSUBMIT_DD) $(TOOL_VCC141X86_LD) $(flags) \
448 /OUT:$(out) \
449 /MAPINFO:EXPORTS /INCREMENTAL:NO \
450 /MAP:$(outbase).map \
451 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
452 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
453 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
454 @$(outbase).rsp
455ifndef TOOL_VCC141X86_NO_AUTO_MANIFEST
456 $(QUIET)$(TEST) -f $(out).manifest -- \
457 $(TOOL_VCC141X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
458endif
459endef
460
Note: See TracBrowser for help on using the repository browser.