source: trunk/kBuild/tools/VCC80.kmk@ 1612

Last change on this file since 1612 was 1547, checked in by bird, 17 years ago

License clearification.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 14.1 KB
Line 
1# $Id: VCC80.kmk 1547 2008-04-22 02:02:09Z bird $
2## @file
3# kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting $(KBUILD_TARGET).
4#
5
6#
7# Copyright (c) 2004-2008 knut st. osmundsen <bird-kBuild-spam@anduin.net>
8#
9#
10# This file is part of kBuild.
11#
12# kBuild is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# kBuild is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with kBuild; if not, write to the Free Software
24# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25#
26#
27# As a special exception you are granted permission to include this file, via
28# the kmk include directive, as you wish without this in itself causing the
29# resulting makefile, program or whatever to be covered by the GPL license.
30# This exception does not however invalidate any other reasons why the makefile,
31# program, whatever should not be covered the GPL.
32#
33#
34
35TOOL_VCC80 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting $(KBUILD_TARGET).
36
37# Tool Specific Properties
38ifndef PATH_TOOL_VCC80
39 PATH_TOOL_VCC80 := $(wildcard $(PATH_DEVTOOLS_TRG)/vcc/v8*)
40 ifeq ($(PATH_TOOL_VCC80),)
41 PATH_TOOL_VCC80 := $(wildcard $(PATH_DEVTOOLS)/win.x86/vcc/v8*)
42 endif
43 ifeq ($(PATH_TOOL_VCC80),)
44 PATH_TOOL_VCC80 := $(wildcard $(PATH_DEVTOOLS)/x86.win32/vcc/v8*)
45 endif
46 ifeq ($(PATH_TOOL_VCC80),)
47 PATH_TOOL_VCC80 := $(wildcard $(PATH_DEVTOOLS)/win.amd64/vcc/v8*)
48 endif
49 ifeq ($(PATH_TOOL_VCC80),)
50 PATH_TOOL_VCC80 := $(lastword $(sort $(PATH_TOOL_VCC80)))
51 endif
52 # if not found, we'll enter 'pathless' mode.
53else
54 # Resolve any fancy stuff once and for all.
55 PATH_TOOL_VCC80 := $(PATH_TOOL_VCC80)
56endif
57ifneq ($(PATH_TOOL_VCC80),)
58 ifeq ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
59 PATH_TOOL_VCC80_BIN.amd64 ?= $(PATH_TOOL_VCC80)/bin/amd64
60 else
61 PATH_TOOL_VCC80_BIN.amd64 ?= $(PATH_TOOL_VCC80)/bin/x86_amd64
62 endif
63 PATH_TOOL_VCC80_BIN.x86 ?= $(PATH_TOOL_VCC80)/bin
64 PATH_TOOL_VCC80_BIN ?= $(PATH_TOOL_VCC80_BIN.$(KBUILD_TARGET))
65 PATH_TOOL_VCC80_LIB.amd64 ?= $(PATH_TOOL_VCC80)/lib/amd64
66 PATH_TOOL_VCC80_LIB.x86 ?= $(PATH_TOOL_VCC80)/lib
67 PATH_TOOL_VCC80_LIB ?= $(PATH_TOOL_VCC80_LIB.$(KBUILD_TARGET))
68 PATH_TOOL_VCC80_INC ?= $(PATH_TOOL_VCC80)/include
69 PATH_TOOL_VCC80_ATLMFC ?= $(PATH_TOOL_VCC80X86)/atlmfc
70 PATH_TOOL_VCC80_ATLMFC_INC ?= $(PATH_TOOL_VCC80_ATLMFC)/include
71 PATH_TOOL_VCC80_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC80_ATLMFC)/lib
72 PATH_TOOL_VCC80_ATLMFC_LIB.x86 ?= $(PATH_TOOL_VCC80_ATLMFC)/lib/amd64
73 PATH_TOOL_VCC80_ATLMFC_LIB ?= $(PATH_TOOL_VCC80_ATLMFC_LIB.$(KBUILD_TARGET))
74 TOOL_VCC80_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/cl.exe
75 TOOL_VCC80_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/cl.exe
76 TOOL_VCC80_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/ml64.exe
77 TOOL_VCC80_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN.x86)/rc.exe
78 TOOL_VCC80_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/lib.exe
79 TOOL_VCC80_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN)/link.exe
80 TOOL_VCC80_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80_BIN.x86)/mt.exe
81else
82 # Pathless, relies on the environment.
83 TOOL_VCC80_CC ?= $(EXEC_X86_WIN32) cl.exe
84 TOOL_VCC80_CXX ?= $(EXEC_X86_WIN32) cl.exe
85 TOOL_VCC80_AS ?= $(EXEC_X86_WIN32) ml64.exe
86 TOOL_VCC80_RC ?= $(EXEC_X86_WIN32) rc.exe
87 TOOL_VCC80_AR ?= $(EXEC_X86_WIN32) lib.exe
88 TOOL_VCC80_LD ?= $(EXEC_X86_WIN32) link.exe
89 TOOL_VCC80_MT ?= $(EXEC_X86_WIN32) mt.exe
90endif
91## Disabled fast DEP_IDB based dependencies.
92#VCC80_OLD_DEPS = 1
93
94## Constructs the correct .pdb name (the name is lowercased).
95# @param $(1) Base name, no extention.
96# @param $(2) The extension.
97TOOL_VCC80_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
98
99TOOL_VCC80_COBJSUFF ?= .obj
100TOOL_VCC80_CFLAGS ?= -TC -c -nologo
101TOOL_VCC80_CFLAGS.debug ?= -Od -Zi
102TOOL_VCC80_CFLAGS.release ?= -O2
103TOOL_VCC80_CFLAGS.profile ?= -O2
104TOOL_VCC80_CINCS ?= $(PATH_TOOL_VCC80_INC)
105TOOL_VCC80_CDEFS ?=
106
107TOOL_VCC80_CXXOBJSUFF ?= .obj
108TOOL_VCC80_CXXFLAGS ?= -TP -c -nologo
109TOOL_VCC80_CXXFLAGS.debug ?= -Od -Zi
110TOOL_VCC80_CXXFLAGS.release ?= -O2
111TOOL_VCC80_CXXFLAGS.profile ?= -O2
112TOOL_VCC80_CXXINCS ?= $(PATH_TOOL_VCC80_INC) $(PATH_TOOL_VCC80_ATLMFC_INC)
113TOOL_VCC80_CXXDEFS ?=
114
115TOOL_VCC80_ASOBJSUFF ?= .obj
116
117TOOL_VCC80_RCOBJSUFF ?= .res
118TOOL_VCC80_RCINCS ?= $(PATH_TOOL_VCC80_INC) $(PATH_TOOL_VCC80_ATLMFC_INC)
119
120TOOL_VCC80_ARFLAGS.amd64 ?= -machine:amd64
121TOOL_VCC80_ARFLAGS.x86 ?= -machine:x86
122TOOL_VCC80_ARFLAGS ?= -nologo
123TOOL_VCC80_ARLIBSUFF ?= .lib
124
125TOOL_VCC80_LDFLAGS.amd64 ?= -machine:amd64
126TOOL_VCC80_LDFLAGS.x86 ?= -machine:x86
127TOOL_VCC80_LDFLAGS ?= -nologo
128TOOL_VCC80_LDFLAGS.debug ?= -debug
129TOOL_VCC80_LDFLAGS.release ?=
130TOOL_VCC80_LIBPATH.amd64 ?= $(PATH_TOOL_VCC80_LIB.amd64) $(PATH_TOOL_VCC80_ATLMFC_LIB.amd64)
131TOOL_VCC80_LIBPATH.x86 ?= $(PATH_TOOL_VCC80_LIB.x86) $(PATH_TOOL_VCC80_ATLMFC_LIB.x86)
132
133
134
135## Compile C source.
136# @param $(target) Normalized main target name.
137# @param $(source) Source filename (relative).
138# @param $(obj) Object file name. This shall be (re)created by the compilation.
139# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
140# @param $(flags) Flags.
141# @param $(defs) Definitions. No -D or something.
142# @param $(incs) Includes. No -I or something.
143# @param $(dirdep) Directory creation dependency.
144# @param $(deps) Other dependencies.
145#
146# @param $(outbase) Output basename (full). Use this for list files and such.
147# @param $(objsuff) Object suffix.
148TOOL_VCC80_COMPILE_C_DEPEND =
149TOOL_VCC80_COMPILE_C_DEPORD =
150TOOL_VCC80_COMPILE_C_OUTPUT = $(call TOOL_VCC80_PDB, $(outbase)-obj,idb)
151TOOL_VCC80_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC80_PDB, $(outbase)-obj,pdb)
152define TOOL_VCC80_COMPILE_C_CMDS
153 $(QUIET)$(TOOL_VCC80_CC) -c\
154 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
155 -Fd$(outbase)-obj.pdb \
156 -FD\
157 -Fo$(obj)\
158 $(subst /,\\,$(abspath $(source)))
159 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80_PDB,$(outbase)-obj,idb)
160endef
161
162
163## Compile C++ source.
164# @param $(target) Normalized main target name.
165# @param $(source) Source filename (relative).
166# @param $(obj) Object file name. This shall be (re)created by the compilation.
167# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
168# @param $(flags) Flags.
169# @param $(defs) Definitions. No -D or something.
170# @param $(incs) Includes. No -I or something.
171# @param $(dirdep) Directory creation dependency.
172# @param $(deps) Other dependencies.
173#
174# @param $(outbase) Output basename (full). Use this for list files and such.
175# @param $(objsuff) Object suffix.
176TOOL_VCC80_COMPILE_CXX_DEPEND =
177TOOL_VCC80_COMPILE_CXX_DEPORD =
178TOOL_VCC80_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80_PDB, $(outbase)-obj,idb)
179TOOL_VCC80_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC80_PDB, $(outbase)-obj,pdb)
180define TOOL_VCC80_COMPILE_CXX_CMDS
181 $(QUIET)$(TOOL_VCC80_CXX) -c\
182 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
183 -Fd$(outbase)-obj.pdb \
184 -FD\
185 -Fo$(obj)\
186 $(subst /,\\,$(abspath $(source)))
187 $(QUIET)$(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80_PDB,$(outbase)-obj,idb)
188endef
189
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_VCC80_COMPILE_RC_OUTPUT =
205TOOL_VCC80_COMPILE_RC_DEPEND =
206TOOL_VCC80_COMPILE_RC_DEPORD =
207define TOOL_VCC80_COMPILE_RC_CMDS
208 $(QUIET)$(TOOL_VCC80_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_VCC80_LINK_LIBRARY_DEPEND = $(othersrc)
226TOOL_VCC80_LINK_LIBRARY_DEPORD =
227TOOL_VCC80_LINK_LIBRARY_OUTPUT = $(outbase).rsp
228TOOL_VCC80_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
229define TOOL_VCC80_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_VCC80_AR) $(flags) /OUT:$(out) @$(outbase).rsp
237endef
238
239
240
241
242## Link program
243# @param $(target) Normalized main target name.
244# @param $(out) Program name.
245# @param $(objs) Object files to link together.
246# @param $(libs) Libraries to search.
247# @param $(libpath) Library search paths.
248# @param $(flags) Flags.
249# @param $(dirdep) Directory creation dependency.
250# @param $(deps) Other dependencies.
251# @param $(othersrc) Unhandled sources.
252# @param $(custom_pre) Custom step invoked before linking.
253# @param $(custom_post) Custom step invoked after linking.
254# @param $(outbase) Output basename (full). Use this for list files and such.
255#
256TOOL_VCC80_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
257TOOL_VCC80_LINK_PROGRAM_DEPORD =
258TOOL_VCC80_LINK_PROGRAM_OUTPUT = $(outbase).map
259TOOL_VCC80_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
260define TOOL_VCC80_LINK_PROGRAM_CMDS
261 $(QUIET)$(TOOL_VCC80_LD) $(flags) \
262 /OUT:$(out) \
263 /MAPINFO:EXPORTS /INCREMENTAL:NO \
264 /MAP:$(outbase).map \
265 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
266 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
267 $(foreach p,$(libpath), /LIBPATH:$(p)) \
268 $(subst /,\\,$(objs)) \
269 $(subst /,\\,$(libs))
270 $(QUIET)$(TEST) -f $(out).manifest -- \
271 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
272endef
273
274
275## Link DLL.
276# @param $(target) Normalized main target name.
277# @param $(out) DLL name.
278# @param $(objs) Object files to link together.
279# @param $(libs) Libraries to search.
280# @param $(libpath) Library search paths.
281# @param $(flags) Flags.
282# @param $(dirdep) Directory creation dependency.
283# @param $(deps) Other dependencies.
284# @param $(othersrc) Unhandled sources.
285# @param $(custom_pre) Custom step invoked before linking.
286# @param $(custom_post) Custom step invoked after linking.
287#
288# @param $(outbase) Output basename (full). Use this for list files and such.
289TOOL_VCC80_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
290TOOL_VCC80_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
291TOOL_VCC80_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp
292TOOL_VCC80_LINK_DLL_OUTPUT_MAYBE = $(outbase).pdb $(outbase).ilk $(out).manifest
293define TOOL_VCC80_LINK_DLL_CMDS
294 $(QUIET)$(TOOL_VCC80_LD) $(flags) \
295 /OUT:$(out) \
296 /IMPLIB:$(outbase).lib \
297 /MAPINFO:EXPORTS /INCREMENTAL:NO \
298 /MAP:$(outbase).map \
299 /DLL \
300 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
301 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
302 $(foreach p,$(libpath), /LIBPATH:$(p)) \
303 $(subst /,\\,$(objs)) \
304 $(subst /,\\,$(libs))
305 $(QUIET)$(TEST) -f $(out).manifest -- \
306 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
307ifeq ($(filter %.exp .def,$(othersrc)),)
308 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_LIB)/
309endif
310$(eval _DIRS += $(PATH_LIB))
311endef
312
313
314## Link system module (windows aka driver, linux aka kernel module)
315# @param $(target) Normalized main target name.
316# @param $(out) System module name.
317# @param $(objs) Object files to link together.
318# @param $(libs) Libraries to search.
319# @param $(libpath) Library search paths.
320# @param $(flags) Flags.
321# @param $(dirdep) Directory creation dependency.
322# @param $(deps) Other dependencies.
323# @param $(othersrc) Unhandled sources.
324# @param $(custom_pre) Custom step invoked before linking.
325# @param $(custom_post) Custom step invoked after linking.
326#
327# @param $(outbase) Output basename (full). Use this for list files and such.
328TOOL_VCC80_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
329TOOL_VCC80_LINK_SYSMOD_DEPORD =
330TOOL_VCC80_LINK_SYSMOD_OUTPUT = $(outbase).map
331TOOL_VCC80_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
332define TOOL_VCC80_LINK_SYSMOD_CMDS
333 $(QUIET)$(TOOL_VCC80_LD) $(flags) \
334 /OUT:$(out) \
335 /MAPINFO:EXPORTS /INCREMENTAL:NO \
336 /MAP:$(outbase).map \
337 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
338 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
339 $(foreach p,$(libpath), /LIBPATH:$(p)) \
340 $(subst /,\\,$(objs)) \
341 $(subst /,\\,$(libs))
342 $(QUIET)$(TEST) -f $(out).manifest -- \
343 $(TOOL_VCC80_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
344endef
345
Note: See TracBrowser for help on using the repository browser.