source: trunk/kBuild/tools/VCC80X86.kmk@ 703

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

ABSPATH -> abspath.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 13.4 KB
Line 
1# $Id: VCC80X86.kmk 697 2006-12-10 07:20:49Z bird $
2## @file
3#
4# kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting x86.
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_VCC80X86 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting x86.
28
29# Tool Specific Properties
30ifndef PATH_TOOL_VCC80X86
31 PATH_TOOL_VCC80X86 := $(wildcard $(PATH_DEVTOOLS)/x86.win/vcc/v8)
32 ifeq ($(PATH_TOOL_VCC80X86),)
33 PATH_TOOL_VCC80X86 := $(wildcard $(PATH_DEVTOOLS)/x86.win32/vcc/v8)
34 endif
35 ifneq ($(PATH_TOOL_VCC80X86),)
36 # done for now
37 else
38 $(warning kBuild: PATH_TOOL_VCC80X86 cannot be determined!)
39 PATH_TOOL_VCC80X86 := $(PATH_DEVTOOLS)/x86.win/vcc/v8
40 endif
41else
42 # Resolve any fancy stuff once and for all.
43 PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80X86)
44endif
45PATH_TOOL_VCC80X86_BIN ?= $(PATH_TOOL_VCC80X86)/bin
46PATH_TOOL_VCC80X86_LIB ?= $(PATH_TOOL_VCC80X86)/lib
47PATH_TOOL_VCC80X86_INC ?= $(PATH_TOOL_VCC80X86)/include
48PATH_TOOL_VCC80X86_ATLMFC ?= $(PATH_TOOL_VCC80X86)/atlmfc
49PATH_TOOL_VCC80X86_ATLMFC_INC ?= $(PATH_TOOL_VCC80X86_ATLMFC)/include
50PATH_TOOL_VCC80X86_ATLMFC_LIB ?= $(PATH_TOOL_VCC80X86_ATLMFC)/lib
51TOOL_VCC80X86_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/cl.exe
52TOOL_VCC80X86_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/cl.exe
53TOOL_VCC80X86_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/ml.exe
54TOOL_VCC80X86_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/rc.exe
55TOOL_VCC80X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/lib.exe
56TOOL_VCC80X86_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/link.exe
57TOOL_VCC80X86_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/mt.exe
58VCC80X86_NEW_DEPS = 1 ##< Enables fast DEP_IDB based dependencies.
59
60## Constructs the correct .pdb name (the name is lowercased).
61# @param $(1) Base name, no extention.
62# @param $(2) The extension.
63ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
64TOOL_VCC80X86_PDB ?= $(dir $(1))$(tolower $(notdir $(1))).$(2)
65else # this fallback is incorrect and won't work on a case sensitive FS.
66TOOL_VCC80X86_PDB ?= $(1).$(2)
67endif
68
69
70# General Properties used by kBuild
71TOOL_VCC80X86_COBJSUFF ?= .obj
72TOOL_VCC80X86_CFLAGS ?= -TC -c -nologo
73TOOL_VCC80X86_CFLAGS.debug ?= -Zi
74TOOL_VCC80X86_CFLAGS.release ?= -O2
75TOOL_VCC80X86_CFLAGS.profile ?= -O2
76TOOL_VCC80X86_CINCS ?= $(PATH_TOOL_VCC80X86_INC)
77TOOL_VCC80X86_CDEFS ?=
78
79TOOL_VCC80X86_CXXOBJSUFF ?= .obj
80TOOL_VCC80X86_CXXFLAGS ?= -TP -c -nologo
81TOOL_VCC80X86_CXXFLAGS.debug ?= -Zi
82TOOL_VCC80X86_CXXFLAGS.release ?= -O2
83TOOL_VCC80X86_CXXFLAGS.profile ?= -O2
84TOOL_VCC80X86_CXXINCS ?= $(PATH_TOOL_VCC80X86_INC) $(PATH_TOOL_VCC80X86_ATLMFC_INC)
85TOOL_VCC80X86_CXXDEFS ?=
86
87TOOL_VCC80X86_ASOBJSUFF ?= .obj
88
89TOOL_VCC80X86_RCOBJSUFF ?= .res
90TOOL_VCC80X86_RCINCS ?= $(PATH_TOOL_VCC80X86_INC) $(PATH_TOOL_VCC80X86_ATLMFC_INC)
91
92TOOL_VCC80X86_ARFLAGS ?= -nologo
93TOOL_VCC80X86_ARLIBSUFF ?= .lib
94
95TOOL_VCC80X86_LDFLAGS ?= -nologo -machine:x86
96TOOL_VCC80X86_LDFLAGS.debug ?= -debug
97TOOL_VCC80X86_LDFLAGS.release ?=
98
99
100
101## Compile C source.
102# @param $(target) Normalized main target name.
103# @param $(source) Source filename (relative).
104# @param $(obj) Object file name. This shall be (re)created by the compilation.
105# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
106# @param $(flags) Flags.
107# @param $(defs) Definitions. No -D or something.
108# @param $(incs) Includes. No -I or something.
109# @param $(dirdep) Directory creation dependency.
110# @param $(deps) Other dependencies.
111#
112# @param $(outbase) Output basename (full). Use this for list files and such.
113# @param $(objsuff) Object suffix.
114TOOL_VCC80X86_COMPILE_C_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
115TOOL_VCC80X86_COMPILE_C_DEPEND =
116TOOL_VCC80X86_COMPILE_C_DEPORD =
117ifdef VCC80X86_NEW_DEPS
118define TOOL_VCC80X86_COMPILE_C_CMDS
119 $(QUIET)$(TOOL_VCC80X86_CC) -c\
120 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
121 -Fd$(outbase)-obj.pdb \
122 -FD\
123 -Fo$(obj)\
124 $(subst /,\\,$(abspath $(source)))
125 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
126endef
127else
128define TOOL_VCC80X86_COMPILE_C_CMDS
129 $(QUIET)$(TOOL_VCC80X86_CC) -c\
130 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
131 -Fd$(outbase)-obj.pdb \
132 -Fo$(obj)\
133 $(subst /,\\,$(abspath $(source)))
134 $(QUIET)$(TOOL_VCC80X86_CC) -E\
135 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
136 $(subst /,\\,$(abspath $(source)))\
137 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
138endef
139endif
140
141
142## Compile C++ source.
143# @param $(target) Normalized main target name.
144# @param $(source) Source filename (relative).
145# @param $(obj) Object file name. This shall be (re)created by the compilation.
146# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
147# @param $(flags) Flags.
148# @param $(defs) Definitions. No -D or something.
149# @param $(incs) Includes. No -I or something.
150# @param $(dirdep) Directory creation dependency.
151# @param $(deps) Other dependencies.
152#
153# @param $(outbase) Output basename (full). Use this for list files and such.
154# @param $(objsuff) Object suffix.
155TOOL_VCC80X86_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
156TOOL_VCC80X86_COMPILE_CXX_DEPEND =
157TOOL_VCC80X86_COMPILE_CXX_DEPORD =
158ifdef VCC80X86_NEW_DEPS
159define TOOL_VCC80X86_COMPILE_CXX_CMDS
160 $(QUIET)$(TOOL_VCC80X86_CXX) -c\
161 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
162 -Fd$(outbase)-obj.pdb \
163 -FD\
164 -Fo$(obj)\
165 $(subst /,\\,$(abspath $(source)))
166 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
167endef
168else
169define TOOL_VCC80X86_COMPILE_CXX_CMDS
170 $(QUIET)$(TOOL_VCC80X86_CXX) -c\
171 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
172 -Fd$(outbase)-obj.pdb \
173 -Fo$(obj)\
174 $(subst /,\\,$(abspath $(source)))
175 $(QUIET)$(TOOL_VCC80X86_CXX) -E\
176 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
177 $(subst /,\\,$(abspath $(source)))\
178 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
179endef
180endif
181
182## @todo configure the assembler template.
183
184## Compile resource source.
185# @param $(target) Normalized main target name.
186# @param $(source) Source filename (relative).
187# @param $(obj) Object file name. This shall be (re)created by the compilation.
188# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
189# @param $(flags) Flags.
190# @param $(defs) Definitions. No -D or something.
191# @param $(incs) Includes. No -I or something.
192# @param $(dirdep) Directory creation dependency.
193# @param $(deps) Other dependencies.
194#
195# @param $(outbase) Output basename (full). Use this for list files and such.
196# @param $(objsuff) Object suffix.
197TOOL_VCC80X86_COMPILE_RC_OUTPUT =
198TOOL_VCC80X86_COMPILE_RC_DEPEND =
199TOOL_VCC80X86_COMPILE_RC_DEPORD =
200define TOOL_VCC80X86_COMPILE_RC_CMDS
201 $(QUIET)$(TOOL_VCC80X86_RC) \
202 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
203 /fo$(obj)\
204 $(subst /,\\,$(abspath $(source)))
205endef
206
207
208## Link library
209# @param $(target) Normalized main target name.
210# @param $(out) Library name.
211# @param $(objs) Object files to put in the library.
212# @param $(flags) Flags.
213# @param $(dirdep) Directory creation dependency.
214# @param $(deps) Other dependencies.
215# @param $(othersrc) Unhandled sources.
216# @param $(outbase) Output basename (full). Use this for list files and such.
217#
218TOOL_VCC80X86_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb
219TOOL_VCC80X86_LINK_LIBRARY_DEPEND = $(othersrc)
220TOOL_VCC80X86_LINK_LIBRARY_DEPORD =
221define TOOL_VCC80X86_LINK_LIBRARY_CMDS
222 $(QUIET)$(TOOL_VCC80X86_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
223 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
224endef
225
226
227## Link program
228# @param $(target) Normalized main target name.
229# @param $(out) Program name.
230# @param $(objs) Object files to link together.
231# @param $(libs) Libraries to search.
232# @param $(libpath) Library search paths.
233# @param $(flags) Flags.
234# @param $(dirdep) Directory creation dependency.
235# @param $(deps) Other dependencies.
236# @param $(othersrc) Unhandled sources.
237# @param $(custom_pre) Custom step invoked before linking.
238# @param $(custom_post) Custom step invoked after linking.
239# @param $(outbase) Output basename (full). Use this for list files and such.
240#
241TOOL_VCC80X86_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
242TOOL_VCC80X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
243TOOL_VCC80X86_LINK_PROGRAM_DEPORD =
244define TOOL_VCC80X86_LINK_PROGRAM_CMDS
245 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
246 /OUT:$(out) \
247 /MAPINFO:EXPORTS /INCREMENTAL:NO \
248 /MAP:$(outbase).map \
249 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
250 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
251 $(foreach p,$(libpath), /LIBPATH:$(p)) \
252 $(subst /,\\,$(objs)) \
253 $(subst /,\\,$(libs))
254 $(QUIET)if test -f $(out).manifest; then \
255 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)); \
256 fi
257endef
258
259
260## Link DLL.
261# @param $(target) Normalized main target name.
262# @param $(out) DLL name.
263# @param $(objs) Object files to link together.
264# @param $(libs) Libraries to search.
265# @param $(libpath) Library search paths.
266# @param $(flags) Flags.
267# @param $(dirdep) Directory creation dependency.
268# @param $(deps) Other dependencies.
269# @param $(othersrc) Unhandled sources.
270# @param $(custom_pre) Custom step invoked before linking.
271# @param $(custom_post) Custom step invoked after linking.
272#
273# @param $(outbase) Output basename (full). Use this for list files and such.
274TOOL_VCC80X86_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
275TOOL_VCC80X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
276TOOL_VCC80X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
277define TOOL_VCC80X86_LINK_DLL_CMDS
278 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
279 /OUT:$(out) \
280 /IMPLIB:$(outbase).lib \
281 /MAPINFO:EXPORTS /INCREMENTAL:NO \
282 /MAP:$(outbase).map \
283 /DLL \
284 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
285 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
286 $(foreach p,$(libpath), /LIBPATH:$(p)) \
287 $(subst /,\\,$(objs)) \
288 $(subst /,\\,$(libs))
289 $(QUIET)if test -f $(out).manifest; then \
290 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
291 fi
292ifeq ($(filter %.exp .def,$(othersrc)),)
293 $(QUIET)if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
294 $(QUIET)if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
295endif
296$(eval _DIRS += $(PATH_LIB))
297endef
298
299
300## Link system module (windows aka driver, linux aka kernel module)
301# @param $(target) Normalized main target name.
302# @param $(out) System module name.
303# @param $(objs) Object files to link together.
304# @param $(libs) Libraries to search.
305# @param $(libpath) Library search paths.
306# @param $(flags) Flags.
307# @param $(dirdep) Directory creation dependency.
308# @param $(deps) Other dependencies.
309# @param $(othersrc) Unhandled sources.
310# @param $(custom_pre) Custom step invoked before linking.
311# @param $(custom_post) Custom step invoked after linking.
312#
313# @param $(outbase) Output basename (full). Use this for list files and such.
314TOOL_VCC80X86_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
315TOOL_VCC80X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
316TOOL_VCC80X86_LINK_SYSMOD_DEPORD =
317define TOOL_VCC80X86_LINK_SYSMOD_CMDS
318 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
319 /OUT:$(out) \
320 /MAPINFO:EXPORTS /INCREMENTAL:NO \
321 /MAP:$(outbase).map \
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_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
329 fi
330endef
331
Note: See TracBrowser for help on using the repository browser.