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