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

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

link emits correctly cased .pdbs.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.5 KB
Line 
1# $Id: VCC80X86.kmk 642 2006-12-01 20:04:27Z bird $
2## @file
3#
4# kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14)
5#
6# Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@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
27
28TOOL_VCC80X86 := Visual C++ 8.0 x86
29PATH_TOOL_VCC80X86 ?= $(PATH_DEV)/x86.win32/vcc/v8
30PATH_TOOL_VCC80X86_LIB ?= $(PATH_TOOL_VCC80X86)/lib
31PATH_TOOL_VCC80X86_BIN ?= $(PATH_TOOL_VCC80X86)/bin
32
33TOOL_VCC80X86_CC := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/cl.exe
34TOOL_VCC80X86_COBJSUFF := .obj
35TOOL_VCC80X86_CFLAGS := -TC -c -nologo
36TOOL_VCC80X86_CFLAGS.debug := -Zi
37TOOL_VCC80X86_CFLAGS.release := -O2
38TOOL_VCC80X86_CFLAGS.profile := -O2
39TOOL_VCC80X86_CINCS := $(PATH_TOOL_VCC80X86)/include
40TOOL_VCC80X86_CDEFS :=
41
42TOOL_VCC80X86_CXX := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/cl.exe
43TOOL_VCC80X86_CXXOBJSUFF := .obj
44TOOL_VCC80X86_CXXFLAGS := -TP -c -nologo
45TOOL_VCC80X86_CXXFLAGS.debug := -Zi
46TOOL_VCC80X86_CXXFLAGS.release := -O2
47TOOL_VCC80X86_CXXFLAGS.profile := -O2
48TOOL_VCC80X86_CXXINCS := $(PATH_TOOL_VCC80X86)/include
49TOOL_VCC80X86_CXXDEFS :=
50
51TOOL_VCC80X86_AS := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/ml.exe
52TOOL_VCC80X86_ASOBJSUFF := .obj
53
54TOOL_VCC80X86_RC := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/rc.exe
55TOOL_VCC80X86_RCOBJSUFF := .res
56
57TOOL_VCC80X86_AR := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/lib.exe
58TOOL_VCC80X86_ARFLAGS := -nologo
59TOOL_VCC80X86_ARLIBSUFF := .lib
60
61TOOL_VCC80X86_LD := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/link.exe
62TOOL_VCC80X86_LDFLAGS := -nologo -machine:x86
63TOOL_VCC80X86_LDFLAGS.debug := -debug
64TOOL_VCC80X86_LDFLAGS.release :=
65
66TOOL_VCC80X86_MT := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/mt.exe
67
68## Constructs the correct .pdb name (the name is lowercased).
69# @param $(1) Base name, no extention.
70# @param $(2) The extension.
71ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
72TOOL_VCC80X86_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
73else # this fallback is incorrect and won't work on a case sensitive FS.
74TOOL_VCC80X86_PDB = $(1).$(2)
75endif
76
77
78#ifeq ($(BUILD_PLATFORM),win32)
79VCC80X86_NEW_DEPS = 1
80#endif
81
82
83
84## Compile C source.
85# @param $(target) Normalized main target name.
86# @param $(source) Source filename (relative).
87# @param $(obj) Object file name. This shall be (re)created by the compilation.
88# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
89# @param $(flags) Flags.
90# @param $(defs) Definitions. No -D or something.
91# @param $(incs) Includes. No -I or something.
92# @param $(dirdep) Directory creation dependency.
93# @param $(deps) Other dependencies.
94#
95# @param $(outbase) Output basename (full). Use this for list files and such.
96# @param $(objsuff) Object suffix.
97TOOL_VCC80X86_COMPILE_C_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
98TOOL_VCC80X86_COMPILE_C_DEPEND =
99TOOL_VCC80X86_COMPILE_C_DEPORD =
100ifdef VCC80X86_NEW_DEPS
101define TOOL_VCC80X86_COMPILE_C_CMDS
102 $(TOOL_VCC80X86_CC) -c\
103 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
104 -Fd$(outbase)-obj.pdb \
105 -FD\
106 -Fo$(obj)\
107 $(subst /,\\,$(call ABSPATH,$(source)))
108 $(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
109endef
110else
111define TOOL_VCC80X86_COMPILE_C_CMDS
112 $(TOOL_VCC80X86_CC) -c\
113 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
114 -Fd$(outbase)-obj.pdb \
115 -Fo$(obj)\
116 $(subst /,\\,$(call ABSPATH,$(source)))
117 $(TOOL_VCC80X86_CC) -E\
118 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
119 $(subst /,\\,$(call ABSPATH,$(source)))\
120 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
121endef
122endif
123
124
125## Compile C++ source.
126# @param $(target) Normalized main target name.
127# @param $(source) Source filename (relative).
128# @param $(obj) Object file name. This shall be (re)created by the compilation.
129# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
130# @param $(flags) Flags.
131# @param $(defs) Definitions. No -D or something.
132# @param $(incs) Includes. No -I or something.
133# @param $(dirdep) Directory creation dependency.
134# @param $(deps) Other dependencies.
135#
136# @param $(outbase) Output basename (full). Use this for list files and such.
137# @param $(objsuff) Object suffix.
138TOOL_VCC80X86_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
139TOOL_VCC80X86_COMPILE_CXX_DEPEND =
140TOOL_VCC80X86_COMPILE_CXX_DEPORD =
141ifdef VCC80X86_NEW_DEPS
142define TOOL_VCC80X86_COMPILE_CXX_CMDS
143 $(TOOL_VCC80X86_CXX) -c\
144 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
145 -Fd$(outbase)-obj.pdb \
146 -FD\
147 -Fo$(obj)\
148 $(subst /,\\,$(call ABSPATH,$(source)))
149 $(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
150endef
151else
152define TOOL_VCC80X86_COMPILE_CXX_CMDS
153 $(TOOL_VCC80X86_CXX) -c\
154 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
155 -Fd$(outbase)-obj.pdb \
156 -Fo$(obj)\
157 $(subst /,\\,$(call ABSPATH,$(source)))
158 $(TOOL_VCC80X86_CXX) -E\
159 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
160 $(subst /,\\,$(call ABSPATH,$(source)))\
161 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
162endef
163endif
164
165
166## Compile resource source.
167# @param $(target) Normalized main target name.
168# @param $(source) Source filename (relative).
169# @param $(obj) Object file name. This shall be (re)created by the compilation.
170# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
171# @param $(flags) Flags.
172# @param $(defs) Definitions. No -D or something.
173# @param $(incs) Includes. No -I or something.
174# @param $(dirdep) Directory creation dependency.
175# @param $(deps) Other dependencies.
176#
177# @param $(outbase) Output basename (full). Use this for list files and such.
178# @param $(objsuff) Object suffix.
179TOOL_VCC80X86_COMPILE_RC_OUTPUT =
180TOOL_VCC80X86_COMPILE_RC_DEPEND =
181TOOL_VCC80X86_COMPILE_RC_DEPORD =
182define TOOL_VCC80X86_COMPILE_RC_CMDS
183 $(TOOL_VCC80X86_RC) \
184 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
185 /fo$(obj)\
186 $(subst /,\\,$(call ABSPATH,$(source)))
187endef
188
189
190## Link library
191# @param $(target) Normalized main target name.
192# @param $(out) Library name.
193# @param $(objs) Object files to put in the library.
194# @param $(flags) Flags.
195# @param $(dirdep) Directory creation dependency.
196# @param $(deps) Other dependencies.
197# @param $(othersrc) Unhandled sources.
198# @param $(outbase) Output basename (full). Use this for list files and such.
199#
200TOOL_VCC80X86_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(outbase).pdb
201TOOL_VCC80X86_LINK_LIBRARY_DEPEND = $(othersrc)
202TOOL_VCC80X86_LINK_LIBRARY_DEPORD =
203define TOOL_VCC80X86_LINK_LIBRARY_CMDS
204 $(TOOL_VCC80X86_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
205 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
206endef
207
208
209## Link program
210# @param $(target) Normalized main target name.
211# @param $(out) Program name.
212# @param $(objs) Object files to link together.
213# @param $(libs) Libraries to search.
214# @param $(libpath) Library search paths.
215# @param $(flags) Flags.
216# @param $(dirdep) Directory creation dependency.
217# @param $(deps) Other dependencies.
218# @param $(othersrc) Unhandled sources.
219# @param $(custom_pre) Custom step invoked before linking.
220# @param $(custom_post) Custom step invoked after linking.
221# @param $(outbase) Output basename (full). Use this for list files and such.
222#
223TOOL_VCC80X86_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
224TOOL_VCC80X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
225TOOL_VCC80X86_LINK_PROGRAM_DEPORD =
226define TOOL_VCC80X86_LINK_PROGRAM_CMDS
227 $(TOOL_VCC80X86_LD) $(flags) \
228 /OUT:$(out) \
229 /MAPINFO:EXPORTS /INCREMENTAL:NO \
230 /MAP:$(outbase).map \
231 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
232 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
233 $(foreach p,$(libpath), /LIBPATH:$(p)) \
234 $(subst /,\\,$(objs)) \
235 $(subst /,\\,$(libs))
236 if test -f $(out).manifest; then \
237 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out)); \
238 fi
239endef
240
241
242## Link DLL.
243# @param $(target) Normalized main target name.
244# @param $(out) DLL 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#
255# @param $(outbase) Output basename (full). Use this for list files and such.
256TOOL_VCC80X86_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
257TOOL_VCC80X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
258TOOL_VCC80X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
259define TOOL_VCC80X86_LINK_DLL_CMDS
260 $(TOOL_VCC80X86_LD) $(flags) \
261 /OUT:$(out) \
262 /IMPLIB:$(outbase).lib \
263 /MAPINFO:EXPORTS /INCREMENTAL:NO \
264 /MAP:$(outbase).map \
265 /DLL \
266 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
267 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
268 $(foreach p,$(libpath), /LIBPATH:$(p)) \
269 $(subst /,\\,$(objs)) \
270 $(subst /,\\,$(libs))
271 if test -f $(out).manifest; then \
272 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
273 fi
274ifeq ($(filter %.exp .def,$(othersrc)),)
275 if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
276 if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
277endif
278$(eval _DIRS += $(PATH_LIB))
279endef
280
281
282## Link system module (windows aka driver, linux aka kernel module)
283# @param $(target) Normalized main target name.
284# @param $(out) System module name.
285# @param $(objs) Object files to link together.
286# @param $(libs) Libraries to search.
287# @param $(libpath) Library search paths.
288# @param $(flags) Flags.
289# @param $(dirdep) Directory creation dependency.
290# @param $(deps) Other dependencies.
291# @param $(othersrc) Unhandled sources.
292# @param $(custom_pre) Custom step invoked before linking.
293# @param $(custom_post) Custom step invoked after linking.
294#
295# @param $(outbase) Output basename (full). Use this for list files and such.
296TOOL_VCC80X86_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(outbase).pdb $(outbase).ilk $(out).manifest
297TOOL_VCC80X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
298TOOL_VCC80X86_LINK_SYSMOD_DEPORD =
299define TOOL_VCC80X86_LINK_SYSMOD_CMDS
300 $(TOOL_VCC80X86_LD) $(flags) \
301 /OUT:$(out) \
302 /MAPINFO:EXPORTS /INCREMENTAL:NO \
303 /MAP:$(outbase).map \
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 if test -f $(out).manifest; then \
310 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest "-outputresource:$(subst /,\\,$(out));#2"; \
311 fi
312endef
313
Note: See TracBrowser for help on using the repository browser.