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

Last change on this file since 2413 was 2413, checked in by bird, 15 years ago

copyright year update.

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