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

Last change on this file since 897 was 857, checked in by bird, 18 years ago

Select v8*.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 14.9 KB
Line 
1# $Id: VCC80.kmk 857 2007-03-28 22:36:57Z 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_OUTPUT = $(call TOOL_VCC80_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80_PDB, $(outbase)-obj,idb)
145TOOL_VCC80_COMPILE_C_DEPEND =
146TOOL_VCC80_COMPILE_C_DEPORD =
147ifndef VCC80_OLD_DEPS
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
157else
158define TOOL_VCC80_COMPILE_C_CMDS
159 $(QUIET)$(TOOL_VCC80_CC) -c\
160 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
161 -Fd$(outbase)-obj.pdb \
162 -Fo$(obj)\
163 $(subst /,\\,$(abspath $(source)))
164 $(QUIET)$(TOOL_VCC80_CC) -E\
165 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
166 $(subst /,\\,$(abspath $(source)))\
167 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
168endef
169endif
170
171
172## Compile C++ source.
173# @param $(target) Normalized main target name.
174# @param $(source) Source filename (relative).
175# @param $(obj) Object file name. This shall be (re)created by the compilation.
176# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
177# @param $(flags) Flags.
178# @param $(defs) Definitions. No -D or something.
179# @param $(incs) Includes. No -I or something.
180# @param $(dirdep) Directory creation dependency.
181# @param $(deps) Other dependencies.
182#
183# @param $(outbase) Output basename (full). Use this for list files and such.
184# @param $(objsuff) Object suffix.
185TOOL_VCC80_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80_PDB, $(outbase)-obj,idb)
186TOOL_VCC80_COMPILE_CXX_DEPEND =
187TOOL_VCC80_COMPILE_CXX_DEPORD =
188ifndef VCC80_OLD_DEPS
189define TOOL_VCC80_COMPILE_CXX_CMDS
190 $(QUIET)$(TOOL_VCC80_CXX) -c\
191 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
192 -Fd$(outbase)-obj.pdb \
193 -FD\
194 -Fo$(obj)\
195 $(subst /,\\,$(abspath $(source)))
196 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80_PDB,$(outbase)-obj,idb)
197endef
198else
199define TOOL_VCC80_COMPILE_CXX_CMDS
200 $(QUIET)$(TOOL_VCC80_CXX) -c\
201 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
202 -Fd$(outbase)-obj.pdb \
203 -Fo$(obj)\
204 $(subst /,\\,$(abspath $(source)))
205 $(QUIET)$(TOOL_VCC80_CXX) -E\
206 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
207 $(subst /,\\,$(abspath $(source)))\
208 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
209endef
210endif
211
212
213## Compile resource source.
214# @param $(target) Normalized main target name.
215# @param $(source) Source filename (relative).
216# @param $(obj) Object file name. This shall be (re)created by the compilation.
217# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
218# @param $(flags) Flags.
219# @param $(defs) Definitions. No -D or something.
220# @param $(incs) Includes. No -I or something.
221# @param $(dirdep) Directory creation dependency.
222# @param $(deps) Other dependencies.
223#
224# @param $(outbase) Output basename (full). Use this for list files and such.
225# @param $(objsuff) Object suffix.
226TOOL_VCC80_COMPILE_RC_OUTPUT =
227TOOL_VCC80_COMPILE_RC_DEPEND =
228TOOL_VCC80_COMPILE_RC_DEPORD =
229define TOOL_VCC80_COMPILE_RC_CMDS
230 $(QUIET)$(TOOL_VCC80_RC) \
231 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
232 /fo$(obj)\
233 $(subst /,\\,$(abspath $(source)))
234endef
235
236
237## Link library
238# @param $(target) Normalized main target name.
239# @param $(out) Library name.
240# @param $(objs) Object files to put in the library.
241# @param $(flags) Flags.
242# @param $(dirdep) Directory creation dependency.
243# @param $(deps) Other dependencies.
244# @param $(othersrc) Unhandled sources.
245# @param $(outbase) Output basename (full). Use this for list files and such.
246#
247TOOL_VCC80_LINK_LIBRARY_DEPEND = $(othersrc)
248TOOL_VCC80_LINK_LIBRARY_DEPORD =
249ifeq ($(filter append-dash-n,$(KMK_FEATURES)),append-dash-n)
250TOOL_VCC80_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb $(outbase).rsp
251define TOOL_VCC80_LINK_LIBRARY_CMDS
252 $(QUIET)$(APPEND) -n $(outbase).rsp \
253 $(foreach arg,\
254 $(subst /,\\,$(objs) \
255 $(filter-out %.def,$(othersrc))) \
256 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
257 ,\"$(arg)\")
258 $(QUIET)$(TOOL_VCC80_AR) $(flags) /OUT:$(out) @$(outbase).rsp
259endef
260else
261TOOL_VCC80_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb
262define TOOL_VCC80_LINK_LIBRARY_CMDS
263 $(QUIET)$(TOOL_VCC80_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
264 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
265endef
266endif
267
268
269
270
271## Link program
272# @param $(target) Normalized main target name.
273# @param $(out) Program name.
274# @param $(objs) Object files to link together.
275# @param $(libs) Libraries to search.
276# @param $(libpath) Library search paths.
277# @param $(flags) Flags.
278# @param $(dirdep) Directory creation dependency.
279# @param $(deps) Other dependencies.
280# @param $(othersrc) Unhandled sources.
281# @param $(custom_pre) Custom step invoked before linking.
282# @param $(custom_post) Custom step invoked after linking.
283# @param $(outbase) Output basename (full). Use this for list files and such.
284#
285TOOL_VCC80_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
286TOOL_VCC80_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
287TOOL_VCC80_LINK_PROGRAM_DEPORD =
288define TOOL_VCC80_LINK_PROGRAM_CMDS
289 $(QUIET)$(TOOL_VCC80_LD) $(flags) \
290 /OUT:$(out) \
291 /MAPINFO:EXPORTS /INCREMENTAL:NO \
292 /MAP:$(outbase).map \
293 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
294 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
295 $(foreach p,$(libpath), /LIBPATH:$(p)) \
296 $(subst /,\\,$(objs)) \
297 $(subst /,\\,$(libs))
298 $(QUIET)if test -f $(out).manifest; then \
299 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)); \
300 fi
301endef
302
303
304## Link DLL.
305# @param $(target) Normalized main target name.
306# @param $(out) DLL name.
307# @param $(objs) Object files to link together.
308# @param $(libs) Libraries to search.
309# @param $(libpath) Library search paths.
310# @param $(flags) Flags.
311# @param $(dirdep) Directory creation dependency.
312# @param $(deps) Other dependencies.
313# @param $(othersrc) Unhandled sources.
314# @param $(custom_pre) Custom step invoked before linking.
315# @param $(custom_post) Custom step invoked after linking.
316#
317# @param $(outbase) Output basename (full). Use this for list files and such.
318TOOL_VCC80_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
319TOOL_VCC80_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
320TOOL_VCC80_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
321define TOOL_VCC80_LINK_DLL_CMDS
322 $(QUIET)$(TOOL_VCC80_LD) $(flags) \
323 /OUT:$(out) \
324 /IMPLIB:$(outbase).lib \
325 /MAPINFO:EXPORTS /INCREMENTAL:NO \
326 /MAP:$(outbase).map \
327 /DLL \
328 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
329 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
330 $(foreach p,$(libpath), /LIBPATH:$(p)) \
331 $(subst /,\\,$(objs)) \
332 $(subst /,\\,$(libs))
333 $(QUIET)if test -f $(out).manifest; then \
334 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
335 fi
336ifeq ($(filter %.exp .def,$(othersrc)),)
337 $(QUIET)if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
338 $(QUIET)if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
339endif
340$(eval _DIRS += $(PATH_LIB))
341endef
342
343
344## Link system module (windows aka driver, linux aka kernel module)
345# @param $(target) Normalized main target name.
346# @param $(out) System module name.
347# @param $(objs) Object files to link together.
348# @param $(libs) Libraries to search.
349# @param $(libpath) Library search paths.
350# @param $(flags) Flags.
351# @param $(dirdep) Directory creation dependency.
352# @param $(deps) Other dependencies.
353# @param $(othersrc) Unhandled sources.
354# @param $(custom_pre) Custom step invoked before linking.
355# @param $(custom_post) Custom step invoked after linking.
356#
357# @param $(outbase) Output basename (full). Use this for list files and such.
358TOOL_VCC80_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
359TOOL_VCC80_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
360TOOL_VCC80_LINK_SYSMOD_DEPORD =
361define TOOL_VCC80_LINK_SYSMOD_CMDS
362 $(QUIET)$(TOOL_VCC80_LD) $(flags) \
363 /OUT:$(out) \
364 /MAPINFO:EXPORTS /INCREMENTAL:NO \
365 /MAP:$(outbase).map \
366 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
367 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
368 $(foreach p,$(libpath), /LIBPATH:$(p)) \
369 $(subst /,\\,$(objs)) \
370 $(subst /,\\,$(libs))
371 $(QUIET)if test -f $(out).manifest; then \
372 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
373 fi
374endef
375
Note: See TracBrowser for help on using the repository browser.