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

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

Corrected Visual C++ 8.0 paths.

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