source: trunk/kBuild/tools/VCC80AMD64.kmk@ 689

Last change on this file since 689 was 669, checked in by bird, 19 years ago

bugfix.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 13.7 KB
Line 
1# $Id: VCC80AMD64.kmk 669 2006-12-06 04:08:56Z bird $
2## @file
3#
4# kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting AMD64.
5#
6# Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net>
7#
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
27TOOL_VCC80AMD64 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting AMD64.
28
29# Tool Specific Properties
30ifndef PATH_TOOL_VCC80AMD64
31 PATH_TOOL_VCC80AMD64 := $(wildcard $(PATH_DEVTOOLS)/amd64.win/vcc/v8)
32 ifeq ($(PATH_TOOL_VCC80AMD64),)
33 PATH_TOOL_VCC80AMD64 := $(wildcard $(PATH_DEVTOOLS)/x86.win/vcc/v8)
34 endif
35 ifeq ($(PATH_TOOL_VCC80AMD64),)
36 PATH_TOOL_VCC80AMD64 := $(wildcard $(PATH_DEVTOOLS)/x86.win32/vcc/v8)
37 endif
38 ifneq ($(PATH_TOOL_VCC80AMD64),)
39 # done for now
40 else
41 $(warning kBuild: PATH_TOOL_VCC80AMD64 cannot be determined!)
42 PATH_TOOL_VCC80AMD64 := $(PATH_DEVTOOLS)/x86.win/vcc/v8
43 endif
44else
45 # Resolve any fancy stuff once and for all.
46 PATH_TOOL_VCC80AMD64 := $(PATH_TOOL_VCC80AMD64)
47endif
48ifeq ($(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH),win.amd64)
49PATH_TOOL_VCC80AMD64_BIN ?= $(PATH_TOOL_VCC80AMD64)/bin/amd64
50else
51PATH_TOOL_VCC80AMD64_BIN ?= $(PATH_TOOL_VCC80AMD64)/bin/x86_amd64
52endif
53PATH_TOOL_VCC80AMD64_LIB ?= $(PATH_TOOL_VCC80AMD64)/lib/amd64
54PATH_TOOL_VCC80AMD64_INC ?= $(PATH_TOOL_VCC80AMD64)/include
55PATH_TOOL_VCC80AMD64_ATLMFC ?= $(PATH_TOOL_VCC80X86)/atlmfc
56PATH_TOOL_VCC80AMD64_ATLMFC_INC ?= $(PATH_TOOL_VCC80AMD64_ATLMFC)/include
57PATH_TOOL_VCC80AMD64_ATLMFC_LIB ?= $(PATH_TOOL_VCC80AMD64_ATLMFC)/lib/amd64
58TOOL_VCC80AMD64_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/cl.exe
59TOOL_VCC80AMD64_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/cl.exe
60TOOL_VCC80AMD64_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/ml64.exe
61TOOL_VCC80AMD64_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/../rc.exe
62TOOL_VCC80AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/lib.exe
63TOOL_VCC80AMD64_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/link.exe
64TOOL_VCC80AMD64_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/../mt.exe
65VCC80AMD64_NEW_DEPS = 1 ##< Enables fast DEP_IDB based dependencies.
66
67## Constructs the correct .pdb name (the name is lowercased).
68# @param $(1) Base name, no extention.
69# @param $(2) The extension.
70ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
71TOOL_VCC80AMD64_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
72else # this fallback is incorrect and won't work on a case sensitive FS.
73TOOL_VCC80AMD64_PDB = $(1).$(2)
74endif
75
76TOOL_VCC80AMD64_COBJSUFF ?= .obj
77TOOL_VCC80AMD64_CFLAGS ?= -TC -c -nologo
78TOOL_VCC80AMD64_CFLAGS.debug ?= -Od -Zi
79TOOL_VCC80AMD64_CFLAGS.release ?= -O2
80TOOL_VCC80AMD64_CFLAGS.profile ?= -O2
81TOOL_VCC80AMD64_CINCS ?= $(PATH_TOOL_VCC80AMD64_INC)
82TOOL_VCC80AMD64_CDEFS ?=
83
84TOOL_VCC80AMD64_CXXOBJSUFF ?= .obj
85TOOL_VCC80AMD64_CXXFLAGS ?= -TP -c -nologo
86TOOL_VCC80AMD64_CXXFLAGS.debug ?= -Od -Zi
87TOOL_VCC80AMD64_CXXFLAGS.release ?= -O2
88TOOL_VCC80AMD64_CXXFLAGS.profile ?= -O2
89TOOL_VCC80AMD64_CXXINCS ?= $(PATH_TOOL_VCC80AMD64_INC) $(PATH_TOOL_VCC80AMD64_ATLMFC_INC)
90TOOL_VCC80AMD64_CXXDEFS ?=
91
92TOOL_VCC80AMD64_ASOBJSUFF ?= .obj
93
94TOOL_VCC80AMD64_RCOBJSUFF ?= .res
95TOOL_VCC80AMD64_RCINCS ?= $(PATH_TOOL_VCC80AMD64_INC) $(PATH_TOOL_VCC80AMD64_ATLMFC_INC)
96
97TOOL_VCC80AMD64_ARFLAGS ?= -nologo -machine:amd64
98TOOL_VCC80AMD64_ARLIBSUFF ?= .lib
99
100TOOL_VCC80AMD64_LDFLAGS ?= -nologo -machine:amd64
101TOOL_VCC80AMD64_LDFLAGS.debug ?= -debug
102TOOL_VCC80AMD64_LDFLAGS.release ?=
103
104
105
106## Compile C source.
107# @param $(target) Normalized main target name.
108# @param $(source) Source filename (relative).
109# @param $(obj) Object file name. This shall be (re)created by the compilation.
110# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
111# @param $(flags) Flags.
112# @param $(defs) Definitions. No -D or something.
113# @param $(incs) Includes. No -I or something.
114# @param $(dirdep) Directory creation dependency.
115# @param $(deps) Other dependencies.
116#
117# @param $(outbase) Output basename (full). Use this for list files and such.
118# @param $(objsuff) Object suffix.
119TOOL_VCC80AMD64_COMPILE_C_OUTPUT = $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,idb)
120TOOL_VCC80AMD64_COMPILE_C_DEPEND =
121TOOL_VCC80AMD64_COMPILE_C_DEPORD =
122ifdef VCC80AMD64_NEW_DEPS
123define TOOL_VCC80AMD64_COMPILE_C_CMDS
124 $(TOOL_VCC80AMD64_CC) -c\
125 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
126 -Fd$(outbase)-obj.pdb \
127 -FD\
128 -Fo$(obj)\
129 $(subst /,\\,$(call ABSPATH,$(source)))
130 $(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80AMD64_PDB,$(outbase)-obj,idb)
131endef
132else
133define TOOL_VCC80AMD64_COMPILE_C_CMDS
134 $(TOOL_VCC80AMD64_CC) -c\
135 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
136 -Fd$(outbase)-obj.pdb \
137 -Fo$(obj)\
138 $(subst /,\\,$(call ABSPATH,$(source)))
139 $(TOOL_VCC80AMD64_CC) -E\
140 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
141 $(subst /,\\,$(call ABSPATH,$(source)))\
142 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
143endef
144endif
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_VCC80AMD64_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,idb)
161TOOL_VCC80AMD64_COMPILE_CXX_DEPEND =
162TOOL_VCC80AMD64_COMPILE_CXX_DEPORD =
163ifdef VCC80AMD64_NEW_DEPS
164define TOOL_VCC80AMD64_COMPILE_CXX_CMDS
165 $(TOOL_VCC80AMD64_CXX) -c\
166 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
167 -Fd$(outbase)-obj.pdb \
168 -FD\
169 -Fo$(obj)\
170 $(subst /,\\,$(call ABSPATH,$(source)))
171 $(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80AMD64_PDB,$(outbase)-obj,idb)
172endef
173else
174define TOOL_VCC80AMD64_COMPILE_CXX_CMDS
175 $(TOOL_VCC80AMD64_CXX) -c\
176 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
177 -Fd$(outbase)-obj.pdb \
178 -Fo$(obj)\
179 $(subst /,\\,$(call ABSPATH,$(source)))
180 $(TOOL_VCC80AMD64_CXX) -E\
181 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
182 $(subst /,\\,$(call ABSPATH,$(source)))\
183 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
184endef
185endif
186
187
188## Compile resource 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_VCC80AMD64_COMPILE_RC_OUTPUT =
202TOOL_VCC80AMD64_COMPILE_RC_DEPEND =
203TOOL_VCC80AMD64_COMPILE_RC_DEPORD =
204define TOOL_VCC80AMD64_COMPILE_RC_CMDS
205 $(TOOL_VCC80AMD64_RC) \
206 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
207 /fo$(obj)\
208 $(subst /,\\,$(call ABSPATH,$(source)))
209endef
210
211
212## Link library
213# @param $(target) Normalized main target name.
214# @param $(out) Library name.
215# @param $(objs) Object files to put in the library.
216# @param $(flags) Flags.
217# @param $(dirdep) Directory creation dependency.
218# @param $(deps) Other dependencies.
219# @param $(othersrc) Unhandled sources.
220# @param $(outbase) Output basename (full). Use this for list files and such.
221#
222TOOL_VCC80AMD64_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb
223TOOL_VCC80AMD64_LINK_LIBRARY_DEPEND = $(othersrc)
224TOOL_VCC80AMD64_LINK_LIBRARY_DEPORD =
225define TOOL_VCC80AMD64_LINK_LIBRARY_CMDS
226 $(TOOL_VCC80AMD64_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
227 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
228endef
229
230
231## Link program
232# @param $(target) Normalized main target name.
233# @param $(out) Program name.
234# @param $(objs) Object files to link together.
235# @param $(libs) Libraries to search.
236# @param $(libpath) Library search paths.
237# @param $(flags) Flags.
238# @param $(dirdep) Directory creation dependency.
239# @param $(deps) Other dependencies.
240# @param $(othersrc) Unhandled sources.
241# @param $(custom_pre) Custom step invoked before linking.
242# @param $(custom_post) Custom step invoked after linking.
243# @param $(outbase) Output basename (full). Use this for list files and such.
244#
245TOOL_VCC80AMD64_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
246TOOL_VCC80AMD64_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
247TOOL_VCC80AMD64_LINK_PROGRAM_DEPORD =
248define TOOL_VCC80AMD64_LINK_PROGRAM_CMDS
249 $(TOOL_VCC80AMD64_LD) $(flags) \
250 /OUT:$(out) \
251 /MAPINFO:EXPORTS /INCREMENTAL:NO \
252 /MAP:$(outbase).map \
253 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
254 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
255 $(foreach p,$(libpath), /LIBPATH:$(p)) \
256 $(subst /,\\,$(objs)) \
257 $(subst /,\\,$(libs))
258 if test -f $(out).manifest; then \
259 $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)); \
260 fi
261endef
262
263
264## Link DLL.
265# @param $(target) Normalized main target name.
266# @param $(out) DLL name.
267# @param $(objs) Object files to link together.
268# @param $(libs) Libraries to search.
269# @param $(libpath) Library search paths.
270# @param $(flags) Flags.
271# @param $(dirdep) Directory creation dependency.
272# @param $(deps) Other dependencies.
273# @param $(othersrc) Unhandled sources.
274# @param $(custom_pre) Custom step invoked before linking.
275# @param $(custom_post) Custom step invoked after linking.
276#
277# @param $(outbase) Output basename (full). Use this for list files and such.
278TOOL_VCC80AMD64_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
279TOOL_VCC80AMD64_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
280TOOL_VCC80AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
281define TOOL_VCC80AMD64_LINK_DLL_CMDS
282 $(TOOL_VCC80AMD64_LD) $(flags) \
283 /OUT:$(out) \
284 /IMPLIB:$(outbase).lib \
285 /MAPINFO:EXPORTS /INCREMENTAL:NO \
286 /MAP:$(outbase).map \
287 /DLL \
288 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
289 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
290 $(foreach p,$(libpath), /LIBPATH:$(p)) \
291 $(subst /,\\,$(objs)) \
292 $(subst /,\\,$(libs))
293 if test -f $(out).manifest; then \
294 $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
295 fi
296ifeq ($(filter %.exp .def,$(othersrc)),)
297 if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
298 if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
299endif
300$(eval _DIRS += $(PATH_LIB))
301endef
302
303
304## Link system module (windows aka driver, linux aka kernel module)
305# @param $(target) Normalized main target name.
306# @param $(out) System module name.
307# @param $(objs) Object files to link together.
308# @param $(libs) Libraries to search.
309# @param $(libpath) Library search paths.
310# @param $(flags) Flags.
311# @param $(dirdep) Directory creation dependency.
312# @param $(deps) Other dependencies.
313# @param $(othersrc) Unhandled sources.
314# @param $(custom_pre) Custom step invoked before linking.
315# @param $(custom_post) Custom step invoked after linking.
316#
317# @param $(outbase) Output basename (full). Use this for list files and such.
318TOOL_VCC80AMD64_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
319TOOL_VCC80AMD64_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
320TOOL_VCC80AMD64_LINK_SYSMOD_DEPORD =
321define TOOL_VCC80AMD64_LINK_SYSMOD_CMDS
322 $(TOOL_VCC80AMD64_LD) $(flags) \
323 /OUT:$(out) \
324 /MAPINFO:EXPORTS /INCREMENTAL:NO \
325 /MAP:$(outbase).map \
326 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
327 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
328 $(foreach p,$(libpath), /LIBPATH:$(p)) \
329 $(subst /,\\,$(objs)) \
330 $(subst /,\\,$(libs))
331 if test -f $(out).manifest; then \
332 $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
333 fi
334endef
335
Note: See TracBrowser for help on using the repository browser.