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

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

tools/VCC141*: Redist DLLs and stuff.

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