*: Updated copyright to 2009 and normalized name & email.
[kbuild-mirror.git] / kBuild / tools / VCC80X86.kmk
blobe8bdaf2c71d7a160eaa94b4efd0fc4133fab272b
1 # $Id$
2 ## @file
3 # kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting x86.
7 # Copyright (c) 2004-2009 knut st. osmundsen <bird-kBuild-spamix@anduin.net>
9 # This file is part of kBuild.
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.
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.
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
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.
34 TOOL_VCC80X86 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting x86.
36 # Tool Specific Properties
37 ifndef PATH_TOOL_VCC80X86
38 PATH_TOOL_VCC80X86 := $(wildcard $(PATH_DEVTOOLS)/win.x86/vcc/v8*)
39 ifeq ($(PATH_TOOL_VCC80X86),)
40 PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80)
41 endif
42 ifeq ($(PATH_TOOL_VCC80X86),)
43 PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80AMD64)
44 endif
45 ifeq ($(PATH_TOOL_VCC80X86),)
46 PATH_TOOL_VCC80X86 := $(wildcard $(PATH_DEVTOOLS)/x86.win32/vcc/v8*)
47 endif
48 ifeq ($(PATH_TOOL_VCC80X86),)
49 PATH_TOOL_VCC80X86 := $(wildcard $(PATH_DEVTOOLS)/win.amd64/vcc/v8*)
50 endif
51 ifneq ($(PATH_TOOL_VCC80X86),)
52 PATH_TOOL_VCC80X86 := $(lastword $(sort $(PATH_TOOL_VCC80X86)))
53 else
54 $(warning kBuild: PATH_TOOL_VCC80X86 cannot be determined!)
55 PATH_TOOL_VCC80X86 := $(PATH_DEVTOOLS)/x86.win/vcc/v8
56 endif
57 else
58 # Resolve any fancy stuff once and for all.
59 PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80X86)
60 endif
61 PATH_TOOL_VCC80X86_BIN ?= $(PATH_TOOL_VCC80X86)/bin
62 PATH_TOOL_VCC80X86_LIB ?= $(PATH_TOOL_VCC80X86)/lib
63 PATH_TOOL_VCC80X86_INC ?= $(PATH_TOOL_VCC80X86)/include
64 PATH_TOOL_VCC80X86_ATLMFC ?= $(PATH_TOOL_VCC80X86)/atlmfc
65 PATH_TOOL_VCC80X86_ATLMFC_INC ?= $(PATH_TOOL_VCC80X86_ATLMFC)/include
66 PATH_TOOL_VCC80X86_ATLMFC_LIB ?= $(PATH_TOOL_VCC80X86_ATLMFC)/lib
67 TOOL_VCC80X86_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/cl.exe
68 TOOL_VCC80X86_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/cl.exe
69 TOOL_VCC80X86_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/ml.exe
70 TOOL_VCC80X86_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/rc.exe
71 TOOL_VCC80X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/lib.exe
72 TOOL_VCC80X86_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/link.exe
73 TOOL_VCC80X86_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/mt.exe
74 ## Disabled fast DEP_IDB based dependencies.
75 #VCC80X86_OLD_DEPS = 1
77 ## Constructs the correct .pdb name (the name is lowercased).
78 # @param $(1) Base name, no extention.
79 # @param $(2) The extension.
80 TOOL_VCC80X86_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
83 # General Properties used by kBuild
84 TOOL_VCC80X86_COBJSUFF ?= .obj
85 TOOL_VCC80X86_CFLAGS ?= -TC -c -nologo
86 TOOL_VCC80X86_CFLAGS.debug ?= -Zi
87 TOOL_VCC80X86_CFLAGS.release ?= -O2
88 TOOL_VCC80X86_CFLAGS.profile ?= -O2
89 TOOL_VCC80X86_CINCS ?= $(PATH_TOOL_VCC80X86_INC)
90 TOOL_VCC80X86_CDEFS ?=
92 TOOL_VCC80X86_CXXOBJSUFF ?= .obj
93 TOOL_VCC80X86_CXXFLAGS ?= -TP -c -nologo
94 TOOL_VCC80X86_CXXFLAGS.debug ?= -Zi
95 TOOL_VCC80X86_CXXFLAGS.release ?= -O2
96 TOOL_VCC80X86_CXXFLAGS.profile ?= -O2
97 TOOL_VCC80X86_CXXINCS ?= $(PATH_TOOL_VCC80X86_INC) $(PATH_TOOL_VCC80X86_ATLMFC_INC)
98 TOOL_VCC80X86_CXXDEFS ?=
100 TOOL_VCC80X86_ASOBJSUFF ?= .obj
102 TOOL_VCC80X86_RCOBJSUFF ?= .res
103 TOOL_VCC80X86_RCINCS ?= $(PATH_TOOL_VCC80X86_INC) $(PATH_TOOL_VCC80X86_ATLMFC_INC)
105 TOOL_VCC80X86_ARFLAGS ?= -nologo
106 TOOL_VCC80X86_ARLIBSUFF ?= .lib
108 TOOL_VCC80X86_LDFLAGS ?= -nologo -machine:x86
109 TOOL_VCC80X86_LDFLAGS.debug ?= -debug
110 TOOL_VCC80X86_LDFLAGS.release ?=
114 ## Compile C source.
115 # @param $(target) Normalized main target name.
116 # @param $(source) Source filename (relative).
117 # @param $(obj) Object file name. This shall be (re)created by the compilation.
118 # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
119 # @param $(flags) Flags.
120 # @param $(defs) Definitions. No -D or something.
121 # @param $(incs) Includes. No -I or something.
122 # @param $(dirdep) Directory creation dependency.
123 # @param $(deps) Other dependencies.
125 # @param $(outbase) Output basename (full). Use this for list files and such.
126 # @param $(objsuff) Object suffix.
127 TOOL_VCC80X86_COMPILE_C_DEPEND =
128 TOOL_VCC80X86_COMPILE_C_DEPORD =
129 TOOL_VCC80X86_COMPILE_C_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
130 TOOL_VCC80X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb)
131 define TOOL_VCC80X86_COMPILE_C_CMDS
132 $(QUIET)$(TOOL_VCC80X86_CC) -c\
133 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
134 -Fd$(outbase)-obj.pdb \
135 -FD\
136 -Fo$(obj)\
137 $(subst /,\\,$(abspath $(source)))
138 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
139 endef
142 ## Compile C++ source.
143 # @param $(target) Normalized main target name.
144 # @param $(source) Source filename (relative).
145 # @param $(obj) Object file name. This shall be (re)created by the compilation.
146 # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
147 # @param $(flags) Flags.
148 # @param $(defs) Definitions. No -D or something.
149 # @param $(incs) Includes. No -I or something.
150 # @param $(dirdep) Directory creation dependency.
151 # @param $(deps) Other dependencies.
153 # @param $(outbase) Output basename (full). Use this for list files and such.
154 # @param $(objsuff) Object suffix.
155 TOOL_VCC80X86_COMPILE_CXX_DEPEND =
156 TOOL_VCC80X86_COMPILE_CXX_DEPORD =
157 TOOL_VCC80X86_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
158 TOOL_VCC80X86_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb)
159 define TOOL_VCC80X86_COMPILE_CXX_CMDS
160 $(QUIET)$(TOOL_VCC80X86_CXX) -c\
161 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
162 -Fd$(outbase)-obj.pdb \
163 -FD\
164 -Fo$(obj)\
165 $(subst /,\\,$(abspath $(source)))
166 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
167 endef
169 ## @todo configure the assembler template.
171 ## Compile resource source.
172 # @param $(target) Normalized main target name.
173 # @param $(source) Source filename (relative).
174 # @param $(obj) Object file name. This shall be (re)created by the compilation.
175 # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
176 # @param $(flags) Flags.
177 # @param $(defs) Definitions. No -D or something.
178 # @param $(incs) Includes. No -I or something.
179 # @param $(dirdep) Directory creation dependency.
180 # @param $(deps) Other dependencies.
182 # @param $(outbase) Output basename (full). Use this for list files and such.
183 # @param $(objsuff) Object suffix.
184 TOOL_VCC80X86_COMPILE_RC_DEPEND =
185 TOOL_VCC80X86_COMPILE_RC_DEPORD =
186 TOOL_VCC80X86_COMPILE_RC_OUTPUT =
187 define TOOL_VCC80X86_COMPILE_RC_CMDS
188 $(QUIET)$(TOOL_VCC80X86_RC) \
189 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
190 /fo$(obj)\
191 $(subst /,\\,$(abspath $(source)))
192 endef
195 ## Link library
196 # @param $(target) Normalized main target name.
197 # @param $(out) Library name.
198 # @param $(objs) Object files to put in the library.
199 # @param $(flags) Flags.
200 # @param $(dirdep) Directory creation dependency.
201 # @param $(deps) Other dependencies.
202 # @param $(othersrc) Unhandled sources.
203 # @param $(outbase) Output basename (full). Use this for list files and such.
205 TOOL_VCC80X86_LINK_LIBRARY_DEPEND = $(othersrc)
206 TOOL_VCC80X86_LINK_LIBRARY_DEPORD =
207 TOOL_VCC80X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
208 TOOL_VCC80X86_LINK_LIBRARY_OUTPUT_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb
209 define TOOL_VCC80X86_LINK_LIBRARY_CMDS
210 $(QUIET)$(APPEND) -n $(outbase).rsp \
211 $(foreach arg,\
212 $(subst /,\\,$(objs) \
213 $(filter-out %.def,$(othersrc))) \
214 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
215 ,\"$(arg)\")
216 $(QUIET)$(TOOL_VCC80X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
217 endef
220 ## Link program
221 # @param $(target) Normalized main target name.
222 # @param $(out) Program name.
223 # @param $(objs) Object files to link together.
224 # @param $(libs) Libraries to search.
225 # @param $(libpath) Library search paths.
226 # @param $(flags) Flags.
227 # @param $(dirdep) Directory creation dependency.
228 # @param $(deps) Other dependencies.
229 # @param $(othersrc) Unhandled sources.
230 # @param $(custom_pre) Custom step invoked before linking.
231 # @param $(custom_post) Custom step invoked after linking.
232 # @param $(outbase) Output basename (full). Use this for list files and such.
234 TOOL_VCC80X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
235 TOOL_VCC80X86_LINK_PROGRAM_DEPORD =
236 TOOL_VCC80X86_LINK_PROGRAM_OUTPUT = $(outbase).map
237 TOOL_VCC80X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
238 define TOOL_VCC80X86_LINK_PROGRAM_CMDS
239 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
240 /OUT:$(out) \
241 /MAPINFO:EXPORTS /INCREMENTAL:NO \
242 /MAP:$(outbase).map \
243 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
244 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
245 $(foreach p,$(libpath), /LIBPATH:$(p)) \
246 $(subst /,\\,$(objs)) \
247 $(subst /,\\,$(libs))
248 $(QUIET)$(TEST) -f $(out).manifest -- \
249 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
250 endef
253 ## Link DLL.
254 # @param $(target) Normalized main target name.
255 # @param $(out) DLL name.
256 # @param $(objs) Object files to link together.
257 # @param $(libs) Libraries to search.
258 # @param $(libpath) Library search paths.
259 # @param $(flags) Flags.
260 # @param $(dirdep) Directory creation dependency.
261 # @param $(deps) Other dependencies.
262 # @param $(othersrc) Unhandled sources.
263 # @param $(custom_pre) Custom step invoked before linking.
264 # @param $(custom_post) Custom step invoked after linking.
266 # @param $(outbase) Output basename (full). Use this for list files and such.
267 TOOL_VCC80X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
268 TOOL_VCC80X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
269 TOOL_VCC80X86_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp
270 TOOL_VCC80X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).pdb $(outbase).ilk $(out).manifest $(PATH_LIB)/$(notdir $(outbase)).lib $(PATH_LIB)/$(notdir $(outbase)).exp
271 define TOOL_VCC80X86_LINK_DLL_CMDS
272 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
273 /OUT:$(out) \
274 /IMPLIB:$(outbase).lib \
275 /MAPINFO:EXPORTS /INCREMENTAL:NO \
276 /MAP:$(outbase).map \
277 /DLL \
278 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
279 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
280 $(foreach p,$(libpath), /LIBPATH:$(p)) \
281 $(subst /,\\,$(objs)) \
282 $(subst /,\\,$(libs))
283 $(QUIET)$(TEST) -f $(out).manifest -- \
284 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
285 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_LIB)/
286 $(eval _DIRS += $(PATH_LIB))
287 endef
290 ## Link system module (windows aka driver, linux aka kernel module)
291 # @param $(target) Normalized main target name.
292 # @param $(out) System module name.
293 # @param $(objs) Object files to link together.
294 # @param $(libs) Libraries to search.
295 # @param $(libpath) Library search paths.
296 # @param $(flags) Flags.
297 # @param $(dirdep) Directory creation dependency.
298 # @param $(deps) Other dependencies.
299 # @param $(othersrc) Unhandled sources.
300 # @param $(custom_pre) Custom step invoked before linking.
301 # @param $(custom_post) Custom step invoked after linking.
303 # @param $(outbase) Output basename (full). Use this for list files and such.
304 TOOL_VCC80X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
305 TOOL_VCC80X86_LINK_SYSMOD_DEPORD =
306 TOOL_VCC80X86_LINK_SYSMOD_OUTPUT = $(outbase).map
307 TOOL_VCC80X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
308 define TOOL_VCC80X86_LINK_SYSMOD_CMDS
309 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
310 /OUT:$(out) \
311 /MAPINFO:EXPORTS /INCREMENTAL:NO \
312 /MAP:$(outbase).map \
313 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
314 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
315 $(foreach p,$(libpath), /LIBPATH:$(p)) \
316 $(subst /,\\,$(objs)) \
317 $(subst /,\\,$(libs))
318 $(QUIET)$(TEST) -f $(out).manifest -- \
319 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
320 endef