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

Last change on this file since 677 was 677, checked in by bird, 19 years ago

pathless VCC

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