source: trunk/kBuild/tools/VCC80X86.kmk@ 897

Last change on this file since 897 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.1 KB
Line 
1# $Id: VCC80X86.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 x86.
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_VCC80X86 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting x86.
28
29# Tool Specific Properties
30ifndef PATH_TOOL_VCC80X86
31 PATH_TOOL_VCC80X86 := $(wildcard $(PATH_DEVTOOLS)/win.x86/vcc/v8*)
32 ifeq ($(PATH_TOOL_VCC80X86),)
33 PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80)
34 endif
35 ifeq ($(PATH_TOOL_VCC80X86),)
36 PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80AMD64)
37 endif
38 ifeq ($(PATH_TOOL_VCC80X86),)
39 PATH_TOOL_VCC80X86 := $(wildcard $(PATH_DEVTOOLS)/x86.win32/vcc/v8*)
40 endif
41 ifeq ($(PATH_TOOL_VCC80X86),)
42 PATH_TOOL_VCC80X86 := $(wildcard $(PATH_DEVTOOLS)/win.amd64/vcc/v8*)
43 endif
44 ifneq ($(PATH_TOOL_VCC80X86),)
45 PATH_TOOL_VCC80X86 := $(lastword $(sort $(PATH_TOOL_VCC80X86)))
46 else
47 $(warning kBuild: PATH_TOOL_VCC80X86 cannot be determined!)
48 PATH_TOOL_VCC80X86 := $(PATH_DEVTOOLS)/x86.win/vcc/v8
49 endif
50else
51 # Resolve any fancy stuff once and for all.
52 PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80X86)
53endif
54PATH_TOOL_VCC80X86_BIN ?= $(PATH_TOOL_VCC80X86)/bin
55PATH_TOOL_VCC80X86_LIB ?= $(PATH_TOOL_VCC80X86)/lib
56PATH_TOOL_VCC80X86_INC ?= $(PATH_TOOL_VCC80X86)/include
57PATH_TOOL_VCC80X86_ATLMFC ?= $(PATH_TOOL_VCC80X86)/atlmfc
58PATH_TOOL_VCC80X86_ATLMFC_INC ?= $(PATH_TOOL_VCC80X86_ATLMFC)/include
59PATH_TOOL_VCC80X86_ATLMFC_LIB ?= $(PATH_TOOL_VCC80X86_ATLMFC)/lib
60TOOL_VCC80X86_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/cl.exe
61TOOL_VCC80X86_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/cl.exe
62TOOL_VCC80X86_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/ml.exe
63TOOL_VCC80X86_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/rc.exe
64TOOL_VCC80X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/lib.exe
65TOOL_VCC80X86_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/link.exe
66TOOL_VCC80X86_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/mt.exe
67## Disabled fast DEP_IDB based dependencies.
68#VCC80X86_OLD_DEPS = 1
69
70## Constructs the correct .pdb name (the name is lowercased).
71# @param $(1) Base name, no extention.
72# @param $(2) The extension.
73ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
74TOOL_VCC80X86_PDB ?= $(dir $(1))$(tolower $(notdir $(1))).$(2)
75else # this fallback is incorrect and won't work on a case sensitive FS.
76TOOL_VCC80X86_PDB ?= $(1).$(2)
77endif
78
79
80# General Properties used by kBuild
81TOOL_VCC80X86_COBJSUFF ?= .obj
82TOOL_VCC80X86_CFLAGS ?= -TC -c -nologo
83TOOL_VCC80X86_CFLAGS.debug ?= -Zi
84TOOL_VCC80X86_CFLAGS.release ?= -O2
85TOOL_VCC80X86_CFLAGS.profile ?= -O2
86TOOL_VCC80X86_CINCS ?= $(PATH_TOOL_VCC80X86_INC)
87TOOL_VCC80X86_CDEFS ?=
88
89TOOL_VCC80X86_CXXOBJSUFF ?= .obj
90TOOL_VCC80X86_CXXFLAGS ?= -TP -c -nologo
91TOOL_VCC80X86_CXXFLAGS.debug ?= -Zi
92TOOL_VCC80X86_CXXFLAGS.release ?= -O2
93TOOL_VCC80X86_CXXFLAGS.profile ?= -O2
94TOOL_VCC80X86_CXXINCS ?= $(PATH_TOOL_VCC80X86_INC) $(PATH_TOOL_VCC80X86_ATLMFC_INC)
95TOOL_VCC80X86_CXXDEFS ?=
96
97TOOL_VCC80X86_ASOBJSUFF ?= .obj
98
99TOOL_VCC80X86_RCOBJSUFF ?= .res
100TOOL_VCC80X86_RCINCS ?= $(PATH_TOOL_VCC80X86_INC) $(PATH_TOOL_VCC80X86_ATLMFC_INC)
101
102TOOL_VCC80X86_ARFLAGS ?= -nologo
103TOOL_VCC80X86_ARLIBSUFF ?= .lib
104
105TOOL_VCC80X86_LDFLAGS ?= -nologo -machine:x86
106TOOL_VCC80X86_LDFLAGS.debug ?= -debug
107TOOL_VCC80X86_LDFLAGS.release ?=
108
109
110
111## Compile C source.
112# @param $(target) Normalized main target name.
113# @param $(source) Source filename (relative).
114# @param $(obj) Object file name. This shall be (re)created by the compilation.
115# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
116# @param $(flags) Flags.
117# @param $(defs) Definitions. No -D or something.
118# @param $(incs) Includes. No -I or something.
119# @param $(dirdep) Directory creation dependency.
120# @param $(deps) Other dependencies.
121#
122# @param $(outbase) Output basename (full). Use this for list files and such.
123# @param $(objsuff) Object suffix.
124TOOL_VCC80X86_COMPILE_C_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
125TOOL_VCC80X86_COMPILE_C_DEPEND =
126TOOL_VCC80X86_COMPILE_C_DEPORD =
127ifndef VCC80X86_OLD_DEPS
128define TOOL_VCC80X86_COMPILE_C_CMDS
129 $(QUIET)$(TOOL_VCC80X86_CC) -c\
130 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
131 -Fd$(outbase)-obj.pdb \
132 -FD\
133 -Fo$(obj)\
134 $(subst /,\\,$(abspath $(source)))
135 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
136endef
137else
138define TOOL_VCC80X86_COMPILE_C_CMDS
139 $(QUIET)$(TOOL_VCC80X86_CC) -c\
140 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
141 -Fd$(outbase)-obj.pdb \
142 -Fo$(obj)\
143 $(subst /,\\,$(abspath $(source)))
144 $(QUIET)$(TOOL_VCC80X86_CC) -E\
145 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
146 $(subst /,\\,$(abspath $(source)))\
147 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
148endef
149endif
150
151
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.
162#
163# @param $(outbase) Output basename (full). Use this for list files and such.
164# @param $(objsuff) Object suffix.
165TOOL_VCC80X86_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
166TOOL_VCC80X86_COMPILE_CXX_DEPEND =
167TOOL_VCC80X86_COMPILE_CXX_DEPORD =
168ifndef VCC80X86_OLD_DEPS
169define TOOL_VCC80X86_COMPILE_CXX_CMDS
170 $(QUIET)$(TOOL_VCC80X86_CXX) -c\
171 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
172 -Fd$(outbase)-obj.pdb \
173 -FD\
174 -Fo$(obj)\
175 $(subst /,\\,$(abspath $(source)))
176 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
177endef
178else
179define TOOL_VCC80X86_COMPILE_CXX_CMDS
180 $(QUIET)$(TOOL_VCC80X86_CXX) -c\
181 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
182 -Fd$(outbase)-obj.pdb \
183 -Fo$(obj)\
184 $(subst /,\\,$(abspath $(source)))
185 $(QUIET)$(TOOL_VCC80X86_CXX) -E\
186 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
187 $(subst /,\\,$(abspath $(source)))\
188 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
189endef
190endif
191
192## @todo configure the assembler template.
193
194## Compile resource source.
195# @param $(target) Normalized main target name.
196# @param $(source) Source filename (relative).
197# @param $(obj) Object file name. This shall be (re)created by the compilation.
198# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
199# @param $(flags) Flags.
200# @param $(defs) Definitions. No -D or something.
201# @param $(incs) Includes. No -I or something.
202# @param $(dirdep) Directory creation dependency.
203# @param $(deps) Other dependencies.
204#
205# @param $(outbase) Output basename (full). Use this for list files and such.
206# @param $(objsuff) Object suffix.
207TOOL_VCC80X86_COMPILE_RC_OUTPUT =
208TOOL_VCC80X86_COMPILE_RC_DEPEND =
209TOOL_VCC80X86_COMPILE_RC_DEPORD =
210define TOOL_VCC80X86_COMPILE_RC_CMDS
211 $(QUIET)$(TOOL_VCC80X86_RC) \
212 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
213 /fo$(obj)\
214 $(subst /,\\,$(abspath $(source)))
215endef
216
217
218## Link library
219# @param $(target) Normalized main target name.
220# @param $(out) Library name.
221# @param $(objs) Object files to put in the library.
222# @param $(flags) Flags.
223# @param $(dirdep) Directory creation dependency.
224# @param $(deps) Other dependencies.
225# @param $(othersrc) Unhandled sources.
226# @param $(outbase) Output basename (full). Use this for list files and such.
227#
228TOOL_VCC80X86_LINK_LIBRARY_DEPEND = $(othersrc)
229TOOL_VCC80X86_LINK_LIBRARY_DEPORD =
230ifeq ($(filter append-dash-n,$(KMK_FEATURES)),append-dash-n)
231TOOL_VCC80X86_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb $(outbase).rsp
232define TOOL_VCC80X86_LINK_LIBRARY_CMDS
233 $(QUIET)$(APPEND) -n $(outbase).rsp \
234 $(foreach arg,\
235 $(subst /,\\,$(objs) \
236 $(filter-out %.def,$(othersrc))) \
237 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
238 ,\"$(arg)\")
239 $(QUIET)$(TOOL_VCC80X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
240endef
241else
242TOOL_VCC80X86_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb
243define TOOL_VCC80X86_LINK_LIBRARY_CMDS
244 $(QUIET)$(TOOL_VCC80X86_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
245 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
246endef
247endif
248
249
250## Link program
251# @param $(target) Normalized main target name.
252# @param $(out) Program name.
253# @param $(objs) Object files to link together.
254# @param $(libs) Libraries to search.
255# @param $(libpath) Library search paths.
256# @param $(flags) Flags.
257# @param $(dirdep) Directory creation dependency.
258# @param $(deps) Other dependencies.
259# @param $(othersrc) Unhandled sources.
260# @param $(custom_pre) Custom step invoked before linking.
261# @param $(custom_post) Custom step invoked after linking.
262# @param $(outbase) Output basename (full). Use this for list files and such.
263#
264TOOL_VCC80X86_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
265TOOL_VCC80X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
266TOOL_VCC80X86_LINK_PROGRAM_DEPORD =
267define TOOL_VCC80X86_LINK_PROGRAM_CMDS
268 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
269 /OUT:$(out) \
270 /MAPINFO:EXPORTS /INCREMENTAL:NO \
271 /MAP:$(outbase).map \
272 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
273 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
274 $(foreach p,$(libpath), /LIBPATH:$(p)) \
275 $(subst /,\\,$(objs)) \
276 $(subst /,\\,$(libs))
277 $(QUIET)if test -f $(out).manifest; then \
278 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)); \
279 fi
280endef
281
282
283## Link DLL.
284# @param $(target) Normalized main target name.
285# @param $(out) DLL name.
286# @param $(objs) Object files to link together.
287# @param $(libs) Libraries to search.
288# @param $(libpath) Library search paths.
289# @param $(flags) Flags.
290# @param $(dirdep) Directory creation dependency.
291# @param $(deps) Other dependencies.
292# @param $(othersrc) Unhandled sources.
293# @param $(custom_pre) Custom step invoked before linking.
294# @param $(custom_post) Custom step invoked after linking.
295#
296# @param $(outbase) Output basename (full). Use this for list files and such.
297TOOL_VCC80X86_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
298TOOL_VCC80X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
299TOOL_VCC80X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
300define TOOL_VCC80X86_LINK_DLL_CMDS
301 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
302 /OUT:$(out) \
303 /IMPLIB:$(outbase).lib \
304 /MAPINFO:EXPORTS /INCREMENTAL:NO \
305 /MAP:$(outbase).map \
306 /DLL \
307 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
308 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
309 $(foreach p,$(libpath), /LIBPATH:$(p)) \
310 $(subst /,\\,$(objs)) \
311 $(subst /,\\,$(libs))
312 $(QUIET)if test -f $(out).manifest; then \
313 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
314 fi
315ifeq ($(filter %.exp .def,$(othersrc)),)
316 $(QUIET)if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
317 $(QUIET)if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
318endif
319$(eval _DIRS += $(PATH_LIB))
320endef
321
322
323## Link system module (windows aka driver, linux aka kernel module)
324# @param $(target) Normalized main target name.
325# @param $(out) System module name.
326# @param $(objs) Object files to link together.
327# @param $(libs) Libraries to search.
328# @param $(libpath) Library search paths.
329# @param $(flags) Flags.
330# @param $(dirdep) Directory creation dependency.
331# @param $(deps) Other dependencies.
332# @param $(othersrc) Unhandled sources.
333# @param $(custom_pre) Custom step invoked before linking.
334# @param $(custom_post) Custom step invoked after linking.
335#
336# @param $(outbase) Output basename (full). Use this for list files and such.
337TOOL_VCC80X86_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
338TOOL_VCC80X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
339TOOL_VCC80X86_LINK_SYSMOD_DEPORD =
340define TOOL_VCC80X86_LINK_SYSMOD_CMDS
341 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
342 /OUT:$(out) \
343 /MAPINFO:EXPORTS /INCREMENTAL:NO \
344 /MAP:$(outbase).map \
345 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
346 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
347 $(foreach p,$(libpath), /LIBPATH:$(p)) \
348 $(subst /,\\,$(objs)) \
349 $(subst /,\\,$(libs))
350 $(QUIET)if test -f $(out).manifest; then \
351 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
352 fi
353endef
354
Note: See TracBrowser for help on using the repository browser.