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

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

Fixed some x86.win* & amd64.win* leftovers.

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