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

Last change on this file since 1418 was 1354, checked in by bird, 18 years ago

Don't check for tolower, it's there.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.9 KB
Line 
1# $Id: VCC80X86.kmk 1354 2007-12-03 01:07:33Z 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.
73TOOL_VCC80X86_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
74
75
76# General Properties used by kBuild
77TOOL_VCC80X86_COBJSUFF ?= .obj
78TOOL_VCC80X86_CFLAGS ?= -TC -c -nologo
79TOOL_VCC80X86_CFLAGS.debug ?= -Zi
80TOOL_VCC80X86_CFLAGS.release ?= -O2
81TOOL_VCC80X86_CFLAGS.profile ?= -O2
82TOOL_VCC80X86_CINCS ?= $(PATH_TOOL_VCC80X86_INC)
83TOOL_VCC80X86_CDEFS ?=
84
85TOOL_VCC80X86_CXXOBJSUFF ?= .obj
86TOOL_VCC80X86_CXXFLAGS ?= -TP -c -nologo
87TOOL_VCC80X86_CXXFLAGS.debug ?= -Zi
88TOOL_VCC80X86_CXXFLAGS.release ?= -O2
89TOOL_VCC80X86_CXXFLAGS.profile ?= -O2
90TOOL_VCC80X86_CXXINCS ?= $(PATH_TOOL_VCC80X86_INC) $(PATH_TOOL_VCC80X86_ATLMFC_INC)
91TOOL_VCC80X86_CXXDEFS ?=
92
93TOOL_VCC80X86_ASOBJSUFF ?= .obj
94
95TOOL_VCC80X86_RCOBJSUFF ?= .res
96TOOL_VCC80X86_RCINCS ?= $(PATH_TOOL_VCC80X86_INC) $(PATH_TOOL_VCC80X86_ATLMFC_INC)
97
98TOOL_VCC80X86_ARFLAGS ?= -nologo
99TOOL_VCC80X86_ARLIBSUFF ?= .lib
100
101TOOL_VCC80X86_LDFLAGS ?= -nologo -machine:x86
102TOOL_VCC80X86_LDFLAGS.debug ?= -debug
103TOOL_VCC80X86_LDFLAGS.release ?=
104
105
106
107## Compile C source.
108# @param $(target) Normalized main target name.
109# @param $(source) Source filename (relative).
110# @param $(obj) Object file name. This shall be (re)created by the compilation.
111# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
112# @param $(flags) Flags.
113# @param $(defs) Definitions. No -D or something.
114# @param $(incs) Includes. No -I or something.
115# @param $(dirdep) Directory creation dependency.
116# @param $(deps) Other dependencies.
117#
118# @param $(outbase) Output basename (full). Use this for list files and such.
119# @param $(objsuff) Object suffix.
120TOOL_VCC80X86_COMPILE_C_DEPEND =
121TOOL_VCC80X86_COMPILE_C_DEPORD =
122TOOL_VCC80X86_COMPILE_C_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
123TOOL_VCC80X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb)
124define TOOL_VCC80X86_COMPILE_C_CMDS
125 $(QUIET)$(TOOL_VCC80X86_CC) -c\
126 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
127 -Fd$(outbase)-obj.pdb \
128 -FD\
129 -Fo$(obj)\
130 $(subst /,\\,$(abspath $(source)))
131 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
132endef
133
134
135## Compile C++ source.
136# @param $(target) Normalized main target name.
137# @param $(source) Source filename (relative).
138# @param $(obj) Object file name. This shall be (re)created by the compilation.
139# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
140# @param $(flags) Flags.
141# @param $(defs) Definitions. No -D or something.
142# @param $(incs) Includes. No -I or something.
143# @param $(dirdep) Directory creation dependency.
144# @param $(deps) Other dependencies.
145#
146# @param $(outbase) Output basename (full). Use this for list files and such.
147# @param $(objsuff) Object suffix.
148TOOL_VCC80X86_COMPILE_CXX_DEPEND =
149TOOL_VCC80X86_COMPILE_CXX_DEPORD =
150TOOL_VCC80X86_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
151TOOL_VCC80X86_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb)
152define TOOL_VCC80X86_COMPILE_CXX_CMDS
153 $(QUIET)$(TOOL_VCC80X86_CXX) -c\
154 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
155 -Fd$(outbase)-obj.pdb \
156 -FD\
157 -Fo$(obj)\
158 $(subst /,\\,$(abspath $(source)))
159 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
160endef
161
162## @todo configure the assembler template.
163
164## Compile resource source.
165# @param $(target) Normalized main target name.
166# @param $(source) Source filename (relative).
167# @param $(obj) Object file name. This shall be (re)created by the compilation.
168# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
169# @param $(flags) Flags.
170# @param $(defs) Definitions. No -D or something.
171# @param $(incs) Includes. No -I or something.
172# @param $(dirdep) Directory creation dependency.
173# @param $(deps) Other dependencies.
174#
175# @param $(outbase) Output basename (full). Use this for list files and such.
176# @param $(objsuff) Object suffix.
177TOOL_VCC80X86_COMPILE_RC_DEPEND =
178TOOL_VCC80X86_COMPILE_RC_DEPORD =
179TOOL_VCC80X86_COMPILE_RC_OUTPUT =
180define TOOL_VCC80X86_COMPILE_RC_CMDS
181 $(QUIET)$(TOOL_VCC80X86_RC) \
182 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
183 /fo$(obj)\
184 $(subst /,\\,$(abspath $(source)))
185endef
186
187
188## Link library
189# @param $(target) Normalized main target name.
190# @param $(out) Library name.
191# @param $(objs) Object files to put in the library.
192# @param $(flags) Flags.
193# @param $(dirdep) Directory creation dependency.
194# @param $(deps) Other dependencies.
195# @param $(othersrc) Unhandled sources.
196# @param $(outbase) Output basename (full). Use this for list files and such.
197#
198TOOL_VCC80X86_LINK_LIBRARY_DEPEND = $(othersrc)
199TOOL_VCC80X86_LINK_LIBRARY_DEPORD =
200TOOL_VCC80X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
201TOOL_VCC80X86_LINK_LIBRARY_OUTPUT_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb
202define TOOL_VCC80X86_LINK_LIBRARY_CMDS
203 $(QUIET)$(APPEND) -n $(outbase).rsp \
204 $(foreach arg,\
205 $(subst /,\\,$(objs) \
206 $(filter-out %.def,$(othersrc))) \
207 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
208 ,\"$(arg)\")
209 $(QUIET)$(TOOL_VCC80X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
210endef
211
212
213## Link program
214# @param $(target) Normalized main target name.
215# @param $(out) Program name.
216# @param $(objs) Object files to link together.
217# @param $(libs) Libraries to search.
218# @param $(libpath) Library search paths.
219# @param $(flags) Flags.
220# @param $(dirdep) Directory creation dependency.
221# @param $(deps) Other dependencies.
222# @param $(othersrc) Unhandled sources.
223# @param $(custom_pre) Custom step invoked before linking.
224# @param $(custom_post) Custom step invoked after linking.
225# @param $(outbase) Output basename (full). Use this for list files and such.
226#
227TOOL_VCC80X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
228TOOL_VCC80X86_LINK_PROGRAM_DEPORD =
229TOOL_VCC80X86_LINK_PROGRAM_OUTPUT = $(outbase).map
230TOOL_VCC80X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
231define TOOL_VCC80X86_LINK_PROGRAM_CMDS
232 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
233 /OUT:$(out) \
234 /MAPINFO:EXPORTS /INCREMENTAL:NO \
235 /MAP:$(outbase).map \
236 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
237 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
238 $(foreach p,$(libpath), /LIBPATH:$(p)) \
239 $(subst /,\\,$(objs)) \
240 $(subst /,\\,$(libs))
241 $(QUIET)$(TEST) -f $(out).manifest -- \
242 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
243endef
244
245
246## Link DLL.
247# @param $(target) Normalized main target name.
248# @param $(out) DLL name.
249# @param $(objs) Object files to link together.
250# @param $(libs) Libraries to search.
251# @param $(libpath) Library search paths.
252# @param $(flags) Flags.
253# @param $(dirdep) Directory creation dependency.
254# @param $(deps) Other dependencies.
255# @param $(othersrc) Unhandled sources.
256# @param $(custom_pre) Custom step invoked before linking.
257# @param $(custom_post) Custom step invoked after linking.
258#
259# @param $(outbase) Output basename (full). Use this for list files and such.
260TOOL_VCC80X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
261TOOL_VCC80X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
262TOOL_VCC80X86_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp
263TOOL_VCC80X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).pdb $(outbase).ilk $(out).manifest
264define TOOL_VCC80X86_LINK_DLL_CMDS
265 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
266 /OUT:$(out) \
267 /IMPLIB:$(outbase).lib \
268 /MAPINFO:EXPORTS /INCREMENTAL:NO \
269 /MAP:$(outbase).map \
270 /DLL \
271 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
272 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
273 $(foreach p,$(libpath), /LIBPATH:$(p)) \
274 $(subst /,\\,$(objs)) \
275 $(subst /,\\,$(libs))
276 $(QUIET)$(TEST) -f $(out).manifest -- \
277 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
278ifeq ($(filter %.exp .def,$(othersrc)),)
279 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_LIB)/
280endif
281$(eval _DIRS += $(PATH_LIB))
282endef
283
284
285## Link system module (windows aka driver, linux aka kernel module)
286# @param $(target) Normalized main target name.
287# @param $(out) System module name.
288# @param $(objs) Object files to link together.
289# @param $(libs) Libraries to search.
290# @param $(libpath) Library search paths.
291# @param $(flags) Flags.
292# @param $(dirdep) Directory creation dependency.
293# @param $(deps) Other dependencies.
294# @param $(othersrc) Unhandled sources.
295# @param $(custom_pre) Custom step invoked before linking.
296# @param $(custom_post) Custom step invoked after linking.
297#
298# @param $(outbase) Output basename (full). Use this for list files and such.
299TOOL_VCC80X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
300TOOL_VCC80X86_LINK_SYSMOD_DEPORD =
301TOOL_VCC80X86_LINK_SYSMOD_OUTPUT = $(outbase).map
302TOOL_VCC80X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
303define TOOL_VCC80X86_LINK_SYSMOD_CMDS
304 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
305 /OUT:$(out) \
306 /MAPINFO:EXPORTS /INCREMENTAL:NO \
307 /MAP:$(outbase).map \
308 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
309 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
310 $(foreach p,$(libpath), /LIBPATH:$(p)) \
311 $(subst /,\\,$(objs)) \
312 $(subst /,\\,$(libs))
313 $(QUIET)$(TEST) -f $(out).manifest -- \
314 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
315endef
316
Note: See TracBrowser for help on using the repository browser.