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

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

VCC*_OLD_DEPS

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