source: trunk/kBuild/tools/VCC80.kmk@ 1502

Last change on this file since 1502 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: 13.7 KB
Line 
1# $Id: VCC80.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 $(BUILD_TARGET).
5#
6# Copyright (c) 2004-2007 knut st. osmundsen <fbird-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_VCC80 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting $(BUILD_TARGET).
28
29# Tool Specific Properties
30ifndef PATH_TOOL_VCC80
31 PATH_TOOL_VCC80 := $(wildcard $(PATH_DEVTOOLS_TRG)/vcc/v8*)
32 ifeq ($(PATH_TOOL_VCC80),)
33 PATH_TOOL_VCC80 := $(wildcard $(PATH_DEVTOOLS)/win.x86/vcc/v8*)
34 endif
35 ifeq ($(PATH_TOOL_VCC80),)
36 PATH_TOOL_VCC80 := $(wildcard $(PATH_DEVTOOLS)/x86.win32/vcc/v8*)
37 endif
38 ifeq ($(PATH_TOOL_VCC80),)
39 PATH_TOOL_VCC80 := $(wildcard $(PATH_DEVTOOLS)/win.amd64/vcc/v8*)
40 endif
41 ifeq ($(PATH_TOOL_VCC80),)
42 PATH_TOOL_VCC80 := $(lastword $(sort $(PATH_TOOL_VCC80)))
43 endif
44 # if not found, we'll enter 'pathless' mode.
45else
46 # Resolve any fancy stuff once and for all.
47 PATH_TOOL_VCC80 := $(PATH_TOOL_VCC80)
48endif
49ifneq ($(PATH_TOOL_VCC80),)
50 ifeq ($(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH),win.amd64)
51 PATH_TOOL_VCC80_BIN.amd64 ?= $(PATH_TOOL_VCC80)/bin/amd64
52 else
53 PATH_TOOL_VCC80_BIN.amd64 ?= $(PATH_TOOL_VCC80)/bin/x86_amd64
54 endif
55 PATH_TOOL_VCC80_BIN.x86 ?= $(PATH_TOOL_VCC80)/bin
56 PATH_TOOL_VCC80_BIN ?= $(PATH_TOOL_VCC80_BIN.$(BUILD_TARGET))
57 PATH_TOOL_VCC80_LIB.amd64 ?= $(PATH_TOOL_VCC80)/lib/amd64
58 PATH_TOOL_VCC80_LIB.x86 ?= $(PATH_TOOL_VCC80)/lib
59 PATH_TOOL_VCC80_LIB ?= $(PATH_TOOL_VCC80_LIB.$(BUILD_TARGET))
60 PATH_TOOL_VCC80_INC ?= $(PATH_TOOL_VCC80)/include
61 PATH_TOOL_VCC80_ATLMFC ?= $(PATH_TOOL_VCC80X86)/atlmfc
62 PATH_TOOL_VCC80_ATLMFC_INC ?= $(PATH_TOOL_VCC80_ATLMFC)/include
63 PATH_TOOL_VCC80_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC80_ATLMFC)/lib
64 PATH_TOOL_VCC80_ATLMFC_LIB.x86 ?= $(PATH_TOOL_VCC80_ATLMFC)/lib/amd64
65 PATH_TOOL_VCC80_ATLMFC_LIB ?= $(PATH_TOOL_VCC80_ATLMFC_LIB.$(BUILD_TARGET))
66 TOOL_VCC80_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/cl.exe
67 TOOL_VCC80_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/cl.exe
68 TOOL_VCC80_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/ml64.exe
69 TOOL_VCC80_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN.x86)/rc.exe
70 TOOL_VCC80_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/lib.exe
71 TOOL_VCC80_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/link.exe
72 TOOL_VCC80_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN.x86)/mt.exe
73else
74 # Pathless, relies on the environment.
75 TOOL_VCC80_CC ?= $(EXEC_X86_WIN32) cl.exe
76 TOOL_VCC80_CXX ?= $(EXEC_X86_WIN32) cl.exe
77 TOOL_VCC80_AS ?= $(EXEC_X86_WIN32) ml64.exe
78 TOOL_VCC80_RC ?= $(EXEC_X86_WIN32) rc.exe
79 TOOL_VCC80_AR ?= $(EXEC_X86_WIN32) lib.exe
80 TOOL_VCC80_LD ?= $(EXEC_X86_WIN32) link.exe
81 TOOL_VCC80_MT ?= $(EXEC_X86_WIN32) mt.exe
82endif
83## Disabled fast DEP_IDB based dependencies.
84#VCC80_OLD_DEPS = 1
85
86## Constructs the correct .pdb name (the name is lowercased).
87# @param $(1) Base name, no extention.
88# @param $(2) The extension.
89TOOL_VCC80_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
90
91TOOL_VCC80_COBJSUFF ?= .obj
92TOOL_VCC80_CFLAGS ?= -TC -c -nologo
93TOOL_VCC80_CFLAGS.debug ?= -Od -Zi
94TOOL_VCC80_CFLAGS.release ?= -O2
95TOOL_VCC80_CFLAGS.profile ?= -O2
96TOOL_VCC80_CINCS ?= $(PATH_TOOL_VCC80_INC)
97TOOL_VCC80_CDEFS ?=
98
99TOOL_VCC80_CXXOBJSUFF ?= .obj
100TOOL_VCC80_CXXFLAGS ?= -TP -c -nologo
101TOOL_VCC80_CXXFLAGS.debug ?= -Od -Zi
102TOOL_VCC80_CXXFLAGS.release ?= -O2
103TOOL_VCC80_CXXFLAGS.profile ?= -O2
104TOOL_VCC80_CXXINCS ?= $(PATH_TOOL_VCC80_INC) $(PATH_TOOL_VCC80_ATLMFC_INC)
105TOOL_VCC80_CXXDEFS ?=
106
107TOOL_VCC80_ASOBJSUFF ?= .obj
108
109TOOL_VCC80_RCOBJSUFF ?= .res
110TOOL_VCC80_RCINCS ?= $(PATH_TOOL_VCC80_INC) $(PATH_TOOL_VCC80_ATLMFC_INC)
111
112TOOL_VCC80_ARFLAGS.amd64 ?= -machine:amd64
113TOOL_VCC80_ARFLAGS.x86 ?= -machine:x86
114TOOL_VCC80_ARFLAGS ?= -nologo
115TOOL_VCC80_ARLIBSUFF ?= .lib
116
117TOOL_VCC80_LDFLAGS.amd64 ?= -machine:amd64
118TOOL_VCC80_LDFLAGS.x86 ?= -machine:x86
119TOOL_VCC80_LDFLAGS ?= -nologo
120TOOL_VCC80_LDFLAGS.debug ?= -debug
121TOOL_VCC80_LDFLAGS.release ?=
122TOOL_VCC80_LIBPATH.amd64 ?= $(PATH_TOOL_VCC80_LIB.amd64) $(PATH_TOOL_VCC80_ATLMFC_LIB.amd64)
123TOOL_VCC80_LIBPATH.x86 ?= $(PATH_TOOL_VCC80_LIB.x86) $(PATH_TOOL_VCC80_ATLMFC_LIB.x86)
124
125
126
127## Compile C source.
128# @param $(target) Normalized main target name.
129# @param $(source) Source filename (relative).
130# @param $(obj) Object file name. This shall be (re)created by the compilation.
131# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
132# @param $(flags) Flags.
133# @param $(defs) Definitions. No -D or something.
134# @param $(incs) Includes. No -I or something.
135# @param $(dirdep) Directory creation dependency.
136# @param $(deps) Other dependencies.
137#
138# @param $(outbase) Output basename (full). Use this for list files and such.
139# @param $(objsuff) Object suffix.
140TOOL_VCC80_COMPILE_C_DEPEND =
141TOOL_VCC80_COMPILE_C_DEPORD =
142TOOL_VCC80_COMPILE_C_OUTPUT = $(call TOOL_VCC80_PDB, $(outbase)-obj,idb)
143TOOL_VCC80_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC80_PDB, $(outbase)-obj,pdb)
144define TOOL_VCC80_COMPILE_C_CMDS
145 $(QUIET)$(TOOL_VCC80_CC) -c\
146 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
147 -Fd$(outbase)-obj.pdb \
148 -FD\
149 -Fo$(obj)\
150 $(subst /,\\,$(abspath $(source)))
151 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80_PDB,$(outbase)-obj,idb)
152endef
153
154
155## Compile C++ source.
156# @param $(target) Normalized main target name.
157# @param $(source) Source filename (relative).
158# @param $(obj) Object file name. This shall be (re)created by the compilation.
159# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
160# @param $(flags) Flags.
161# @param $(defs) Definitions. No -D or something.
162# @param $(incs) Includes. No -I or something.
163# @param $(dirdep) Directory creation dependency.
164# @param $(deps) Other dependencies.
165#
166# @param $(outbase) Output basename (full). Use this for list files and such.
167# @param $(objsuff) Object suffix.
168TOOL_VCC80_COMPILE_CXX_DEPEND =
169TOOL_VCC80_COMPILE_CXX_DEPORD =
170TOOL_VCC80_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80_PDB, $(outbase)-obj,idb)
171TOOL_VCC80_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC80_PDB, $(outbase)-obj,pdb)
172define TOOL_VCC80_COMPILE_CXX_CMDS
173 $(QUIET)$(TOOL_VCC80_CXX) -c\
174 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
175 -Fd$(outbase)-obj.pdb \
176 -FD\
177 -Fo$(obj)\
178 $(subst /,\\,$(abspath $(source)))
179 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80_PDB,$(outbase)-obj,idb)
180endef
181
182
183## Compile resource source.
184# @param $(target) Normalized main target name.
185# @param $(source) Source filename (relative).
186# @param $(obj) Object file name. This shall be (re)created by the compilation.
187# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
188# @param $(flags) Flags.
189# @param $(defs) Definitions. No -D or something.
190# @param $(incs) Includes. No -I or something.
191# @param $(dirdep) Directory creation dependency.
192# @param $(deps) Other dependencies.
193#
194# @param $(outbase) Output basename (full). Use this for list files and such.
195# @param $(objsuff) Object suffix.
196TOOL_VCC80_COMPILE_RC_OUTPUT =
197TOOL_VCC80_COMPILE_RC_DEPEND =
198TOOL_VCC80_COMPILE_RC_DEPORD =
199define TOOL_VCC80_COMPILE_RC_CMDS
200 $(QUIET)$(TOOL_VCC80_RC) \
201 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
202 /fo$(obj)\
203 $(subst /,\\,$(abspath $(source)))
204endef
205
206
207## Link library
208# @param $(target) Normalized main target name.
209# @param $(out) Library name.
210# @param $(objs) Object files to put in the library.
211# @param $(flags) Flags.
212# @param $(dirdep) Directory creation dependency.
213# @param $(deps) Other dependencies.
214# @param $(othersrc) Unhandled sources.
215# @param $(outbase) Output basename (full). Use this for list files and such.
216#
217TOOL_VCC80_LINK_LIBRARY_DEPEND = $(othersrc)
218TOOL_VCC80_LINK_LIBRARY_DEPORD =
219TOOL_VCC80_LINK_LIBRARY_OUTPUT = $(outbase).rsp
220TOOL_VCC80_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
221define TOOL_VCC80_LINK_LIBRARY_CMDS
222 $(QUIET)$(APPEND) -n $(outbase).rsp \
223 $(foreach arg,\
224 $(subst /,\\,$(objs) \
225 $(filter-out %.def,$(othersrc))) \
226 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
227 ,\"$(arg)\")
228 $(QUIET)$(TOOL_VCC80_AR) $(flags) /OUT:$(out) @$(outbase).rsp
229endef
230
231
232
233
234## Link program
235# @param $(target) Normalized main target name.
236# @param $(out) Program name.
237# @param $(objs) Object files to link together.
238# @param $(libs) Libraries to search.
239# @param $(libpath) Library search paths.
240# @param $(flags) Flags.
241# @param $(dirdep) Directory creation dependency.
242# @param $(deps) Other dependencies.
243# @param $(othersrc) Unhandled sources.
244# @param $(custom_pre) Custom step invoked before linking.
245# @param $(custom_post) Custom step invoked after linking.
246# @param $(outbase) Output basename (full). Use this for list files and such.
247#
248TOOL_VCC80_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
249TOOL_VCC80_LINK_PROGRAM_DEPORD =
250TOOL_VCC80_LINK_PROGRAM_OUTPUT = $(outbase).map
251TOOL_VCC80_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
252define TOOL_VCC80_LINK_PROGRAM_CMDS
253 $(QUIET)$(TOOL_VCC80_LD) $(flags) \
254 /OUT:$(out) \
255 /MAPINFO:EXPORTS /INCREMENTAL:NO \
256 /MAP:$(outbase).map \
257 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
258 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
259 $(foreach p,$(libpath), /LIBPATH:$(p)) \
260 $(subst /,\\,$(objs)) \
261 $(subst /,\\,$(libs))
262 $(QUIET)$(TEST) -f $(out).manifest -- \
263 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
264endef
265
266
267## Link DLL.
268# @param $(target) Normalized main target name.
269# @param $(out) DLL name.
270# @param $(objs) Object files to link together.
271# @param $(libs) Libraries to search.
272# @param $(libpath) Library search paths.
273# @param $(flags) Flags.
274# @param $(dirdep) Directory creation dependency.
275# @param $(deps) Other dependencies.
276# @param $(othersrc) Unhandled sources.
277# @param $(custom_pre) Custom step invoked before linking.
278# @param $(custom_post) Custom step invoked after linking.
279#
280# @param $(outbase) Output basename (full). Use this for list files and such.
281TOOL_VCC80_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
282TOOL_VCC80_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
283TOOL_VCC80_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp
284TOOL_VCC80_LINK_DLL_OUTPUT_MAYBE = $(outbase).pdb $(outbase).ilk $(out).manifest
285define TOOL_VCC80_LINK_DLL_CMDS
286 $(QUIET)$(TOOL_VCC80_LD) $(flags) \
287 /OUT:$(out) \
288 /IMPLIB:$(outbase).lib \
289 /MAPINFO:EXPORTS /INCREMENTAL:NO \
290 /MAP:$(outbase).map \
291 /DLL \
292 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
293 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
294 $(foreach p,$(libpath), /LIBPATH:$(p)) \
295 $(subst /,\\,$(objs)) \
296 $(subst /,\\,$(libs))
297 $(QUIET)$(TEST) -f $(out).manifest -- \
298 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
299ifeq ($(filter %.exp .def,$(othersrc)),)
300 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_LIB)/
301endif
302$(eval _DIRS += $(PATH_LIB))
303endef
304
305
306## Link system module (windows aka driver, linux aka kernel module)
307# @param $(target) Normalized main target name.
308# @param $(out) System module name.
309# @param $(objs) Object files to link together.
310# @param $(libs) Libraries to search.
311# @param $(libpath) Library search paths.
312# @param $(flags) Flags.
313# @param $(dirdep) Directory creation dependency.
314# @param $(deps) Other dependencies.
315# @param $(othersrc) Unhandled sources.
316# @param $(custom_pre) Custom step invoked before linking.
317# @param $(custom_post) Custom step invoked after linking.
318#
319# @param $(outbase) Output basename (full). Use this for list files and such.
320TOOL_VCC80_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
321TOOL_VCC80_LINK_SYSMOD_DEPORD =
322TOOL_VCC80_LINK_SYSMOD_OUTPUT = $(outbase).map
323TOOL_VCC80_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
324define TOOL_VCC80_LINK_SYSMOD_CMDS
325 $(QUIET)$(TOOL_VCC80_LD) $(flags) \
326 /OUT:$(out) \
327 /MAPINFO:EXPORTS /INCREMENTAL:NO \
328 /MAP:$(outbase).map \
329 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
330 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
331 $(foreach p,$(libpath), /LIBPATH:$(p)) \
332 $(subst /,\\,$(objs)) \
333 $(subst /,\\,$(libs))
334 $(QUIET)$(TEST) -f $(out).manifest -- \
335 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
336endef
337
Note: See TracBrowser for help on using the repository browser.