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

Last change on this file since 3326 was 3326, checked in by bird, 5 years ago

tools/VCC141*.kmk: More work on the Visual C++ 14.1 tools.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.3 KB
Line 
1# $Id: VCC141X86.kmk 3326 2020-04-17 19:10:19Z 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_VCC141_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)/ml64.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 ?= $(EXEC_X86_WIN32) $(call TOOL_VCC141_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC141_MT_CACHED)
93
94undefine TOOL_VCC141X86_USE_KSUBMIT # for now
95ifdef TOOL_VCC141X86_USE_KSUBMIT
96 ifeq ($(KBUILD_HOST),win)
97 ifneq ($(substr $(qdir un,$(PATH_TOOL_VCC141X86_BIN)),-3),64/)
98 TOOL_VCC141X86_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
99 else
100 TOOL_VCC141X86_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
101 endif
102 ifdef PATH_TOOL_VCC141X86_DLL_BIN
103 TOOL_VCC141X86_KSUBMIT := $(TOOL_VCC141X86_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC141X86_DLL_BIN));"
104 endif
105 TOOL_VCC141X86_KSUBMIT_DD := $(TOOL_VCC141X86_KSUBMIT) --
106 endif
107endif
108ifdef PATH_TOOL_VCC141X86_DLL_BIN
109 TOOL_VCC141X86_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC141X86_DLL_BIN));" --$(SP)
110 ifndef TOOL_VCC141X86_KSUBMIT_DD
111 TOOL_VCC141X86_KSUBMIT_DD := $(TOOL_VCC141X86_SETUP_ENV)
112 endif
113endif
114
115
116#
117# Properties used by kBuild
118#
119TOOL_VCC141X86_COBJSUFF ?= .obj
120TOOL_VCC141X86_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
121TOOL_VCC141X86_CFLAGS.debug ?=
122TOOL_VCC141X86_CFLAGS.dbgopt ?= -O2
123TOOL_VCC141X86_CFLAGS.release ?= -O2
124TOOL_VCC141X86_CFLAGS.profile ?= -O2
125TOOL_VCC141X86_CINCS ?= $(PATH_TOOL_VCC141X86_INC)
126TOOL_VCC141X86_CDEFS ?=
127
128TOOL_VCC141X86_CXXOBJSUFF ?= .obj
129TOOL_VCC141X86_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
130TOOL_VCC141X86_CXXFLAGS.debug ?=
131TOOL_VCC141X86_CXXFLAGS.dbgopt ?= -O2
132TOOL_VCC141X86_CXXFLAGS.release ?= -O2
133TOOL_VCC141X86_CXXFLAGS.profile ?= -O2
134TOOL_VCC141X86_CXXINCS ?= $(PATH_TOOL_VCC141X86_INC) $(PATH_TOOL_VCC141X86_ATLMFC_INC)
135TOOL_VCC141X86_CXXDEFS ?=
136
137TOOL_VCC141X86_ASOBJSUFF ?= .obj
138
139TOOL_VCC141X86_RCOBJSUFF ?= .res
140TOOL_VCC141X86_RCINCS ?= $(PATH_TOOL_VCC141X86_INC) $(PATH_TOOL_VCC141X86_ATLMFC_INC)
141
142TOOL_VCC141X86_ARFLAGS ?= -nologo -machine:x86
143TOOL_VCC141X86_ARLIBSUFF ?= .lib
144
145TOOL_VCC141X86_LDFLAGS ?= -nologo -machine:x86
146TOOL_VCC141X86_LDFLAGS.debug ?= -debug
147TOOL_VCC141X86_LDFLAGS.dbgopt ?= -debug
148TOOL_VCC141X86_LDFLAGS.profile ?= -debug
149TOOL_VCC141X86_LDFLAGS.release ?=
150
151
152
153## Compile C source.
154# @param $(target) Normalized main target name.
155# @param $(source) Source filename (relative).
156# @param $(obj) Object file name. This shall be (re)created by the compilation.
157# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
158# @param $(flags) Flags.
159# @param $(defs) Definitions. No -D or something.
160# @param $(incs) Includes. No -I or something.
161# @param $(dirdep) Directory creation dependency.
162# @param $(deps) Other dependencies.
163#
164# @param $(outbase) Output basename (full). Use this for list files and such.
165# @param $(objsuff) Object suffix.
166TOOL_VCC141X86_COMPILE_C_DEPEND =
167TOOL_VCC141X86_COMPILE_C_DEPORD =
168TOOL_VCC141X86_COMPILE_C_OUTPUT =
169TOOL_VCC141X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC141_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC141_PDB, $(outbase)-obj,idb)
170ifdef TOOL_VCC141X86_KSUBMIT
171 TOOL_VCC141X86_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
172 define TOOL_VCC141X86_COMPILE_C_CMDS
173 $(QUIET)$(TOOL_VCC141X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
174 -- $(TOOL_VCC141X86_CC) -c\
175 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
176 -Fd$(outbase)-obj.pdb \
177 -Fo$(obj)\
178 $(subst /,\\,$(abspath $(source)))
179 endef
180else
181 define TOOL_VCC141X86_COMPILE_C_CMDS
182 $(QUIET)$(TOOL_VCC141X86_SETUP_ENV)$(TOOL_VCC141X86_CC) -c\
183 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
184 -Fd$(outbase)-obj.pdb \
185 -Fo$(obj)\
186 $(subst /,\\,$(abspath $(source)))
187 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
188 endef
189endif # !TOOL_VCC141X86_KSUBMIT
190
191
192## Compile C++ source.
193# @param $(target) Normalized main target name.
194# @param $(source) Source filename (relative).
195# @param $(obj) Object file name. This shall be (re)created by the compilation.
196# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
197# @param $(flags) Flags.
198# @param $(defs) Definitions. No -D or something.
199# @param $(incs) Includes. No -I or something.
200# @param $(dirdep) Directory creation dependency.
201# @param $(deps) Other dependencies.
202#
203# @param $(outbase) Output basename (full). Use this for list files and such.
204# @param $(objsuff) Object suffix.
205TOOL_VCC141X86_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
206TOOL_VCC141X86_COMPILE_CXX_DEPORD =
207TOOL_VCC141X86_COMPILE_CXX_OUTPUT =
208TOOL_VCC141X86_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
209 ,,$(call TOOL_VCC141_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC141_PDB, $(outbase)-obj,idb))
210ifdef TOOL_VCC141X86_KSUBMIT
211 TOOL_VCC141X86_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
212 define TOOL_VCC141X86_COMPILE_CXX_CMDS
213 $(QUIET)$(TOOL_VCC141X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
214 -- $(TOOL_VCC141X86_CXX) -c\
215 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
216 $(if-expr defined($(target)_PCH_HDR)\
217 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
218 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
219 -Fo$(obj)\
220 $(subst /,\\,$(abspath $(source)))
221 endef
222else
223 define TOOL_VCC141X86_COMPILE_CXX_CMDS
224 $(QUIET)$(TOOL_VCC141X86_SETUP_ENV)$(TOOL_VCC141X86_CXX) -c\
225 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
226 $(if-expr defined($(target)_PCH_HDR)\
227 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
228 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
229 -Fo$(obj)\
230 $(subst /,\\,$(abspath $(source)))
231 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
232 endef
233endif # !TOOL_VCC141X86_KSUBMIT
234
235
236#
237# Helper tool for creating the precompiled C++ header.
238#
239# It only have the C++ compile bits and it's purpose is to skip bits
240# related _1_VCC_PCH_FILE and add -Yc.
241#
242TOOL_VCC141X86-PCH := Helper for creating precompiled header using CXX handling.
243TOOL_VCC141X86-PCH_EXTENDS := VCC141X86
244TOOL_VCC141X86-PCH_CXXOBJSUFF := .obj
245TOOL_VCC141X86-PCH_CXXINCS = $(TOOL_VCC141X86_CXXINCS)
246TOOL_VCC141X86-PCH_CXXFLAGS = $(TOOL_VCC141X86_CXXFLAGS) -FS
247TOOL_VCC141X86-PCH_CXXFLAGS.debug = $(TOOL_VCC141X86_CXXFLAGS.debug)
248TOOL_VCC141X86-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC141X86_CXXFLAGS.dbgopt)
249TOOL_VCC141X86-PCH_CXXFLAGS.release = $(TOOL_VCC141X86_CXXFLAGS.release)
250TOOL_VCC141X86-PCH_CXXFLAGS.profile = $(TOOL_VCC141X86_CXXFLAGS.profile)
251TOOL_VCC141X86-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
252TOOL_VCC141X86-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
253TOOL_VCC141X86-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
254TOOL_VCC141X86-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
255ifdef TOOL_VCC141X86_KSUBMIT
256 define TOOL_VCC141X86-PCH_COMPILE_CXX_CMDS
257 $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
258 $(QUIET)$(TOOL_VCC141X86_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
259 -- $(TOOL_VCC141X86_CXX) -c -Yc\
260 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
261 -Fp$($(target)_1_VCC_PCH_FILE) \
262 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
263 -Fo$(obj)\
264 -TP \
265 $(subst /,\\,$(abspath $(source)))
266 endef
267else
268 define TOOL_VCC141X86-PCH_COMPILE_CXX_CMDS
269 $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
270 $(QUIET)$(TOOL_VCC141X86_SETUP_ENV)$(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 $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
278
279 endef
280endif # !TOOL_VCC141X86_KSUBMIT
281
282
283## @todo configure the assembler template.
284
285## Compile resource source.
286# @param $(target) Normalized main target name.
287# @param $(source) Source filename (relative).
288# @param $(obj) Object file name. This shall be (re)created by the compilation.
289# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
290# @param $(flags) Flags.
291# @param $(defs) Definitions. No -D or something.
292# @param $(incs) Includes. No -I or something.
293# @param $(dirdep) Directory creation dependency.
294# @param $(deps) Other dependencies.
295#
296# @param $(outbase) Output basename (full). Use this for list files and such.
297# @param $(objsuff) Object suffix.
298TOOL_VCC141X86_COMPILE_RC_DEPEND =
299TOOL_VCC141X86_COMPILE_RC_DEPORD =
300TOOL_VCC141X86_COMPILE_RC_OUTPUT =
301define TOOL_VCC141X86_COMPILE_RC_CMDS
302 $(QUIET)$(TOOL_VCC141X86_RC) \
303 $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
304 /fo$(obj)\
305 $(subst /,\\,$(abspath $(source)))
306endef
307
308
309## Link library
310# @param $(target) Normalized main target name.
311# @param $(out) Library name.
312# @param $(objs) Object files to put in the library.
313# @param $(flags) Flags.
314# @param $(dirdep) Directory creation dependency.
315# @param $(deps) Other dependencies.
316# @param $(othersrc) Unhandled sources.
317# @param $(outbase) Output basename (full). Use this for list files and such.
318#
319TOOL_VCC141X86_LINK_LIBRARY_DEPEND = $(othersrc)
320TOOL_VCC141X86_LINK_LIBRARY_DEPORD =
321TOOL_VCC141X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
322TOOL_VCC141X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
323define TOOL_VCC141X86_LINK_LIBRARY_CMDS
324 $(QUIET)$(APPEND) -tn $(outbase).rsp \
325 $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
326 $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
327 $(QUIET)$(TOOL_VCC141X86_KSUBMIT_DD) $(TOOL_VCC141X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
328endef
329
330
331## Link program
332# @param $(target) Normalized main target name.
333# @param $(out) Program name.
334# @param $(objs) Object files to link together.
335# @param $(libs) Libraries to search.
336# @param $(libpath) Library search paths.
337# @param $(flags) Flags.
338# @param $(dirdep) Directory creation dependency.
339# @param $(deps) Other dependencies.
340# @param $(othersrc) Unhandled sources.
341# @param $(custom_pre) Custom step invoked before linking.
342# @param $(custom_post) Custom step invoked after linking.
343# @param $(outbase) Output basename (full). Use this for list files and such.
344#
345TOOL_VCC141X86_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
346TOOL_VCC141X86_LINK_PROGRAM_DEPORD =
347TOOL_VCC141X86_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
348TOOL_VCC141X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
349TOOL_VCC141X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
350TOOL_VCC141X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
351define TOOL_VCC141X86_LINK_PROGRAM_CMDS
352 $(QUIET)$(APPEND) -tn $(outbase).rsp \
353 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
354 $(QUIET)$(TOOL_VCC141X86_KSUBMIT_DD) $(TOOL_VCC141X86_LD) $(flags) \
355 /OUT:$(out) \
356 /MAPINFO:EXPORTS /INCREMENTAL:NO \
357 /MAP:$(outbase).map \
358 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
359 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
360 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
361 @$(outbase).rsp
362ifndef TOOL_VCC141X86_NO_AUTO_MANIFEST
363 $(QUIET)$(TEST) -f $(out).manifest -- \
364 $(TOOL_VCC141X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
365endif
366endef
367
368
369## Link DLL.
370# @param $(target) Normalized main target name.
371# @param $(out) DLL name.
372# @param $(objs) Object files to link together.
373# @param $(libs) Libraries to search.
374# @param $(libpath) Library search paths.
375# @param $(flags) Flags.
376# @param $(dirdep) Directory creation dependency.
377# @param $(deps) Other dependencies.
378# @param $(othersrc) Unhandled sources.
379# @param $(custom_pre) Custom step invoked before linking.
380# @param $(custom_post) Custom step invoked after linking.
381#
382# @param $(outbase) Output basename (full). Use this for list files and such.
383TOOL_VCC141X86_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
384TOOL_VCC141X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
385TOOL_VCC141X86_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
386TOOL_VCC141X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
387TOOL_VCC141X86_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
388TOOL_VCC141X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
389TOOL_VCC141X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
390define TOOL_VCC141X86_LINK_DLL_CMDS
391 $(QUIET)$(APPEND) -tn $(outbase).rsp \
392 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
393 $(QUIET)$(TOOL_VCC141X86_KSUBMIT_DD) $(TOOL_VCC141X86_LD) $(flags) \
394 /OUT:$(out) \
395 /IMPLIB:$(outbase).lib \
396 /MAPINFO:EXPORTS /INCREMENTAL:NO \
397 /MAP:$(outbase).map \
398 /DLL \
399 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
400 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
401 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
402 @$(outbase).rsp
403ifndef TOOL_VCC141X86_NO_AUTO_MANIFEST
404 $(QUIET)$(TEST) -f $(out).manifest -- \
405 $(TOOL_VCC141X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
406endif
407 $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
408 $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
409$(eval _DIRS += $(PATH_STAGE_LIB))
410endef
411
412
413## Link system module (windows aka driver, linux aka kernel module)
414# @param $(target) Normalized main target name.
415# @param $(out) System module name.
416# @param $(objs) Object files to link together.
417# @param $(libs) Libraries to search.
418# @param $(libpath) Library search paths.
419# @param $(flags) Flags.
420# @param $(dirdep) Directory creation dependency.
421# @param $(deps) Other dependencies.
422# @param $(othersrc) Unhandled sources.
423# @param $(custom_pre) Custom step invoked before linking.
424# @param $(custom_post) Custom step invoked after linking.
425#
426# @param $(outbase) Output basename (full). Use this for list files and such.
427TOOL_VCC141X86_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
428TOOL_VCC141X86_LINK_SYSMOD_DEPORD =
429TOOL_VCC141X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
430TOOL_VCC141X86_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
431TOOL_VCC141X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
432TOOL_VCC141X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
433define TOOL_VCC141X86_LINK_SYSMOD_CMDS
434 $(QUIET)$(APPEND) -tn $(outbase).rsp \
435 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
436 $(QUIET)$(TOOL_VCC141X86_KSUBMIT_DD) $(TOOL_VCC141X86_LD) $(flags) \
437 /OUT:$(out) \
438 /MAPINFO:EXPORTS /INCREMENTAL:NO \
439 /MAP:$(outbase).map \
440 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
441 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
442 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
443 @$(outbase).rsp
444ifndef TOOL_VCC141X86_NO_AUTO_MANIFEST
445 $(QUIET)$(TEST) -f $(out).manifest -- \
446 $(TOOL_VCC141X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
447endif
448endef
449
Note: See TracBrowser for help on using the repository browser.