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

Last change on this file since 1312 was 1312, checked in by bird, 18 years ago

double -> single quotes for MT so that kmk don't use the shell (;#2).

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