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

Last change on this file since 1013 was 857, checked in by bird, 18 years ago

Select v8*.

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