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

Last change on this file since 827 was 819, checked in by bird, 18 years ago

More svn:eol-style fixes.

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