source: trunk/kBuild/tools/VCC120X86.kmk@ 3037

Last change on this file since 3037 was 3037, checked in by bird, 8 years ago

tools/VCC120*.kmk: Express edition adjustments.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 20.4 KB
Line 
1# $Id: VCC120X86.kmk 3037 2017-05-10 09:24:06Z bird $
2## @file
3# kBuild Tool Config - Visual C++ 12.0 (aka Visual 2013 and MSC v18), targeting x86.
4#
5
6#
7# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xiv@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
34TOOL_VCC120X86 := Visual C++ 12.0 (aka Visual 2013 and MSC v18), targeting x86.
35
36# Tool Specific Properties
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)
41 endif
42 ifeq ($(PATH_TOOL_VCC120X86),)
43 PATH_TOOL_VCC120X86 := $(PATH_TOOL_VCC120AMD64)
44 endif
45 ifeq ($(PATH_TOOL_VCC120X86),)
46 PATH_TOOL_VCC120X86 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/vcc/v12*)
47 endif
48 ifeq ($(PATH_TOOL_VCC120X86),)
49 PATH_TOOL_VCC120X86 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/vcc/v12*)
50 endif
51 ifneq ($(PATH_TOOL_VCC120X86),)
52 PATH_TOOL_VCC120X86 := $(lastword $(sort $(PATH_TOOL_VCC120X86)))
53 else
54 $(warning kBuild: PATH_TOOL_VCC120X86 cannot be determined!)
55 PATH_TOOL_VCC120X86 := $(KBUILD_DEVTOOLS)/x86.win/vcc/v12
56 endif
57else
58 # Resolve any fancy stuff once and for all.
59 PATH_TOOL_VCC120X86 := $(PATH_TOOL_VCC120X86)
60endif
61
62if "$(KBUILD_HOST).$(KBUILD_HOST_ARCH)" == "win.amd64" && exists("$(PATH_TOOL_VCC120AMD64)/bin/amd64_x86") # Missing in express edition.
63 PATH_TOOL_VCC120X86_BIN_DLL ?= $(PATH_TOOL_VCC120AMD64)/bin/amd64
64 PATH_TOOL_VCC120X86_BIN ?= $(PATH_TOOL_VCC120AMD64)/bin/amd64_x86
65else
66PATH_TOOL_VCC120X86_BIN_DLL ?=
67 PATH_TOOL_VCC120X86_BIN ?= $(PATH_TOOL_VCC120AMD64)/bin
68endif
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
86 ifeq ($(KBUILD_HOST),win)
87 TOOL_VCC120X86_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
88 TOOL_VCC120X86_KSUBMIT_DD = $(TOOL_VCC120X86_KSUBMIT) --
89 endif
90else ifdef PATH_TOOL_VCC120X86_BIN_DLL
91 TOOL_VCC120X86_KSUBMIT_DD = $(REDIRECT) -E 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)$(PATH)' --
92endif
93
94# The following in duplicated in VCC120.kmk and VCC120X86.kmk.
95TOOL_VCC120_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(firstword \
96 $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(wildcard $(PATH_SDK_WINPSDK71_BIN)/$2)) \
97 $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(wildcard $(PATH_SDK_WINPSDK_BIN)/$2)) \
98 $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
99 $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
100 $1))
101TOOL_VCC120_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC120_FN_FIND_SDK_TOOL_SUB),)$($3)
102
103## Disabled fast DEP_IDB based dependencies.
104#VCC120X86_OLD_DEPS = 1
105
106## Constructs the correct .pdb name (the name is lowercased).
107# @param $(1) Base name, no extention.
108# @param $(2) The extension.
109TOOL_VCC120X86_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
110
111
112# General Properties used by kBuild
113TOOL_VCC120X86_COBJSUFF ?= .obj
114TOOL_VCC120X86_CFLAGS ?= -TC -nologo -Zi
115TOOL_VCC120X86_CFLAGS.debug ?=
116TOOL_VCC120X86_CFLAGS.dbgopt ?= -O2
117TOOL_VCC120X86_CFLAGS.release ?= -O2
118TOOL_VCC120X86_CFLAGS.profile ?= -O2
119TOOL_VCC120X86_CINCS ?= $(PATH_TOOL_VCC120X86_INC)
120TOOL_VCC120X86_CDEFS ?=
121
122TOOL_VCC120X86_CXXOBJSUFF ?= .obj
123TOOL_VCC120X86_CXXFLAGS ?= -TP -nologo -Zi
124TOOL_VCC120X86_CXXFLAGS.debug ?=
125TOOL_VCC120X86_CXXFLAGS.dbgopt ?= -O2
126TOOL_VCC120X86_CXXFLAGS.release ?= -O2
127TOOL_VCC120X86_CXXFLAGS.profile ?= -O2
128TOOL_VCC120X86_CXXINCS ?= $(PATH_TOOL_VCC120X86_INC) $(PATH_TOOL_VCC120X86_ATLMFC_INC)
129TOOL_VCC120X86_CXXDEFS ?=
130
131TOOL_VCC120X86_ASOBJSUFF ?= .obj
132
133TOOL_VCC120X86_RCOBJSUFF ?= .res
134TOOL_VCC120X86_RCINCS ?= $(PATH_TOOL_VCC120X86_INC) $(PATH_TOOL_VCC120X86_ATLMFC_INC)
135
136TOOL_VCC120X86_ARFLAGS ?= -nologo
137TOOL_VCC120X86_ARLIBSUFF ?= .lib
138
139TOOL_VCC120X86_LDFLAGS ?= -nologo -machine:x86
140TOOL_VCC120X86_LDFLAGS.debug ?= -debug
141TOOL_VCC120X86_LDFLAGS.dbgopt ?= -debug
142TOOL_VCC120X86_LDFLAGS.profile ?= -debug
143TOOL_VCC120X86_LDFLAGS.release ?=
144
145
146
147## Compile C source.
148# @param $(target) Normalized main target name.
149# @param $(source) Source filename (relative).
150# @param $(obj) Object file name. This shall be (re)created by the compilation.
151# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
152# @param $(flags) Flags.
153# @param $(defs) Definitions. No -D or something.
154# @param $(incs) Includes. No -I or something.
155# @param $(dirdep) Directory creation dependency.
156# @param $(deps) Other dependencies.
157#
158# @param $(outbase) Output basename (full). Use this for list files and such.
159# @param $(objsuff) Object suffix.
160TOOL_VCC120X86_COMPILE_C_DEPEND =
161TOOL_VCC120X86_COMPILE_C_DEPORD =
162TOOL_VCC120X86_COMPILE_C_OUTPUT =
163TOOL_VCC120X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC120X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC120X86_PDB, $(outbase)-obj,idb)
164ifdef TOOL_VCC120X86_KSUBMIT
165 TOOL_VCC120X86_COMPILE_C_DONT_PURGE_OUTPUT = 1 # speed
166 define TOOL_VCC120X86_COMPILE_C_CMDS
167 $(QUIET)$(TOOL_VCC120X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
168 $(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL),-E 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)$(PATH)',)\
169 -- $(TOOL_VCC120X86_CC) -c\
170 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
171 -Fd$(outbase)-obj.pdb \
172 -Fo$(obj)\
173 $(subst /,\\,$(abspath $(source)))
174 endef
175else
176 define TOOL_VCC120X86_COMPILE_C_CMDS
177 $(QUIET)$(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL)\
178 ,$(REDIRECT) -E 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)$(PATH)' -- ,)$(TOOL_VCC120X86_CC) -c\
179 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
180 -Fd$(outbase)-obj.pdb \
181 -Fo$(obj)\
182 $(subst /,\\,$(abspath $(source)))
183 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
184 endef
185endif # !TOOL_VCC120X86_KSUBMIT
186
187
188## Compile C++ source.
189# @param $(target) Normalized main target name.
190# @param $(source) Source filename (relative).
191# @param $(obj) Object file name. This shall be (re)created by the compilation.
192# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
193# @param $(flags) Flags.
194# @param $(defs) Definitions. No -D or something.
195# @param $(incs) Includes. No -I or something.
196# @param $(dirdep) Directory creation dependency.
197# @param $(deps) Other dependencies.
198#
199# @param $(outbase) Output basename (full). Use this for list files and such.
200# @param $(objsuff) Object suffix.
201TOOL_VCC120X86_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
202TOOL_VCC120X86_COMPILE_CXX_DEPORD =
203TOOL_VCC120X86_COMPILE_CXX_OUTPUT =
204TOOL_VCC120X86_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
205 ,,$(call TOOL_VCC120X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC120X86_PDB, $(outbase)-obj,idb))
206ifdef TOOL_VCC120X86_KSUBMIT
207 TOOL_VCC120X86_COMPILE_CXX_DONT_PURGE_OUTPUT = 1 # speed
208 define TOOL_VCC120X86_COMPILE_CXX_CMDS
209 $(QUIET)$(TOOL_VCC120X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
210 $(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL),-E 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)$(PATH)',)\
211 -- $(TOOL_VCC120X86_CXX) -c\
212 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
213 $(if-expr defined($(target)_PCH_HDR)\
214 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
215 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
216 -Fo$(obj)\
217 $(subst /,\\,$(abspath $(source)))
218 endef
219else
220 define TOOL_VCC120X86_COMPILE_CXX_CMDS
221 $(QUIET)$(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL)\
222 ,$(REDIRECT) -E 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)$(PATH)' -- ,)$(TOOL_VCC120X86_CXX) -c\
223 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
224 $(if-expr defined($(target)_PCH_HDR)\
225 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
226 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
227 -Fo$(obj)\
228 $(subst /,\\,$(abspath $(source)))
229 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
230 endef
231endif # !TOOL_VCC120X86_KSUBMIT
232
233
234#
235# Helper tool for creating the precompiled C++ header.
236#
237# It only have the C++ compile bits and it's purpose is to skip bits
238# related _1_VCC_PCH_FILE and add -Yc.
239#
240TOOL_VCC120X86-PCH := Helper for creating precompiled header using CXX handling.
241TOOL_VCC120X86-PCH_EXTENDS := VCC120X86
242TOOL_VCC120X86-PCH_CXXOBJSUFF := .obj
243TOOL_VCC120X86-PCH_CXXINCS = $(TOOL_VCC120X86_CXXINCS)
244TOOL_VCC120X86-PCH_CXXFLAGS = $(TOOL_VCC120X86_CXXFLAGS) -FS
245TOOL_VCC120X86-PCH_CXXFLAGS.debug = $(TOOL_VCC120X86_CXXFLAGS.debug)
246TOOL_VCC120X86-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC120X86_CXXFLAGS.dbgopt)
247TOOL_VCC120X86-PCH_CXXFLAGS.release = $(TOOL_VCC120X86_CXXFLAGS.release)
248TOOL_VCC120X86-PCH_CXXFLAGS.profile = $(TOOL_VCC120X86_CXXFLAGS.profile)
249TOOL_VCC120X86-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
250TOOL_VCC120X86-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
251TOOL_VCC120X86-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
252TOOL_VCC120X86-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
253ifdef TOOL_VCC120X86_KSUBMIT
254 define TOOL_VCC120X86-PCH_COMPILE_CXX_CMDS
255 $(QUIET)$(TOOL_VCC120X86_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
256 $(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL),-E 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)$(PATH)',)\
257 -- $(TOOL_VCC120X86_CXX) -c -Yc\
258 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
259 -Fp$($(target)_1_VCC_PCH_FILE) \
260 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
261 -Fo$(obj)\
262 -TP \
263 $(subst /,\\,$(abspath $(source)))
264 endef
265else
266 define TOOL_VCC120X86-PCH_COMPILE_CXX_CMDS
267 $(QUIET)$(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL)\
268 ,$(REDIRECT) -E 'PATH=$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)$(PATH)' -- ,)$(TOOL_VCC120X86_CXX) -c -Yc\
269 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
270 -Fp$($(target)_1_VCC_PCH_FILE) \
271 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
272 -Fo$(obj)\
273 -TP \
274 $(subst /,\\,$(abspath $(source)))
275 $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
276
277 endef
278endif # !TOOL_VCC120X86_KSUBMIT
279
280
281## @todo configure the assembler template.
282
283## Compile resource source.
284# @param $(target) Normalized main target name.
285# @param $(source) Source filename (relative).
286# @param $(obj) Object file name. This shall be (re)created by the compilation.
287# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
288# @param $(flags) Flags.
289# @param $(defs) Definitions. No -D or something.
290# @param $(incs) Includes. No -I or something.
291# @param $(dirdep) Directory creation dependency.
292# @param $(deps) Other dependencies.
293#
294# @param $(outbase) Output basename (full). Use this for list files and such.
295# @param $(objsuff) Object suffix.
296TOOL_VCC120X86_COMPILE_RC_DEPEND =
297TOOL_VCC120X86_COMPILE_RC_DEPORD =
298TOOL_VCC120X86_COMPILE_RC_OUTPUT =
299## @todo Fix kmk_redirect so we can use it for setting PATH without spawning a shell or two
300define TOOL_VCC120X86_COMPILE_RC_CMDS
301 $(QUIET)$(if-expr defined(PATH_TOOL_VCC120X86_BIN_DLL)\
302 ,PATH='$(PATH_TOOL_VCC120X86_BIN_DLL)$(HOST_PATH_SEP)$(PATH)') $(TOOL_VCC120X86_RC) \
303 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /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_VCC120X86_LINK_LIBRARY_DEPEND = $(othersrc)
320TOOL_VCC120X86_LINK_LIBRARY_DEPORD =
321TOOL_VCC120X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
322TOOL_VCC120X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
323define TOOL_VCC120X86_LINK_LIBRARY_CMDS
324 $(QUIET)$(APPEND) -tn $(outbase).rsp \
325 $(foreach arg,\
326 $(subst /,\\,$(objs) \
327 $(filter-out %.def,$(othersrc))) \
328 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
329 ,\"$(arg)\")
330 $(QUIET)$(TOOL_VCC120X86_KSUBMIT_DD) $(TOOL_VCC120X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
331endef
332
333
334## Link program
335# @param $(target) Normalized main target name.
336# @param $(out) Program name.
337# @param $(objs) Object files to link together.
338# @param $(libs) Libraries to search.
339# @param $(libpath) Library search paths.
340# @param $(flags) Flags.
341# @param $(dirdep) Directory creation dependency.
342# @param $(deps) Other dependencies.
343# @param $(othersrc) Unhandled sources.
344# @param $(custom_pre) Custom step invoked before linking.
345# @param $(custom_post) Custom step invoked after linking.
346# @param $(outbase) Output basename (full). Use this for list files and such.
347#
348TOOL_VCC120X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
349TOOL_VCC120X86_LINK_PROGRAM_DEPORD =
350TOOL_VCC120X86_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).rsp
351TOOL_VCC120X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
352TOOL_VCC120X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
353TOOL_VCC120X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
354define TOOL_VCC120X86_LINK_PROGRAM_CMDS
355 $(QUIET)$(APPEND) -tn $(outbase).rsp \
356 $(foreach arg,\
357 $(subst /,\\,$(objs)) \
358 $(subst /,\\,$(libs)) \
359 ,\"$(arg)\")
360 $(QUIET)$(TOOL_VCC120X86_KSUBMIT_DD) $(TOOL_VCC120X86_LD) $(flags) \
361 /OUT:$(out) \
362 /MAPINFO:EXPORTS /INCREMENTAL:NO \
363 /MAP:$(outbase).map \
364 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
365 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
366 $(foreach p,$(libpath), /LIBPATH:$(p)) \
367 @$(outbase).rsp
368ifndef TOOL_VCC120X86_NO_AUTO_MANIFEST
369 $(QUIET)$(TEST) -f $(out).manifest -- \
370 $(TOOL_VCC120X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
371endif
372endef
373
374
375## Link DLL.
376# @param $(target) Normalized main target name.
377# @param $(out) DLL name.
378# @param $(objs) Object files to link together.
379# @param $(libs) Libraries to search.
380# @param $(libpath) Library search paths.
381# @param $(flags) Flags.
382# @param $(dirdep) Directory creation dependency.
383# @param $(deps) Other dependencies.
384# @param $(othersrc) Unhandled sources.
385# @param $(custom_pre) Custom step invoked before linking.
386# @param $(custom_post) Custom step invoked after linking.
387#
388# @param $(outbase) Output basename (full). Use this for list files and such.
389TOOL_VCC120X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
390TOOL_VCC120X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
391TOOL_VCC120X86_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).rsp
392TOOL_VCC120X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
393TOOL_VCC120X86_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib
394TOOL_VCC120X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
395TOOL_VCC120X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
396define TOOL_VCC120X86_LINK_DLL_CMDS
397 $(QUIET)$(APPEND) -tn $(outbase).rsp \
398 $(foreach arg,\
399 $(subst /,\\,$(objs)) \
400 $(subst /,\\,$(libs)) \
401 ,\"$(arg)\")
402 $(QUIET)$(TOOL_VCC120X86_KSUBMIT_DD) $(TOOL_VCC120X86_LD) $(flags) \
403 /OUT:$(out) \
404 /IMPLIB:$(outbase).lib \
405 /MAPINFO:EXPORTS /INCREMENTAL:NO \
406 /MAP:$(outbase).map \
407 /DLL \
408 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
409 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
410 $(foreach p,$(libpath), /LIBPATH:$(p)) \
411 @$(outbase).rsp
412ifndef TOOL_VCC120X86_NO_AUTO_MANIFEST
413 $(QUIET)$(TEST) -f $(out).manifest -- \
414 $(TOOL_VCC120X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
415endif
416 $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
417 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
418$(eval _DIRS += $(PATH_STAGE_LIB))
419endef
420
421
422## Link system module (windows aka driver, linux aka kernel module)
423# @param $(target) Normalized main target name.
424# @param $(out) System module name.
425# @param $(objs) Object files to link together.
426# @param $(libs) Libraries to search.
427# @param $(libpath) Library search paths.
428# @param $(flags) Flags.
429# @param $(dirdep) Directory creation dependency.
430# @param $(deps) Other dependencies.
431# @param $(othersrc) Unhandled sources.
432# @param $(custom_pre) Custom step invoked before linking.
433# @param $(custom_post) Custom step invoked after linking.
434#
435# @param $(outbase) Output basename (full). Use this for list files and such.
436TOOL_VCC120X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
437TOOL_VCC120X86_LINK_SYSMOD_DEPORD =
438TOOL_VCC120X86_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).rsp
439TOOL_VCC120X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
440TOOL_VCC120X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
441TOOL_VCC120X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
442define TOOL_VCC120X86_LINK_SYSMOD_CMDS
443 $(QUIET)$(APPEND) -tn $(outbase).rsp \
444 $(foreach arg,\
445 $(subst /,\\,$(objs)) \
446 $(subst /,\\,$(libs)) \
447 ,\"$(arg)\")
448 $(QUIET)$(TOOL_VCC120X86_KSUBMIT_DD) $(TOOL_VCC120X86_LD) $(flags) \
449 /OUT:$(out) \
450 /MAPINFO:EXPORTS /INCREMENTAL:NO \
451 /MAP:$(outbase).map \
452 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
453 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
454 $(foreach p,$(libpath), /LIBPATH:$(p)) \
455 @$(outbase).rsp
456ifndef TOOL_VCC120X86_NO_AUTO_MANIFEST
457 $(QUIET)$(TEST) -f $(out).manifest -- \
458 $(TOOL_VCC120X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
459endif
460endef
461
Note: See TracBrowser for help on using the repository browser.