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

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

copyright 2007

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 14.0 KB
Line 
1# $Id: VCC80X86.kmk 782 2007-01-24 20:19:57Z 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-2007 knut st. osmundsen <bird-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_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_DEPEND = $(othersrc)
226TOOL_VCC80X86_LINK_LIBRARY_DEPORD =
227ifeq ($(filter append-dash-n,$(KMK_FEATURES)),append-dash-n)
228TOOL_VCC80X86_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb $(outbase).rsp
229define TOOL_VCC80X86_LINK_LIBRARY_CMDS
230 $(QUIET)$(APPEND) -n $(outbase).rsp \
231 $(foreach arg,\
232 $(subst /,\\,$(objs) \
233 $(filter-out %.def,$(othersrc))) \
234 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
235 ,\"$(arg)\")
236 $(QUIET)$(TOOL_VCC80X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
237endef
238else
239TOOL_VCC80X86_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb
240define TOOL_VCC80X86_LINK_LIBRARY_CMDS
241 $(QUIET)$(TOOL_VCC80X86_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
242 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
243endef
244endif
245
246
247## Link program
248# @param $(target) Normalized main target name.
249# @param $(out) Program name.
250# @param $(objs) Object files to link together.
251# @param $(libs) Libraries to search.
252# @param $(libpath) Library search paths.
253# @param $(flags) Flags.
254# @param $(dirdep) Directory creation dependency.
255# @param $(deps) Other dependencies.
256# @param $(othersrc) Unhandled sources.
257# @param $(custom_pre) Custom step invoked before linking.
258# @param $(custom_post) Custom step invoked after linking.
259# @param $(outbase) Output basename (full). Use this for list files and such.
260#
261TOOL_VCC80X86_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
262TOOL_VCC80X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
263TOOL_VCC80X86_LINK_PROGRAM_DEPORD =
264define TOOL_VCC80X86_LINK_PROGRAM_CMDS
265 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
266 /OUT:$(out) \
267 /MAPINFO:EXPORTS /INCREMENTAL:NO \
268 /MAP:$(outbase).map \
269 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
270 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
271 $(foreach p,$(libpath), /LIBPATH:$(p)) \
272 $(subst /,\\,$(objs)) \
273 $(subst /,\\,$(libs))
274 $(QUIET)if test -f $(out).manifest; then \
275 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)); \
276 fi
277endef
278
279
280## Link DLL.
281# @param $(target) Normalized main target name.
282# @param $(out) DLL name.
283# @param $(objs) Object files to link together.
284# @param $(libs) Libraries to search.
285# @param $(libpath) Library search paths.
286# @param $(flags) Flags.
287# @param $(dirdep) Directory creation dependency.
288# @param $(deps) Other dependencies.
289# @param $(othersrc) Unhandled sources.
290# @param $(custom_pre) Custom step invoked before linking.
291# @param $(custom_post) Custom step invoked after linking.
292#
293# @param $(outbase) Output basename (full). Use this for list files and such.
294TOOL_VCC80X86_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
295TOOL_VCC80X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
296TOOL_VCC80X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
297define TOOL_VCC80X86_LINK_DLL_CMDS
298 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
299 /OUT:$(out) \
300 /IMPLIB:$(outbase).lib \
301 /MAPINFO:EXPORTS /INCREMENTAL:NO \
302 /MAP:$(outbase).map \
303 /DLL \
304 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
305 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
306 $(foreach p,$(libpath), /LIBPATH:$(p)) \
307 $(subst /,\\,$(objs)) \
308 $(subst /,\\,$(libs))
309 $(QUIET)if test -f $(out).manifest; then \
310 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
311 fi
312ifeq ($(filter %.exp .def,$(othersrc)),)
313 $(QUIET)if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
314 $(QUIET)if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
315endif
316$(eval _DIRS += $(PATH_LIB))
317endef
318
319
320## Link system module (windows aka driver, linux aka kernel module)
321# @param $(target) Normalized main target name.
322# @param $(out) System module name.
323# @param $(objs) Object files to link together.
324# @param $(libs) Libraries to search.
325# @param $(libpath) Library search paths.
326# @param $(flags) Flags.
327# @param $(dirdep) Directory creation dependency.
328# @param $(deps) Other dependencies.
329# @param $(othersrc) Unhandled sources.
330# @param $(custom_pre) Custom step invoked before linking.
331# @param $(custom_post) Custom step invoked after linking.
332#
333# @param $(outbase) Output basename (full). Use this for list files and such.
334TOOL_VCC80X86_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
335TOOL_VCC80X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
336TOOL_VCC80X86_LINK_SYSMOD_DEPORD =
337define TOOL_VCC80X86_LINK_SYSMOD_CMDS
338 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
339 /OUT:$(out) \
340 /MAPINFO:EXPORTS /INCREMENTAL:NO \
341 /MAP:$(outbase).map \
342 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
343 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
344 $(foreach p,$(libpath), /LIBPATH:$(p)) \
345 $(subst /,\\,$(objs)) \
346 $(subst /,\\,$(libs))
347 $(QUIET)if test -f $(out).manifest; then \
348 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
349 fi
350endef
351
Note: See TracBrowser for help on using the repository browser.