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

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

use ?= everywhere.

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