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

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

RCINCS.

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