src/Makefile.kmk: new sed on windows
[kbuild-mirror.git] / kBuild / tools / VCC120.kmk
blob035cd83f414b2e9a889455700177c4773e7a79cc
1 # $Id$
2 ## @file
3 # kBuild Tool Config - Visual C++ 12.0 (aka Visual 2013 and MSC v18), targeting $(KBUILD_TARGET).
7 # Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
9 # This file is part of kBuild.
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.
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.
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
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.
34 TOOL_VCC120 := Visual C++ 12.0 (aka Visual 2013 and MSC v18), targeting $(KBUILD_TARGET).
36 # Tool Specific Properties
37 ifndef PATH_TOOL_VCC120
38 PATH_TOOL_VCC120 := $(wildcard $(KBUILD_DEVTOOLS_TRG)/vcc/v12*)
39 ifeq ($(PATH_TOOL_VCC120),)
40 PATH_TOOL_VCC120 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v12*)
41 endif
42 ifeq ($(PATH_TOOL_VCC120),)
43 PATH_TOOL_VCC120 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/vcc/v12*)
44 endif
45 ifeq ($(PATH_TOOL_VCC120),)
46 PATH_TOOL_VCC120 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/vcc/v12*)
47 endif
48 ifeq ($(PATH_TOOL_VCC120),)
49 PATH_TOOL_VCC120 := $(lastword $(sort $(PATH_TOOL_VCC120)))
50 endif
51 # if not found, we'll enter 'pathless' mode.
52 else
53 # Resolve any fancy stuff once and for all.
54 PATH_TOOL_VCC120 := $(PATH_TOOL_VCC120)
55 endif
56 ifneq ($(PATH_TOOL_VCC120),)
57 if "$(KBUILD_HOST).$(KBUILD_HOST_ARCH)" == "win.amd64" && exists("$(PATH_TOOL_VCC120AMD64)/bin/amd64") # Missing in express edition.
58 PATH_TOOL_VCC120_BIN.amd64 ?= $(PATH_TOOL_VCC120)/bin/amd64
59 else
60 PATH_TOOL_VCC120_BIN.amd64 ?= $(PATH_TOOL_VCC120)/bin/x86_amd64
61 endif
62 PATH_TOOL_VCC120_BIN.x86 ?= $(PATH_TOOL_VCC120)/bin
63 PATH_TOOL_VCC120_BIN ?= $(PATH_TOOL_VCC120_BIN.$(KBUILD_TARGET_ARCH))
64 PATH_TOOL_VCC120_LIB.amd64 ?= $(PATH_TOOL_VCC120)/lib/amd64
65 PATH_TOOL_VCC120_LIB.x86 ?= $(PATH_TOOL_VCC120)/lib
66 PATH_TOOL_VCC120_LIB ?= $(PATH_TOOL_VCC120_LIB.$(KBUILD_TARGET_ARCH))
67 PATH_TOOL_VCC120_INC ?= $(PATH_TOOL_VCC120)/include
68 PATH_TOOL_VCC120_ATLMFC ?= $(PATH_TOOL_VCC120X86)/atlmfc
69 PATH_TOOL_VCC120_ATLMFC_INC ?= $(PATH_TOOL_VCC120_ATLMFC)/include
70 PATH_TOOL_VCC120_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC120_ATLMFC)/lib
71 PATH_TOOL_VCC120_ATLMFC_LIB.x86 ?= $(PATH_TOOL_VCC120_ATLMFC)/lib/amd64
72 PATH_TOOL_VCC120_ATLMFC_LIB ?= $(PATH_TOOL_VCC120_ATLMFC_LIB.$(KBUILD_TARGET_ARCH))
73 TOOL_VCC120_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/cl.exe
74 TOOL_VCC120_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/cl.exe
75 TOOL_VCC120_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/ml64.exe
76 TOOL_VCC120_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/lib.exe
77 TOOL_VCC120_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/link.exe
78 TOOL_VCC120_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/dumpbin.exe
79 TOOL_VCC120_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC120_BIN)/editbin.exe
80 else
81 # Pathless, relies on the environment.
82 TOOL_VCC120_CC ?= $(EXEC_X86_WIN32) cl.exe
83 TOOL_VCC120_CXX ?= $(EXEC_X86_WIN32) cl.exe
84 TOOL_VCC120_AS ?= $(EXEC_X86_WIN32) ml64.exe
85 TOOL_VCC120_AR ?= $(EXEC_X86_WIN32) lib.exe
86 TOOL_VCC120_LD ?= $(EXEC_X86_WIN32) link.exe
87 TOOL_VCC120_DUMPBIN ?= $(EXEC_X86_WIN32) dumpbin.exe
88 TOOL_VCC120_EDITBIN ?= $(EXEC_X86_WIN32) editbin.exe
89 endif
90 TOOL_VCC120_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC120_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC120_RC_CACHED)
91 TOOL_VCC120_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC120_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC120_MT_CACHED)
93 # The following in duplicated in VCC120.kmk and VCC120X86.kmk.
94 TOOL_VCC120_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(firstword \
95 $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(wildcard $(PATH_SDK_WINPSDK71_BIN)/$2)) \
96 $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(wildcard $(PATH_SDK_WINPSDK_BIN)/$2)) \
97 $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
98 $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
99 $1))
100 TOOL_VCC120_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC120_FN_FIND_SDK_TOOL_SUB),)$($3)
102 ## Disabled fast DEP_IDB based dependencies.
103 #VCC120_OLD_DEPS = 1
105 ## Constructs the correct .pdb name (the name is lowercased).
106 # @param $(1) Base name, no extention.
107 # @param $(2) The extension.
108 TOOL_VCC120_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
111 # General Properties used by kBuild
112 TOOL_VCC120_COBJSUFF ?= .obj
113 TOOL_VCC120_CFLAGS ?= -TC -nologo -Zi
114 TOOL_VCC120_CFLAGS.debug ?=
115 TOOL_VCC120_CFLAGS.dbgopt ?= -O2
116 TOOL_VCC120_CFLAGS.release ?= -O2
117 TOOL_VCC120_CFLAGS.profile ?= -O2
118 TOOL_VCC120_CINCS ?= $(PATH_TOOL_VCC120_INC)
119 TOOL_VCC120_CDEFS ?=
121 TOOL_VCC120_CXXOBJSUFF ?= .obj
122 TOOL_VCC120_CXXFLAGS ?= -TP -nologo -Zi
123 TOOL_VCC120_CXXFLAGS.debug ?=
124 TOOL_VCC120_CXXFLAGS.dbgopt ?= -O2
125 TOOL_VCC120_CXXFLAGS.release ?= -O2
126 TOOL_VCC120_CXXFLAGS.profile ?= -O2
127 TOOL_VCC120_CXXINCS ?= $(PATH_TOOL_VCC120_INC) $(PATH_TOOL_VCC120_ATLMFC_INC)
128 TOOL_VCC120_CXXDEFS ?=
130 TOOL_VCC120_ASOBJSUFF ?= .obj
132 TOOL_VCC120_RCOBJSUFF ?= .res
133 TOOL_VCC120_RCINCS ?= $(PATH_TOOL_VCC120_INC) $(PATH_TOOL_VCC120_ATLMFC_INC)
135 TOOL_VCC120_ARFLAGS.amd64 ?= -machine:amd64
136 TOOL_VCC120_ARFLAGS.x86 ?= -machine:x86
137 TOOL_VCC120_ARFLAGS ?= -nologo
138 TOOL_VCC120_ARLIBSUFF ?= .lib
140 TOOL_VCC120_LDFLAGS.amd64 ?= -machine:amd64
141 TOOL_VCC120_LDFLAGS.x86 ?= -machine:x86
142 TOOL_VCC120_LDFLAGS ?= -nologo
143 TOOL_VCC120_LDFLAGS.debug ?= -debug
144 TOOL_VCC120_LDFLAGS.dbgopt ?= -debug
145 TOOL_VCC120_LDFLAGS.profile ?= -debug
146 TOOL_VCC120_LDFLAGS.release ?=
147 TOOL_VCC120_LIBPATH.amd64 ?= $(PATH_TOOL_VCC120_LIB.amd64) $(PATH_TOOL_VCC120_ATLMFC_LIB.amd64)
148 TOOL_VCC120_LIBPATH.x86 ?= $(PATH_TOOL_VCC120_LIB.x86) $(PATH_TOOL_VCC120_ATLMFC_LIB.x86)
152 ## Compile C source.
153 # @param $(target) Normalized main target name.
154 # @param $(source) Source filename (relative).
155 # @param $(obj) Object file name. This shall be (re)created by the compilation.
156 # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
157 # @param $(flags) Flags.
158 # @param $(defs) Definitions. No -D or something.
159 # @param $(incs) Includes. No -I or something.
160 # @param $(dirdep) Directory creation dependency.
161 # @param $(deps) Other dependencies.
163 # @param $(outbase) Output basename (full). Use this for list files and such.
164 # @param $(objsuff) Object suffix.
165 TOOL_VCC120_COMPILE_C_DEPEND =
166 TOOL_VCC120_COMPILE_C_DEPORD =
167 TOOL_VCC120_COMPILE_C_OUTPUT =
168 TOOL_VCC120_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC120_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC120_PDB, $(outbase)-obj,idb)
169 define TOOL_VCC120_COMPILE_C_CMDS
170 $(QUIET)$(TOOL_VCC120_CC) -c\
171 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
172 -Fd$(outbase)-obj.pdb \
173 -Fo$(obj)\
174 $(subst /,\\,$(abspath $(source)))
175 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
176 endef
179 ## Compile C++ source.
180 # @param $(target) Normalized main target name.
181 # @param $(source) Source filename (relative).
182 # @param $(obj) Object file name. This shall be (re)created by the compilation.
183 # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
184 # @param $(flags) Flags.
185 # @param $(defs) Definitions. No -D or something.
186 # @param $(incs) Includes. No -I or something.
187 # @param $(dirdep) Directory creation dependency.
188 # @param $(deps) Other dependencies.
190 # @param $(outbase) Output basename (full). Use this for list files and such.
191 # @param $(objsuff) Object suffix.
192 TOOL_VCC120_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
193 TOOL_VCC120_COMPILE_CXX_DEPORD =
194 TOOL_VCC120_COMPILE_CXX_OUTPUT =
195 TOOL_VCC120_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
196 ,,$(call TOOL_VCC120_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC120_PDB, $(outbase)-obj,idb))
197 define TOOL_VCC120_COMPILE_CXX_CMDS
198 $(QUIET)$(TOOL_VCC120_CXX) -c\
199 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
200 $(if-expr defined($(target)_PCH_HDR)\
201 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
202 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
203 -Fo$(obj)\
204 $(subst /,\\,$(abspath $(source)))
205 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
206 endef
210 # Helper tool for creating the precompiled C++ header.
212 # It only have the C++ compile bits and it's purpose is to skip bits
213 # related _1_VCC_PCH_FILE and add -Yc.
215 TOOL_VCC120-PCH := Helper for creating precompiled header using CXX handling.
216 TOOL_VCC120-PCH_EXTENDS := VCC120
217 TOOL_VCC120-PCH_CXXOBJSUFF := .obj
218 TOOL_VCC120-PCH_CXXINCS = $(TOOL_VCC120_CXXINCS)
219 TOOL_VCC120-PCH_CXXFLAGS = $(TOOL_VCC120_CXXFLAGS) -FS
220 TOOL_VCC120-PCH_CXXFLAGS.debug = $(TOOL_VCC120_CXXFLAGS.debug)
221 TOOL_VCC120-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC120_CXXFLAGS.dbgopt)
222 TOOL_VCC120-PCH_CXXFLAGS.release = $(TOOL_VCC120_CXXFLAGS.release)
223 TOOL_VCC120-PCH_CXXFLAGS.profile = $(TOOL_VCC120_CXXFLAGS.profile)
224 TOOL_VCC120-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
225 TOOL_VCC120-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
226 TOOL_VCC120-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
227 TOOL_VCC120-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
228 ifdef TOOL_VCC120_KSUBMIT
229 define TOOL_VCC120-PCH_COMPILE_CXX_CMDS
230 $(QUIET)$(TOOL_VCC120_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
231 -- $(TOOL_VCC120_CXX) -c -Yc\
232 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
233 -Fp$($(target)_1_VCC_PCH_FILE) \
234 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
235 -Fo$(obj)\
236 -TP \
237 $(subst /,\\,$(abspath $(source)))
238 endef
239 else
240 define TOOL_VCC120-PCH_COMPILE_CXX_CMDS
241 $(QUIET)$(TOOL_VCC120_CXX) -c -Yc\
242 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
243 -Fp$($(target)_1_VCC_PCH_FILE) \
244 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
245 -Fo$(obj)\
246 -TP \
247 $(subst /,\\,$(abspath $(source)))
248 $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
250 endef
251 endif # !TOOL_VCC120_KSUBMIT
254 ## @todo configure the assembler template.
256 ## Compile resource source.
257 # @param $(target) Normalized main target name.
258 # @param $(source) Source filename (relative).
259 # @param $(obj) Object file name. This shall be (re)created by the compilation.
260 # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
261 # @param $(flags) Flags.
262 # @param $(defs) Definitions. No -D or something.
263 # @param $(incs) Includes. No -I or something.
264 # @param $(dirdep) Directory creation dependency.
265 # @param $(deps) Other dependencies.
267 # @param $(outbase) Output basename (full). Use this for list files and such.
268 # @param $(objsuff) Object suffix.
269 TOOL_VCC120_COMPILE_RC_OUTPUT =
270 TOOL_VCC120_COMPILE_RC_DEPEND =
271 TOOL_VCC120_COMPILE_RC_DEPORD =
272 define TOOL_VCC120_COMPILE_RC_CMDS
273 $(QUIET)$(TOOL_VCC120_RC) \
274 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
275 /fo$(obj)\
276 $(subst /,\\,$(abspath $(source)))
277 endef
280 ## Link library
281 # @param $(target) Normalized main target name.
282 # @param $(out) Library name.
283 # @param $(objs) Object files to put in the library.
284 # @param $(flags) Flags.
285 # @param $(dirdep) Directory creation dependency.
286 # @param $(deps) Other dependencies.
287 # @param $(othersrc) Unhandled sources.
288 # @param $(outbase) Output basename (full). Use this for list files and such.
290 TOOL_VCC120_LINK_LIBRARY_DEPEND = $(othersrc)
291 TOOL_VCC120_LINK_LIBRARY_DEPORD =
292 TOOL_VCC120_LINK_LIBRARY_OUTPUT = $(outbase).rsp
293 TOOL_VCC120_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
294 define TOOL_VCC120_LINK_LIBRARY_CMDS
295 $(QUIET)$(APPEND) -tn $(outbase).rsp \
296 $(foreach arg,\
297 $(subst /,\\,$(objs) \
298 $(filter-out %.def,$(othersrc))) \
299 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
300 ,\"$(arg)\")
301 $(QUIET)$(TOOL_VCC120_AR) $(flags) /OUT:$(out) @$(outbase).rsp
302 endef
305 ## Link program
306 # @param $(target) Normalized main target name.
307 # @param $(out) Program name.
308 # @param $(objs) Object files to link together.
309 # @param $(libs) Libraries to search.
310 # @param $(libpath) Library search paths.
311 # @param $(flags) Flags.
312 # @param $(dirdep) Directory creation dependency.
313 # @param $(deps) Other dependencies.
314 # @param $(othersrc) Unhandled sources.
315 # @param $(custom_pre) Custom step invoked before linking.
316 # @param $(custom_post) Custom step invoked after linking.
317 # @param $(outbase) Output basename (full). Use this for list files and such.
319 TOOL_VCC120_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
320 TOOL_VCC120_LINK_PROGRAM_DEPORD =
321 TOOL_VCC120_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
322 TOOL_VCC120_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
323 TOOL_VCC120_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
324 TOOL_VCC120_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
325 define TOOL_VCC120_LINK_PROGRAM_CMDS
326 $(QUIET)$(APPEND) -tn $(outbase).rsp \
327 $(foreach arg,\
328 $(subst /,\\,$(objs)) \
329 $(subst /,\\,$(libs)) \
330 ,\"$(arg)\")
331 $(QUIET)$(TOOL_VCC120_LD) $(flags) \
332 /OUT:$(out) \
333 /MAPINFO:EXPORTS /INCREMENTAL:NO \
334 /MAP:$(outbase).map \
335 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
336 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
337 $(foreach p,$(libpath), /LIBPATH:$(p)) \
338 @$(outbase).rsp
339 ifndef TOOL_VCC120_NO_AUTO_MANIFEST
340 $(QUIET)$(TEST) -f $(out).manifest -- \
341 $(TOOL_VCC120_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
342 endif
343 endef
346 ## Link DLL.
347 # @param $(target) Normalized main target name.
348 # @param $(out) DLL name.
349 # @param $(objs) Object files to link together.
350 # @param $(libs) Libraries to search.
351 # @param $(libpath) Library search paths.
352 # @param $(flags) Flags.
353 # @param $(dirdep) Directory creation dependency.
354 # @param $(deps) Other dependencies.
355 # @param $(othersrc) Unhandled sources.
356 # @param $(custom_pre) Custom step invoked before linking.
357 # @param $(custom_post) Custom step invoked after linking.
359 # @param $(outbase) Output basename (full). Use this for list files and such.
360 TOOL_VCC120_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
361 TOOL_VCC120_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
362 TOOL_VCC120_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
363 TOOL_VCC120_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
364 TOOL_VCC120_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
365 TOOL_VCC120_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
366 TOOL_VCC120_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
367 define TOOL_VCC120_LINK_DLL_CMDS
368 $(QUIET)$(APPEND) -tn $(outbase).rsp \
369 $(foreach arg,\
370 $(subst /,\\,$(objs)) \
371 $(subst /,\\,$(libs)) \
372 ,\"$(arg)\")
373 $(QUIET)$(TOOL_VCC120_LD) $(flags) \
374 /OUT:$(out) \
375 /IMPLIB:$(outbase).lib \
376 /MAPINFO:EXPORTS /INCREMENTAL:NO \
377 /MAP:$(outbase).map \
378 /DLL \
379 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
380 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
381 $(foreach p,$(libpath), /LIBPATH:$(p)) \
382 @$(outbase).rsp
383 ifndef TOOL_VCC120_NO_AUTO_MANIFEST
384 $(QUIET)$(TEST) -f $(out).manifest -- \
385 $(TOOL_VCC120_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
386 endif
387 $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
388 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
389 $(eval _DIRS += $(PATH_STAGE_LIB))
390 endef
393 ## Link system module (windows aka driver, linux aka kernel module)
394 # @param $(target) Normalized main target name.
395 # @param $(out) System module name.
396 # @param $(objs) Object files to link together.
397 # @param $(libs) Libraries to search.
398 # @param $(libpath) Library search paths.
399 # @param $(flags) Flags.
400 # @param $(dirdep) Directory creation dependency.
401 # @param $(deps) Other dependencies.
402 # @param $(othersrc) Unhandled sources.
403 # @param $(custom_pre) Custom step invoked before linking.
404 # @param $(custom_post) Custom step invoked after linking.
406 # @param $(outbase) Output basename (full). Use this for list files and such.
407 TOOL_VCC120_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
408 TOOL_VCC120_LINK_SYSMOD_DEPORD =
409 TOOL_VCC120_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
410 TOOL_VCC120_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
411 TOOL_VCC120_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
412 TOOL_VCC120_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
413 define TOOL_VCC120_LINK_SYSMOD_CMDS
414 $(QUIET)$(APPEND) -tn $(outbase).rsp \
415 $(foreach arg,\
416 $(subst /,\\,$(objs)) \
417 $(subst /,\\,$(libs)) \
418 ,\"$(arg)\")
419 $(QUIET)$(TOOL_VCC120_LD) $(flags) \
420 /OUT:$(out) \
421 /MAPINFO:EXPORTS /INCREMENTAL:NO \
422 /MAP:$(outbase).map \
423 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
424 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
425 $(foreach p,$(libpath), /LIBPATH:$(p)) \
426 @$(outbase).rsp
427 ifndef TOOL_VCC120_NO_AUTO_MANIFEST
428 $(QUIET)$(TEST) -f $(out).manifest -- \
429 $(TOOL_VCC120_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
430 endif
431 endef