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

Last change on this file since 1174 was 1129, checked in by bird, 18 years ago

The PDBs are optional, put them in the MAYBE list.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 13.9 KB
Line 
1# $Id: VCC80.kmk 1129 2007-09-26 22:37:00Z 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.
89ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
90TOOL_VCC80_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
91else # this fallback is incorrect and won't work on a case sensitive FS.
92TOOL_VCC80_PDB = $(1).$(2)
93endif
94
95TOOL_VCC80_COBJSUFF ?= .obj
96TOOL_VCC80_CFLAGS ?= -TC -c -nologo
97TOOL_VCC80_CFLAGS.debug ?= -Od -Zi
98TOOL_VCC80_CFLAGS.release ?= -O2
99TOOL_VCC80_CFLAGS.profile ?= -O2
100TOOL_VCC80_CINCS ?= $(PATH_TOOL_VCC80_INC)
101TOOL_VCC80_CDEFS ?=
102
103TOOL_VCC80_CXXOBJSUFF ?= .obj
104TOOL_VCC80_CXXFLAGS ?= -TP -c -nologo
105TOOL_VCC80_CXXFLAGS.debug ?= -Od -Zi
106TOOL_VCC80_CXXFLAGS.release ?= -O2
107TOOL_VCC80_CXXFLAGS.profile ?= -O2
108TOOL_VCC80_CXXINCS ?= $(PATH_TOOL_VCC80_INC) $(PATH_TOOL_VCC80_ATLMFC_INC)
109TOOL_VCC80_CXXDEFS ?=
110
111TOOL_VCC80_ASOBJSUFF ?= .obj
112
113TOOL_VCC80_RCOBJSUFF ?= .res
114TOOL_VCC80_RCINCS ?= $(PATH_TOOL_VCC80_INC) $(PATH_TOOL_VCC80_ATLMFC_INC)
115
116TOOL_VCC80_ARFLAGS.amd64 ?= -machine:amd64
117TOOL_VCC80_ARFLAGS.x86 ?= -machine:x86
118TOOL_VCC80_ARFLAGS ?= -nologo
119TOOL_VCC80_ARLIBSUFF ?= .lib
120
121TOOL_VCC80_LDFLAGS.amd64 ?= -machine:amd64
122TOOL_VCC80_LDFLAGS.x86 ?= -machine:x86
123TOOL_VCC80_LDFLAGS ?= -nologo
124TOOL_VCC80_LDFLAGS.debug ?= -debug
125TOOL_VCC80_LDFLAGS.release ?=
126TOOL_VCC80_LIBPATH.amd64 ?= $(PATH_TOOL_VCC80_LIB.amd64) $(PATH_TOOL_VCC80_ATLMFC_LIB.amd64)
127TOOL_VCC80_LIBPATH.x86 ?= $(PATH_TOOL_VCC80_LIB.x86) $(PATH_TOOL_VCC80_ATLMFC_LIB.x86)
128
129
130
131## Compile C source.
132# @param $(target) Normalized main target name.
133# @param $(source) Source filename (relative).
134# @param $(obj) Object file name. This shall be (re)created by the compilation.
135# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
136# @param $(flags) Flags.
137# @param $(defs) Definitions. No -D or something.
138# @param $(incs) Includes. No -I or something.
139# @param $(dirdep) Directory creation dependency.
140# @param $(deps) Other dependencies.
141#
142# @param $(outbase) Output basename (full). Use this for list files and such.
143# @param $(objsuff) Object suffix.
144TOOL_VCC80_COMPILE_C_DEPEND =
145TOOL_VCC80_COMPILE_C_DEPORD =
146TOOL_VCC80_COMPILE_C_OUTPUT = $(call TOOL_VCC80_PDB, $(outbase)-obj,idb)
147TOOL_VCC80_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC80_PDB, $(outbase)-obj,pdb)
148define TOOL_VCC80_COMPILE_C_CMDS
149 $(QUIET)$(TOOL_VCC80_CC) -c\
150 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
151 -Fd$(outbase)-obj.pdb \
152 -FD\
153 -Fo$(obj)\
154 $(subst /,\\,$(abspath $(source)))
155 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80_PDB,$(outbase)-obj,idb)
156endef
157
158
159## Compile C++ source.
160# @param $(target) Normalized main target name.
161# @param $(source) Source filename (relative).
162# @param $(obj) Object file name. This shall be (re)created by the compilation.
163# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
164# @param $(flags) Flags.
165# @param $(defs) Definitions. No -D or something.
166# @param $(incs) Includes. No -I or something.
167# @param $(dirdep) Directory creation dependency.
168# @param $(deps) Other dependencies.
169#
170# @param $(outbase) Output basename (full). Use this for list files and such.
171# @param $(objsuff) Object suffix.
172TOOL_VCC80_COMPILE_CXX_DEPEND =
173TOOL_VCC80_COMPILE_CXX_DEPORD =
174TOOL_VCC80_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80_PDB, $(outbase)-obj,idb)
175TOOL_VCC80_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC80_PDB, $(outbase)-obj,pdb)
176define TOOL_VCC80_COMPILE_CXX_CMDS
177 $(QUIET)$(TOOL_VCC80_CXX) -c\
178 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
179 -Fd$(outbase)-obj.pdb \
180 -FD\
181 -Fo$(obj)\
182 $(subst /,\\,$(abspath $(source)))
183 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80_PDB,$(outbase)-obj,idb)
184endef
185
186
187## Compile resource source.
188# @param $(target) Normalized main target name.
189# @param $(source) Source filename (relative).
190# @param $(obj) Object file name. This shall be (re)created by the compilation.
191# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
192# @param $(flags) Flags.
193# @param $(defs) Definitions. No -D or something.
194# @param $(incs) Includes. No -I or something.
195# @param $(dirdep) Directory creation dependency.
196# @param $(deps) Other dependencies.
197#
198# @param $(outbase) Output basename (full). Use this for list files and such.
199# @param $(objsuff) Object suffix.
200TOOL_VCC80_COMPILE_RC_OUTPUT =
201TOOL_VCC80_COMPILE_RC_DEPEND =
202TOOL_VCC80_COMPILE_RC_DEPORD =
203define TOOL_VCC80_COMPILE_RC_CMDS
204 $(QUIET)$(TOOL_VCC80_RC) \
205 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
206 /fo$(obj)\
207 $(subst /,\\,$(abspath $(source)))
208endef
209
210
211## Link library
212# @param $(target) Normalized main target name.
213# @param $(out) Library name.
214# @param $(objs) Object files to put in the library.
215# @param $(flags) Flags.
216# @param $(dirdep) Directory creation dependency.
217# @param $(deps) Other dependencies.
218# @param $(othersrc) Unhandled sources.
219# @param $(outbase) Output basename (full). Use this for list files and such.
220#
221TOOL_VCC80_LINK_LIBRARY_DEPEND = $(othersrc)
222TOOL_VCC80_LINK_LIBRARY_DEPORD =
223TOOL_VCC80_LINK_LIBRARY_OUTPUT = $(outbase).rsp
224TOOL_VCC80_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
225define TOOL_VCC80_LINK_LIBRARY_CMDS
226 $(QUIET)$(APPEND) -n $(outbase).rsp \
227 $(foreach arg,\
228 $(subst /,\\,$(objs) \
229 $(filter-out %.def,$(othersrc))) \
230 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
231 ,\"$(arg)\")
232 $(QUIET)$(TOOL_VCC80_AR) $(flags) /OUT:$(out) @$(outbase).rsp
233endef
234
235
236
237
238## Link program
239# @param $(target) Normalized main target name.
240# @param $(out) Program name.
241# @param $(objs) Object files to link together.
242# @param $(libs) Libraries to search.
243# @param $(libpath) Library search paths.
244# @param $(flags) Flags.
245# @param $(dirdep) Directory creation dependency.
246# @param $(deps) Other dependencies.
247# @param $(othersrc) Unhandled sources.
248# @param $(custom_pre) Custom step invoked before linking.
249# @param $(custom_post) Custom step invoked after linking.
250# @param $(outbase) Output basename (full). Use this for list files and such.
251#
252TOOL_VCC80_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
253TOOL_VCC80_LINK_PROGRAM_DEPORD =
254TOOL_VCC80_LINK_PROGRAM_OUTPUT = $(outbase).map
255TOOL_VCC80_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
256define TOOL_VCC80_LINK_PROGRAM_CMDS
257 $(QUIET)$(TOOL_VCC80_LD) $(flags) \
258 /OUT:$(out) \
259 /MAPINFO:EXPORTS /INCREMENTAL:NO \
260 /MAP:$(outbase).map \
261 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
262 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
263 $(foreach p,$(libpath), /LIBPATH:$(p)) \
264 $(subst /,\\,$(objs)) \
265 $(subst /,\\,$(libs))
266 $(QUIET)if test -f $(out).manifest; then \
267 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)); \
268 fi
269endef
270
271
272## Link DLL.
273# @param $(target) Normalized main target name.
274# @param $(out) DLL name.
275# @param $(objs) Object files to link together.
276# @param $(libs) Libraries to search.
277# @param $(libpath) Library search paths.
278# @param $(flags) Flags.
279# @param $(dirdep) Directory creation dependency.
280# @param $(deps) Other dependencies.
281# @param $(othersrc) Unhandled sources.
282# @param $(custom_pre) Custom step invoked before linking.
283# @param $(custom_post) Custom step invoked after linking.
284#
285# @param $(outbase) Output basename (full). Use this for list files and such.
286TOOL_VCC80_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
287TOOL_VCC80_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
288TOOL_VCC80_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp
289TOOL_VCC80_LINK_DLL_OUTPUT_MAYBE = $(outbase).pdb $(outbase).ilk $(out).manifest
290define TOOL_VCC80_LINK_DLL_CMDS
291 $(QUIET)$(TOOL_VCC80_LD) $(flags) \
292 /OUT:$(out) \
293 /IMPLIB:$(outbase).lib \
294 /MAPINFO:EXPORTS /INCREMENTAL:NO \
295 /MAP:$(outbase).map \
296 /DLL \
297 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
298 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
299 $(foreach p,$(libpath), /LIBPATH:$(p)) \
300 $(subst /,\\,$(objs)) \
301 $(subst /,\\,$(libs))
302 $(QUIET)if test -f $(out).manifest; then \
303 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
304 fi
305ifeq ($(filter %.exp .def,$(othersrc)),)
306 $(QUIET)if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
307 $(QUIET)if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
308endif
309$(eval _DIRS += $(PATH_LIB))
310endef
311
312
313## Link system module (windows aka driver, linux aka kernel module)
314# @param $(target) Normalized main target name.
315# @param $(out) System module name.
316# @param $(objs) Object files to link together.
317# @param $(libs) Libraries to search.
318# @param $(libpath) Library search paths.
319# @param $(flags) Flags.
320# @param $(dirdep) Directory creation dependency.
321# @param $(deps) Other dependencies.
322# @param $(othersrc) Unhandled sources.
323# @param $(custom_pre) Custom step invoked before linking.
324# @param $(custom_post) Custom step invoked after linking.
325#
326# @param $(outbase) Output basename (full). Use this for list files and such.
327TOOL_VCC80_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
328TOOL_VCC80_LINK_SYSMOD_DEPORD =
329TOOL_VCC80_LINK_SYSMOD_OUTPUT = $(outbase).map
330TOOL_VCC80_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
331define TOOL_VCC80_LINK_SYSMOD_CMDS
332 $(QUIET)$(TOOL_VCC80_LD) $(flags) \
333 /OUT:$(out) \
334 /MAPINFO:EXPORTS /INCREMENTAL:NO \
335 /MAP:$(outbase).map \
336 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
337 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
338 $(foreach p,$(libpath), /LIBPATH:$(p)) \
339 $(subst /,\\,$(objs)) \
340 $(subst /,\\,$(libs))
341 $(QUIET)if test -f $(out).manifest; then \
342 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
343 fi
344endef
345
Note: See TracBrowser for help on using the repository browser.