source: trunk/kBuild/tools/VCC100AMD64.kmk@ 2535

Last change on this file since 2535 was 2524, checked in by bird, 14 years ago

tools\VCC*: Adopted to new debug info (pdb) installation.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 15.6 KB
Line 
1# $Id: VCC100AMD64.kmk 2524 2011-08-01 13:37:47Z bird $
2## @file
3# kBuild Tool Config - Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting AMD64.
4#
5
6#
7# Copyright (c) 2004-2010 knut st. osmundsen <bird-kBuild-spamx@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_VCC100AMD64 := Visual C++ 10.0 (aka Visual 2010 and MSC v16), targeting AMD64
35
36# Tool Specific Properties
37ifndef PATH_TOOL_VCC100AMD64
38 PATH_TOOL_VCC100AMD64 := $(wildcard $(PATH_DEVTOOLS)/win.x86/vcc/v10*)
39 ifeq ($(PATH_TOOL_VCC100AMD64),)
40 PATH_TOOL_VCC100AMD64 := $(PATH_TOOL_VCC100)
41 endif
42 ifeq ($(PATH_TOOL_VCC100AMD64),)
43 PATH_TOOL_VCC100AMD64 := $(PATH_TOOL_VCC100X86)
44 endif
45 ifeq ($(PATH_TOOL_VCC100AMD64),)
46 PATH_TOOL_VCC100AMD64 := $(wildcard $(PATH_DEVTOOLS)/win.x86/vcc/v10*)
47 endif
48 ifneq ($(PATH_TOOL_VCC100AMD64),)
49 PATH_TOOL_VCC100AMD64 := $(lastword $(sort $(PATH_TOOL_VCC100AMD64)))
50 else
51 $(warning kBuild: PATH_TOOL_VCC100AMD64 cannot be determined!)
52 PATH_TOOL_VCC100AMD64 := $(PATH_DEVTOOLS)/win.x86/vcc/v10
53 endif
54else
55 # Resolve any fancy stuff once and for all.
56 PATH_TOOL_VCC100AMD64 := $(PATH_TOOL_VCC100AMD64)
57endif
58ifeq ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
59PATH_TOOL_VCC100AMD64_BIN ?= $(PATH_TOOL_VCC100AMD64)/bin/amd64
60else
61PATH_TOOL_VCC100AMD64_BIN ?= $(PATH_TOOL_VCC100AMD64)/bin/x86_amd64
62endif
63PATH_TOOL_VCC100AMD64_LIB ?= $(PATH_TOOL_VCC100AMD64)/lib/amd64
64PATH_TOOL_VCC100AMD64_INC ?= $(PATH_TOOL_VCC100AMD64)/include
65PATH_TOOL_VCC100AMD64_ATLMFC ?= $(PATH_TOOL_VCC100AMD64)/atlmfc
66PATH_TOOL_VCC100AMD64_ATLMFC_INC ?= $(PATH_TOOL_VCC100AMD64_ATLMFC)/include
67PATH_TOOL_VCC100AMD64_ATLMFC_LIB ?= $(PATH_TOOL_VCC100AMD64_ATLMFC)/lib/amd64
68TOOL_VCC100AMD64_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/cl.exe
69TOOL_VCC100AMD64_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/cl.exe
70TOOL_VCC100AMD64_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/ml64.exe
71TOOL_VCC100AMD64_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/../rc.exe
72TOOL_VCC100AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/lib.exe
73TOOL_VCC100AMD64_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/link.exe
74TOOL_VCC100AMD64_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC100AMD64_BIN)/../mt.exe
75## Disabled fast DEP_IDB based dependencies.
76#VCC100AMD64_OLD_DEPS = 1
77
78## Constructs the correct .pdb name (the name is lowercased).
79# @param $(1) Base name, no extention.
80# @param $(2) The extension.
81TOOL_VCC100AMD64_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
82
83TOOL_VCC100AMD64_COBJSUFF ?= .obj
84TOOL_VCC100AMD64_CFLAGS ?= -TC -c -nologo
85TOOL_VCC100AMD64_CFLAGS.debug ?= -Od -Zi
86TOOL_VCC100AMD64_CFLAGS.release ?= -O2
87TOOL_VCC100AMD64_CFLAGS.profile ?= -O2
88TOOL_VCC100AMD64_CINCS ?= $(PATH_TOOL_VCC100AMD64_INC)
89TOOL_VCC100AMD64_CDEFS ?=
90
91TOOL_VCC100AMD64_CXXOBJSUFF ?= .obj
92TOOL_VCC100AMD64_CXXFLAGS ?= -TP -c -nologo
93TOOL_VCC100AMD64_CXXFLAGS.debug ?= -Od -Zi
94TOOL_VCC100AMD64_CXXFLAGS.release ?= -O2
95TOOL_VCC100AMD64_CXXFLAGS.profile ?= -O2
96TOOL_VCC100AMD64_CXXINCS ?= $(PATH_TOOL_VCC100AMD64_INC) $(PATH_TOOL_VCC100AMD64_ATLMFC_INC)
97TOOL_VCC100AMD64_CXXDEFS ?=
98
99TOOL_VCC100AMD64_ASOBJSUFF ?= .obj
100
101TOOL_VCC100AMD64_RCOBJSUFF ?= .res
102TOOL_VCC100AMD64_RCINCS ?= $(PATH_TOOL_VCC100AMD64_INC) $(PATH_TOOL_VCC100AMD64_ATLMFC_INC)
103
104TOOL_VCC100AMD64_ARFLAGS ?= -nologo -machine:amd64
105TOOL_VCC100AMD64_ARLIBSUFF ?= .lib
106
107TOOL_VCC100AMD64_LDFLAGS ?= -nologo -machine:amd64
108TOOL_VCC100AMD64_LDFLAGS.debug ?= -debug
109TOOL_VCC100AMD64_LDFLAGS.release ?=
110
111
112
113## Compile C source.
114# @param $(target) Normalized main target name.
115# @param $(source) Source filename (relative).
116# @param $(obj) Object file name. This shall be (re)created by the compilation.
117# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
118# @param $(flags) Flags.
119# @param $(defs) Definitions. No -D or something.
120# @param $(incs) Includes. No -I or something.
121# @param $(dirdep) Directory creation dependency.
122# @param $(deps) Other dependencies.
123#
124# @param $(outbase) Output basename (full). Use this for list files and such.
125# @param $(objsuff) Object suffix.
126TOOL_VCC100AMD64_COMPILE_C_DEPEND =
127TOOL_VCC100AMD64_COMPILE_C_DEPORD =
128TOOL_VCC100AMD64_COMPILE_C_OUTPUT = $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,idb)
129TOOL_VCC100AMD64_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,pdb)
130define TOOL_VCC100AMD64_COMPILE_C_CMDS
131 $(QUIET)$(TOOL_VCC100AMD64_CC) -c\
132 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
133 -Fd$(outbase)-obj.pdb \
134 -FD\
135 -Fo$(obj)\
136 $(subst /,\\,$(abspath $(source)))
137 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC100AMD64_PDB,$(outbase)-obj,idb)
138endef
139
140
141## Compile C++ source.
142# @param $(target) Normalized main target name.
143# @param $(source) Source filename (relative).
144# @param $(obj) Object file name. This shall be (re)created by the compilation.
145# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
146# @param $(flags) Flags.
147# @param $(defs) Definitions. No -D or something.
148# @param $(incs) Includes. No -I or something.
149# @param $(dirdep) Directory creation dependency.
150# @param $(deps) Other dependencies.
151#
152# @param $(outbase) Output basename (full). Use this for list files and such.
153# @param $(objsuff) Object suffix.
154TOOL_VCC100AMD64_COMPILE_CXX_DEPEND =
155TOOL_VCC100AMD64_COMPILE_CXX_DEPORD =
156ifdef KBUILD_USE_KOBJCACHE
157TOOL_VCC100AMD64_COMPILE_CXX_USES_KOBJCACHE = 1
158TOOL_VCC100AMD64_COMPILE_CXX_OUTPUT = $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,idb) $(outbase).ii
159TOOL_VCC100AMD64_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,pdb)
160if 1
161define TOOL_VCC100AMD64_COMPILE_CXX_CMDS
162 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -r\
163 --named-pipe-compile $(subst /,\\,//./pipe/kObjCache/$(translate $(outbase),:,_)/$(notdir $(source)))\
164 --kObjCache-cpp $(outbase).ii\
165 $(TOOL_VCC100AMD64_CXX) -E\
166 $(flags)\
167 $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
168 $(subst /,\\,$(abspath $(source))) \
169 --kObjCache-cc $(obj)\
170 windbg $(TOOL_VCC100AMD64_CXX) -c -TP\
171 $(flags)\
172 -Fd$(outbase)-obj.pdb \
173 -FD\
174 -Fo$(obj)\
175 $(subst /,\\,//./pipe/kObjCache/$(translate $(outbase),:,_)/$(notdir $(source)))
176 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC100AMD64_PDB,$(outbase)-obj,idb)
177endef
178else
179define TOOL_VCC100AMD64_COMPILE_CXX_CMDS
180 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -r\
181 --kObjCache-cpp $(outbase).ii\
182 $(TOOL_VCC100AMD64_CXX) -E\
183 $(flags)\
184 $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
185 $(subst /,\\,$(abspath $(source))) \
186 --kObjCache-cc $(obj)\
187 $(TOOL_VCC100AMD64_CXX) -c -TP\
188 $(flags)\
189 -Fd$(outbase)-obj.pdb \
190 -FD\
191 -Fo$(obj)\
192 $(outbase).ii
193 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC100AMD64_PDB,$(outbase)-obj,idb)
194endef
195endif
196else # !KBUILD_USE_KOBJCACHE
197TOOL_VCC100AMD64_COMPILE_CXX_OUTPUT = $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,idb)
198TOOL_VCC100AMD64_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC100AMD64_PDB, $(outbase)-obj,pdb)
199define TOOL_VCC100AMD64_COMPILE_CXX_CMDS
200 $(QUIET)$(TOOL_VCC100AMD64_CXX) -c\
201 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
202 -Fd$(outbase)-obj.pdb \
203 -FD\
204 -Fo$(obj)\
205 $(subst /,\\,$(abspath $(source)))
206 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC100AMD64_PDB,$(outbase)-obj,idb)
207endef
208endif # !KBUILD_USE_KOBJCACHE
209
210## Compile resource source.
211# @param $(target) Normalized main target name.
212# @param $(source) Source filename (relative).
213# @param $(obj) Object file name. This shall be (re)created by the compilation.
214# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
215# @param $(flags) Flags.
216# @param $(defs) Definitions. No -D or something.
217# @param $(incs) Includes. No -I or something.
218# @param $(dirdep) Directory creation dependency.
219# @param $(deps) Other dependencies.
220#
221# @param $(outbase) Output basename (full). Use this for list files and such.
222# @param $(objsuff) Object suffix.
223TOOL_VCC100AMD64_COMPILE_RC_DEPEND =
224TOOL_VCC100AMD64_COMPILE_RC_DEPORD =
225TOOL_VCC100AMD64_COMPILE_RC_OUTPUT =
226define TOOL_VCC100AMD64_COMPILE_RC_CMDS
227 $(QUIET)$(TOOL_VCC100AMD64_RC) \
228 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
229 /fo$(obj)\
230 $(subst /,\\,$(abspath $(source)))
231endef
232
233
234## Link library
235# @param $(target) Normalized main target name.
236# @param $(out) Library name.
237# @param $(objs) Object files to put in the library.
238# @param $(flags) Flags.
239# @param $(dirdep) Directory creation dependency.
240# @param $(deps) Other dependencies.
241# @param $(othersrc) Unhandled sources.
242# @param $(outbase) Output basename (full). Use this for list files and such.
243#
244TOOL_VCC100AMD64_LINK_LIBRARY_DEPEND = $(othersrc)
245TOOL_VCC100AMD64_LINK_LIBRARY_DEPORD =
246TOOL_VCC100AMD64_LINK_LIBRARY_OUTPUT = $(outbase).rsp
247TOOL_VCC100AMD64_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
248define TOOL_VCC100AMD64_LINK_LIBRARY_CMDS
249 $(QUIET)$(APPEND) -n $(outbase).rsp \
250 $(foreach arg,\
251 $(subst /,\\,$(objs) \
252 $(filter-out %.def,$(othersrc))) \
253 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
254 ,\"$(arg)\")
255 $(QUIET)$(TOOL_VCC100AMD64_AR) $(flags) /OUT:$(out) @$(outbase).rsp
256endef
257
258
259## Link program
260# @param $(target) Normalized main target name.
261# @param $(out) Program name.
262# @param $(objs) Object files to link together.
263# @param $(libs) Libraries to search.
264# @param $(libpath) Library search paths.
265# @param $(flags) Flags.
266# @param $(dirdep) Directory creation dependency.
267# @param $(deps) Other dependencies.
268# @param $(othersrc) Unhandled sources.
269# @param $(custom_pre) Custom step invoked before linking.
270# @param $(custom_post) Custom step invoked after linking.
271# @param $(outbase) Output basename (full). Use this for list files and such.
272#
273TOOL_VCC100AMD64_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
274TOOL_VCC100AMD64_LINK_PROGRAM_DEPORD =
275TOOL_VCC100AMD64_LINK_PROGRAM_OUTPUT = $(outbase).map
276TOOL_VCC100AMD64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
277TOOL_VCC100AMD64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
278TOOL_VCC100AMD64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
279define TOOL_VCC100AMD64_LINK_PROGRAM_CMDS
280 $(QUIET)$(TOOL_VCC100AMD64_LD) $(flags) \
281 /OUT:$(out) \
282 /MAPINFO:EXPORTS /INCREMENTAL:NO \
283 /MAP:$(outbase).map \
284 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
285 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
286 $(foreach p,$(libpath), /LIBPATH:$(p)) \
287 $(subst /,\\,$(objs)) \
288 $(subst /,\\,$(libs))
289 $(QUIET)$(TEST) -f $(out).manifest -- \
290 $(TOOL_VCC100AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
291endef
292
293
294## Link DLL.
295# @param $(target) Normalized main target name.
296# @param $(out) DLL name.
297# @param $(objs) Object files to link together.
298# @param $(libs) Libraries to search.
299# @param $(libpath) Library search paths.
300# @param $(flags) Flags.
301# @param $(dirdep) Directory creation dependency.
302# @param $(deps) Other dependencies.
303# @param $(othersrc) Unhandled sources.
304# @param $(custom_pre) Custom step invoked before linking.
305# @param $(custom_post) Custom step invoked after linking.
306#
307# @param $(outbase) Output basename (full). Use this for list files and such.
308TOOL_VCC100AMD64_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
309TOOL_VCC100AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
310TOOL_VCC100AMD64_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp
311TOOL_VCC100AMD64_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
312TOOL_VCC100AMD64_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
313TOOL_VCC100AMD64_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
314define TOOL_VCC100AMD64_LINK_DLL_CMDS
315 $(QUIET)$(TOOL_VCC100AMD64_LD) $(flags) \
316 /OUT:$(out) \
317 /IMPLIB:$(outbase).lib \
318 /MAPINFO:EXPORTS /INCREMENTAL:NO \
319 /MAP:$(outbase).map \
320 /DLL \
321 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
322 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
323 $(foreach p,$(libpath), /LIBPATH:$(p)) \
324 $(subst /,\\,$(objs)) \
325 $(subst /,\\,$(libs))
326 $(QUIET)$(TEST) -f $(out).manifest -- \
327 $(TOOL_VCC100AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
328 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
329$(eval _DIRS += $(PATH_STAGE_LIB))
330endef
331
332
333## Link system module (windows aka driver, linux aka kernel module)
334# @param $(target) Normalized main target name.
335# @param $(out) System module name.
336# @param $(objs) Object files to link together.
337# @param $(libs) Libraries to search.
338# @param $(libpath) Library search paths.
339# @param $(flags) Flags.
340# @param $(dirdep) Directory creation dependency.
341# @param $(deps) Other dependencies.
342# @param $(othersrc) Unhandled sources.
343# @param $(custom_pre) Custom step invoked before linking.
344# @param $(custom_post) Custom step invoked after linking.
345#
346# @param $(outbase) Output basename (full). Use this for list files and such.
347TOOL_VCC100AMD64_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
348TOOL_VCC100AMD64_LINK_SYSMOD_DEPORD =
349TOOL_VCC100AMD64_LINK_SYSMOD_OUTPUT = $(outbase).map
350TOOL_VCC100AMD64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
351TOOL_VCC100AMD64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
352TOOL_VCC100AMD64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
353define TOOL_VCC100AMD64_LINK_SYSMOD_CMDS
354 $(QUIET)$(TOOL_VCC100AMD64_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 $(foreach p,$(libpath), /LIBPATH:$(p)) \
361 $(subst /,\\,$(objs)) \
362 $(subst /,\\,$(libs))
363 $(QUIET)$(TEST) -f $(out).manifest -- \
364 $(TOOL_VCC100AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
365endef
366
Note: See TracBrowser for help on using the repository browser.